Slices of code applied to this problem.
Function required:
def createOwnGen(self , ga_engine):
gen = ga_engine.getCurrentGeneration()
if gen == 0 and self.previous_population != []:
population = ga_engine.getPopulation()
popSize = len(population)
for i in xrange(popSize/2):
population[popSize/2+i] = self.previous_population[i]
population.sort()
return False
stepCallback (native function from pyevolve) is called in every generation .
....
ga.stepCallback.set(self.createOwnGen)
....
bestIndividue = ga.bestIndividual()
population = ga.getPopulation()
self.previous_population = population.internalPop
....