I am using DEAP to run a multi objective optimization using eaSimple
. The code returns the ParetoFront()
after the last generation.
Is there any way to get a set of ParetoFront()
for each generation? I would like to see the evolution of the fronts with every generation.
Simply run one generation at a time. Each time, run the algorithm on the population that was output by the previous run.
Something like
ngen = 50
pop = toolbox.population(n=100)
for i in range(ngen):
pop, logbook = algorithms.eaSimple(pop, toolbox, cxpb=0.5, mutpb=0.2, ngen=1)
You just need to add whatever you are doing with the Pareto front to the above code.