Open AlexanderTreml opened 1 month ago
Thanks for reporting @AlexanderTreml. Indeed, the Python version of BRKGA-IPR is not well-tested and lags behind the C++ version, so it is nice when these bugs come around.
However, I do not intend to fix this any time soon. Please feel free to submit a patch via PR request. I will be glad to add you as a collaborator in this project.
Actually, I noticed that the code was already fixed with #1. It's just the version installed by pip that still uses the erroneous code.
The fitness of the chromosome returned from
get_best_chromosome()
sometimes does not match the fitness returned byget_best_fitness()
. This is because the index structure is not maintained in the lines 680-683 of "algorithm.py". Elite chromosomes are copied to the top of thechromosomes
list. But the indices of the elite chromosomes in thefitness
data structure are not updated.The following code should reproduce the issue, when executed with the config file given below: