Hi,
I hope you can give an idea. I have the ParetoFront in hof variable
pop, log = algorithms.eaMuPlusLambda(pop, toolbox,
mu=int(POP_SIZE), lambda_= POP_SIZE, cxpb= CX_PROB, mutpb= MUT_PROB,
stats= stats, ngen= MAX_GEN, halloffame=hof, verbose= True)
So, I have the hof (ParetoFront) with some solutions. but I want to make a copy of Hof with some restrictions.
For example a hof have 10 solutions: I want a copy where the "max fitness value" < 0,07700. So I will have a new hof with 5 solutions
Solution (min, max) Fitness values
1 (21038.0, 0.7242)
2 (21290.0, 0.73)
3 (21356.0, 0.7456)
4 (21356.0, 0.7456)
5 (22383.0, 0.7599)
6 (23743.0, 0.7728)
7 (25098.0, 0.7744)
8 (25098.0, 0.7744)
9 (25748.0, 0.7887)
10 (27333.0, 0.8019)
I tried those options but it does not work. Can you give some ideas?
Option 1:
for indv in hof:
if indv.fitness.values[1] > 0.077:
del hof.indv
Option 2: It loss the fitness values
new_hof = list()
for indv in hof:
if indv.fitness.values[1] < 0.077:
new_hof.append(indv)