Looking for a way to reuse 50% of previous population best individuals in different GA iteration .
For example at the end of current iteration inside a process do "population = ga.getPopulation()".Next iteration initialize 50% of that pop.
Does anyone know how to handle the population results?
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
....