Hi,
I've just been playing with the library and noticed that the code only ever creates a maximum of 2 children each generation.
The relevant code is shown below:
new_childs = []
new_generation.each_pair do |chromosome1, chromosome2|
if rand > (1 - @p_combination)
@logger.debug "Recombining" if @logger
new_childs = chromosome1.recombine(chromosome2)
end
end
new_generation + new_childs
I believe the line:
new_childs = chromosome1.recombine(chromosome2)
should say:
new_childs.concat(chromosome1.recombine(chromosome2))
cheers,
mick
BTW: thanks for creating the library. Saved me some effort! |