GeneticAlgorithmPython icon indicating copy to clipboard operation
GeneticAlgorithmPython copied to clipboard

Implementation of the elitism feature

Open eoantunes opened this issue 4 years ago • 2 comments

Initially I would like to thank you for the excellent work.

Moving on to the question at hand, I've identified that there is no version of PyGAD that has already delivered elitism functionality. Currently a similar effect can be achieved with just a few parent selection methods by making use of the variable keep_parents = -1(default) or >0.

As noted in the code comment itself: "For some parent selection operators like rank selection, the parents are of high quality and it is beneficial to keep them in the next generation. In some other parent selection operators like roulette wheel selection (RWS), it is not guranteed that the parents will be of high quality and thus keeping the parents might degarde the quality of the population." This functionality is interesting and important, so its implementation is my suggestion to make this work even better! The expected behavior would be elitsm = 0(default) or >0, if >0 a specific number of best solutions or individuals from the current population would be kept in the next generation population.

This is my suggestion, thanks again!

eoantunes avatar Oct 25 '21 14:10 eoantunes

From looking at the code, it seems that keep_parents performs elitism using steady state selection regardless of what selection operator you pass as an argument. How would 'elitism=2' differ from 'keep_parents=2'? Would elitism replace keep_parents?

christian-oleary avatar Dec 08 '21 12:12 christian-oleary

@eoantunes @christian-oleary Thanks you and apologize for following up that late!

The keep_parents parameter does not support elitism selection because it only keeps the parents. Sometimes the parents are not the best solutions.

This will be supported in a future release!

ahmedfgad avatar Aug 02 '22 17:08 ahmedfgad