Package org.opt4j.optimizer.ea
Class EvolutionaryAlgorithm
- java.lang.Object
-
- org.opt4j.core.optimizer.AbstractOptimizer
-
- org.opt4j.optimizer.ea.EvolutionaryAlgorithm
-
- All Implemented Interfaces:
Optimizer
public class EvolutionaryAlgorithm extends AbstractOptimizer
TheEvolutionaryAlgorithm
is an implementation of an Evolutionary Algorithm based on the operatorsCrossover
andMutate
. It uses aSelector
for the mating and environmental selection.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
alpha
protected IndividualFactory
individualFactory
protected int
lambda
protected Mating
mating
protected int
mu
protected Selector
selector
-
Fields inherited from class org.opt4j.core.optimizer.AbstractOptimizer
archive, completer, control, iteration, iterationListeners, optimizing, population, stateListeners
-
-
Constructor Summary
Constructors Constructor Description EvolutionaryAlgorithm(Population population, Archive archive, IndividualFactory individualFactory, IndividualCompleter completer, Control control, Selector selector, Mating mating, Iteration iteration, int alpha, int mu, int lambda)
Constructs anEvolutionaryAlgorithm
with aPopulation
, anArchive
, anIndividualFactory
, aIndividualCompleter
, aControl
, aSelector
, aMating
, the number of generations, the population size, the number of parents, the number of offspring, and a random number generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
optimize()
Starts the optimization process.-
Methods inherited from class org.opt4j.core.optimizer.AbstractOptimizer
addOptimizerIterationListener, addOptimizerStateListener, getIteration, injectListeners, isRunning, nextIteration, removeOptimizerIterationListener, removeOptimizerStateListener, startOptimization, stopOptimization
-
-
-
-
Field Detail
-
alpha
protected final int alpha
-
lambda
protected final int lambda
-
mu
protected final int mu
-
selector
protected final Selector selector
-
mating
protected final Mating mating
-
individualFactory
protected final IndividualFactory individualFactory
-
-
Constructor Detail
-
EvolutionaryAlgorithm
@Inject public EvolutionaryAlgorithm(Population population, Archive archive, IndividualFactory individualFactory, IndividualCompleter completer, Control control, Selector selector, Mating mating, Iteration iteration, int alpha, int mu, int lambda)
Constructs anEvolutionaryAlgorithm
with aPopulation
, anArchive
, anIndividualFactory
, aIndividualCompleter
, aControl
, aSelector
, aMating
, the number of generations, the population size, the number of parents, the number of offspring, and a random number generator.- Parameters:
population
- the populationarchive
- the archiveindividualFactory
- the individual factorycompleter
- the completercontrol
- the controlselector
- the selectormating
- the matingiteration
- the iteration counteralpha
- the population sizemu
- the number of parentslambda
- the number of offspring
-
-
Method Detail
-
optimize
public void optimize() throws TerminationException, StopException
Description copied from interface:Optimizer
Starts the optimization process.- Throws:
TerminationException
- if the optimization is terminatedStopException
- if the optimization is stopped
-
-