T
- The type of entity that is to be evolved.public class GenerationalEvolutionEngine<T> extends AbstractEvolutionEngine<T>
This class implements a general-purpose generational evolutionary algorithm. It supports optional concurrent fitness evaluations to take full advantage of multi-processor, multi-core and hyper-threaded machines.
If multi-threading is enabled, evolution (mutation, cross-over, etc.) occurs on the request thread but fitness evaluations are delegated to a pool of worker threads. All of the host's available processing units are used (i.e. on a quad-core machine there will be four fitness evaluation worker threads).
If multi-threading is disabled, all work is performed synchronously on the request thread. This strategy is suitable for restricted/managed environments where it is not permitted for applications to manage their own threads. If there are no restrictions on concurrency, applications should enable multi-threading for improved performance.
Constructor and Description |
---|
GenerationalEvolutionEngine(CandidateFactory<T> candidateFactory,
EvolutionaryOperator<T> evolutionScheme,
FitnessEvaluator<? super T> fitnessEvaluator,
SelectionStrategy<? super T> selectionStrategy,
Random rng)
Creates a new evolution engine by specifying the various components required by
a generational evolutionary algorithm.
|
GenerationalEvolutionEngine(CandidateFactory<T> candidateFactory,
EvolutionaryOperator<T> evolutionScheme,
InteractiveSelection<T> selectionStrategy,
Random rng)
Creates a new evolution engine for an interactive evolutionary algorithm.
|
Modifier and Type | Method and Description |
---|---|
protected List<EvaluatedCandidate<T>> |
nextEvolutionStep(List<EvaluatedCandidate<T>> evaluatedPopulation,
int eliteCount,
Random rng)
This method performs a single step/iteration of the evolutionary process.
|
addEvolutionObserver, evaluatePopulation, evolve, evolve, evolvePopulation, evolvePopulation, getSatisfiedTerminationConditions, removeEvolutionObserver, setSingleThreaded
public GenerationalEvolutionEngine(CandidateFactory<T> candidateFactory, EvolutionaryOperator<T> evolutionScheme, FitnessEvaluator<? super T> fitnessEvaluator, SelectionStrategy<? super T> selectionStrategy, Random rng)
candidateFactory
- Factory used to create the initial population that is
iteratively evolved.evolutionScheme
- The combination of evolutionary operators used to evolve
the population at each generation.fitnessEvaluator
- A function for assigning fitness scores to candidate
solutions.selectionStrategy
- A strategy for selecting which candidates survive to
be evolved.rng
- The source of randomness used by all stochastic processes (including
evolutionary operators and selection strategies).public GenerationalEvolutionEngine(CandidateFactory<T> candidateFactory, EvolutionaryOperator<T> evolutionScheme, InteractiveSelection<T> selectionStrategy, Random rng)
candidateFactory
- Factory used to create the initial population that is
iteratively evolved.evolutionScheme
- The combination of evolutionary operators used to evolve
the population at each generation.selectionStrategy
- Interactive selection strategy configured with appropriate
console.rng
- The source of randomness used by all stochastic processes (including
evolutionary operators and selection strategies).protected List<EvaluatedCandidate<T>> nextEvolutionStep(List<EvaluatedCandidate<T>> evaluatedPopulation, int eliteCount, Random rng)
nextEvolutionStep
in class AbstractEvolutionEngine<T>
evaluatedPopulation
- The population at the beginning of the process.eliteCount
- The number of the fittest individuals that must be preserved.rng
- A source of randomness.