Closed DavidLC98 closed 8 months ago
From your description, it sounds like you want GenerationNumberTermination instead of FitnessStagnationTermination.
Read more about Terminations on this wiki page: https://github.com/giacomelli/GeneticSharp/wiki/terminations
Issue Summary: When using FitnessStagnationTermination with a specific generation limit (1000 in this case), the genetic algorithm does not terminate at the expected generation. Instead, it continues running, often concluding around the 2000th generation.
Steps to Reproduce: 1- Set up the termination condition of a Genetic Algorithm (GA) using FitnessStagnationTermination, like so:
var termination = new FitnessStagnationTermination(1000);
2- Subscribe to the GA's GenerationRan event to perform an action in each generation (e.g., updating a progress bar):
ga.GenerationRan += Ga_GenerationRan;
3- Run the GA.
Expected Behavior: The GA process should terminate upon reaching 1000 generations as specified in the FitnessStagnationTermination setting.
Actual Behavior: The GA process does not terminate at the 1000th generation as expected. It often continues running until approximately the 2000th generation.
My real Code:![image](https://github.com/giacomelli/GeneticSharp/assets/57411593/2b8e2c7c-61e8-4e7f-bec2-1764a5b0b889)