crossover function is supposed to generate a
child for each pair of
population has all the
individuals of the present generation.
pool has the index of each parent that will be used to generate the
So, the first two values of
pool [4, 4] will be crossed at
crosspoint = 3. Indexes [0,3] of the left 4 and the indexes [3, 10] of the right 4 will be used. For this case, as the left and right parent are the same the result will be a similar
As you can see in the first line of results (starting with
par1 is 4 and it really corresponds to the index 4 of
Still, in the first line
par2 that also refers to index 4 is also correct.
In the fifth line,
par2 (4) is also correct.
But in the last line,
[0 0 1 1 1 1 0 1 0 0] is different from what it should be
[0 0 1 1 0 1 1 1 1 1].
Why is that?