Closed jbytecode closed 3 months ago
The issue if current for the other operators, e.g. recombinations:
recombination(
parents, problem).get_recombinations()
in the code above, in each single iteration, a new instance of the crossover class is created and the object method is called. I think the use of operators mostly triggers the garbage collector of Python and a performance improvement can be achieved if this stage is optimized.
same for the mutations:
if rnd < p_mutation:
mutated = mutation(mutation_cand, problem).mutate()
offsprings[p] = mutated
else:
pass
I think this can be done later, I am setting this a lower priority (seems difficult by now)
Suppose the code is
selection(pop_list, c).get_parents()
where selection is an instance of one of the selection operators. In each call, a new instance is created (like new in C#) and then the object method is called. This is a performance overhead. The operator objects should be created ones, or, pre-created operator should be passed to the optimizer, e.g.