Refactor improvement checking and adaptive population size in GP Optimisers
Created by: gkirgizov
Primary changes:
- Introduce GenerationKeeper: It encapsulates watching improvements/stagnation and keeping best individuals through generations
- Drop usages of supplementary metrics in optimisers: In favor of using compound SingleObjFitness with supplementary metrics.
- Encapsulate dynamic parameter of next offspring size in AdaptiveParameter.
This simplifies main optimiser loop a lot, allowing to drop many variables with duplicate functionality,
thanks to combination of GenerationKeeper and Fitness. See
AdaptivePopulationSize
class. - Other minor code refactorings (notably dropping custom ParetoFront subclass as it doesn't really override any functionality)
Important notes on changes in API:
- Now if only 1 metric is provided, additional default complexity metric is appended to
metrics
The appended metric is the previously used and scattered in Optimisers supplementary metric, which is used for distinguishing individuals with equal fitness. See usages ofComposerBuilder._default_complexity_metrics()
This PR is a part of big refactoring #608 (closed)