Package edu.cnu.mdi.sim.ga
Interface MutationOperator<T extends GASolution<T>>
- All Known Implementing Classes:
GaussianMutation
public interface MutationOperator<T extends GASolution<T>>
Interface for mutation operators in genetic algorithms. A mutation operator defines
how an individual solution is randomly modified.
The GA will call this interface to perform mutation on individuals in the population.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbeginGeneration(long generation, long maxGenerations) Notify the operator before offspring are created for a generation.Mutate an individual, either in-place or by returning a replacement.default TApply the configured mutation probability to one offspring.
-
Method Details
-
beginGeneration
default void beginGeneration(long generation, long maxGenerations) Notify the operator before offspring are created for a generation. Stateful operators may use this to adapt their mutation strength.- Parameters:
generation- generation about to be produced, starting at zeromaxGenerations- configured generation limit
-
mutate
Mutate an individual, either in-place or by returning a replacement.- Parameters:
individual- individual to mutaterng- source of randomness- Returns:
- non-null mutated individual
-
mutate
Apply the configured mutation probability to one offspring. Operators with gene-level mutation semantics may override this method and interpretmutationRateat that finer granularity.- Parameters:
individual- offspring to consider for mutationrng- source of randomnessmutationRate- configured rate in[0,1]- Returns:
- the original or mutated individual; never
null
-