Open thineswaran opened 4 years ago
This should do the trick. It is a little rough, but it is a starting point.
pop = toolbox.population(2)
for gen in range(NGEN):
c1, c2 = [toolbox.clone(c) for c in pop]
c1, c2 = toolbox.mate([c1, c2])
c1, = toolbox.mutate(c1) # Mutation returns a list (note the comma)
c2, = toolbox.mutate(c2)
for c in [c1, c2]:
c.fitness.values = toolbox.evaluate(c)
pop = toolbox.select(pop + [c1, c2], 2)
Thanks a lot for the feedback. Really appreciate it. Will try it out.
Most of the examples given appear to be using generational replacement as the survivor selection strategy.
Could you please give some examples on how to use steady state replacement?