Make evolutionary operators & Optimiser modular
Created by: gkirgizov
I have a thought of abstracting evolutionary operators as classes, that will encapsulate all necessary parameters and provide concise functional interface. In other words, I'd like to separate specification of the operator from its actual usages.
Motivation is just a cleaner design, that will allow more straightforward extensions and modifications of the base evolutionary algorithm.
Example for mutation:
# specification in __init__ or in Composer
mutation = MutationOperator(types=self.parameters.mutation_types,
params=self.graph_generation_params,
requirements=requirements,
max_depth=max_depth, log=self.log)
...
# simple usage in .optimise()
new_population = self.mutation(previous_population)
If all operators are represented in this form, then Optimiser can be just constructed from specific implementations of operators, something like:
optimiser = EvoOptimiser(mutation_operator, crossover_operator, selection_operator)
Operators to refactor:
-
#737 (closed) -
#727 (closed) -
Mutation -
Selection -
Crossover -
Regularisation -
Elitism can also be represented as an operator acting on previous & new population (its usage can look like next_population = Elitism(previous_pop, new_pop)
)