T
- The type of entity that is to be evolved.public class GenerationalEvolutionEngine<T extends java.lang.Comparable<? super 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.
SteadyStateEvolutionEngine
,
EvolutionStrategyEngine
Modifier and Type | Field and Description |
---|---|
protected EvolutionaryOperator<T> |
evolutionScheme |
protected FitnessEvaluator<? super T> |
fitnessEvaluator |
protected SelectionStrategy<? super T> |
selectionStrategy |
candidateFactory, rng, satisfiedTerminationConditions
Constructor and Description |
---|
GenerationalEvolutionEngine(CandidateFactory<T> candidateFactory,
EvolutionaryOperator<T> evolutionScheme,
FitnessEvaluator<? super T> fitnessEvaluator,
SelectionStrategy<? super T> selectionStrategy,
java.util.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,
java.util.Random rng)
Creates a new evolution engine for an interactive evolutionary algorithm.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List<EvaluatedCandidate<T>> |
nextEvolutionStep(java.util.List<EvaluatedCandidate<T>> evaluatedPopulation,
int eliteCount,
java.util.Random rng)
This method performs a single step/iteration of the evolutionary process.
|
addEvolutionObserver, evaluatePopulation, evolve, evolve, evolvePopulation, evolvePopulation, getSatisfiedTerminationConditions, notifyPopulationChange, removeEvolutionObserver, setSingleThreaded
protected final EvolutionaryOperator<T extends java.lang.Comparable<? super T>> evolutionScheme
protected final FitnessEvaluator<? super T extends java.lang.Comparable<? super T>> fitnessEvaluator
protected final SelectionStrategy<? super T extends java.lang.Comparable<? super T>> selectionStrategy
public GenerationalEvolutionEngine(CandidateFactory<T> candidateFactory, EvolutionaryOperator<T> evolutionScheme, FitnessEvaluator<? super T> fitnessEvaluator, SelectionStrategy<? super T> selectionStrategy, java.util.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, java.util.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 java.util.List<EvaluatedCandidate<T>> nextEvolutionStep(java.util.List<EvaluatedCandidate<T>> evaluatedPopulation, int eliteCount, java.util.Random rng)
nextEvolutionStep
in class AbstractEvolutionEngine<T extends java.lang.Comparable<? super 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.