There can be multiple conditions to check against when determining whether the process can stop. The two most commonly used stopping conditions are:
- A maximum number of generations has been reached. This also serves to limit the runtime and computing resources consumed by the algorithm.
- There was no noticeable improvement over the last few generations. This can be implemented by storing the best fitness value achieved at every generation, and comparing the current best value to the one achieved a predefined number of generations ago. If the difference is smaller than a certain threshold, the algorithm can stop.
Other stopping conditions can be:
- A predetermined amount of time has elapsed since the process ...