search for: new_b2

Displaying 1 result from an estimated 1 matches for "new_b2".

Did you mean: new_bh
2009 Feb 18
2
how to randomly eliminate half the entries in a vector?
...uot;\nhrp: ", different, "\n") # 2. ??? how to do this best so that each time # a different half subset is selected? I.e., # sum(r)/2 positions. # 3. this flips *all* positions, should really only flip # half of them (randomly selected half) new_b1 = b1 new_b2 = b2 for(i in different) # should contain half the entries (randomly) { new_b1[i] = b2[i] new_b2[i] = b1[i] } result <- matrix(c(new_b1, new_b2), 2, LEN, byrow=T) result } LEN = 5 b1=create_bin_Chromosome(LEN) b2=create_bin_Chromosome(LEN) cat(b1, &q...