Package org.opt4j.optimizers.ea
Class EvolutionaryAlgorithmModule
- java.lang.Object
-
- com.google.inject.AbstractModule
-
- org.opt4j.core.start.Opt4JModule
-
- org.opt4j.core.optimizer.OptimizerModule
-
- org.opt4j.optimizers.ea.EvolutionaryAlgorithmModule
-
- All Implemented Interfaces:
com.google.inject.Module
public class EvolutionaryAlgorithmModule extends org.opt4j.core.optimizer.OptimizerModule
TheEvolutionaryAlgorithmModule
configures theEvolutionaryAlgorithm
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EvolutionaryAlgorithmModule.CrossoverRateType
TheEvolutionaryAlgorithmModule.CrossoverRateType
allows to choose between different types of crossover rates.
-
Field Summary
Fields Modifier and Type Field Description protected double
crossoverRate
protected EvolutionaryAlgorithmModule.CrossoverRateType
crossoverRateType
protected int
generations
protected int
offspringsPerGeneration
protected int
parentsPerGeneration
protected int
populationSize
-
Constructor Summary
Constructors Constructor Description EvolutionaryAlgorithmModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
config()
double
getCrossoverRate()
Returns the used crossover rate.EvolutionaryAlgorithmModule.CrossoverRateType
getCrossoverRateType()
Returns the type of crossover rate that is used.int
getGenerations()
Returns the number of generations.int
getOffspringsPerGeneration()
Returns the number of childrenlambda
.int
getParentsPerGeneration()
Returns the number of parentsmu
.int
getPopulationSize()
Returns the population sizealpha
.void
setCrossoverRate(double crossoverRate)
Sets the crossover rate.void
setCrossoverRateType(EvolutionaryAlgorithmModule.CrossoverRateType crossoverRateType)
Sets the type of crossover rate to use.void
setGenerations(int generations)
Sets the number of generations.void
setOffspringsPerGeneration(int lambda)
Sets the number of childrenlambda
.void
setParentsPerGeneration(int mu)
Sets the number of parentsmu
.void
setPopulationSize(int alpha)
Sets the population sizealpha
.-
Methods inherited from class org.opt4j.core.optimizer.OptimizerModule
bindIterativeOptimizer, bindOptimizer
-
Methods inherited from class org.opt4j.core.start.Opt4JModule
addControlListener, addIndividualStateListener, addOptimizerIterationListener, addOptimizerStateListener, bindConstant, bindConstant, bindConstant, bindConstant, configure, constant, multi
-
Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
-
-
-
Field Detail
-
generations
protected int generations
-
populationSize
protected int populationSize
-
parentsPerGeneration
protected int parentsPerGeneration
-
offspringsPerGeneration
protected int offspringsPerGeneration
-
crossoverRate
protected double crossoverRate
-
crossoverRateType
protected EvolutionaryAlgorithmModule.CrossoverRateType crossoverRateType
-
-
Method Detail
-
getPopulationSize
public int getPopulationSize()
Returns the population sizealpha
.- Returns:
- the population size
-
setPopulationSize
public void setPopulationSize(int alpha)
Sets the population sizealpha
.- Parameters:
alpha
- the population size to set
-
getGenerations
public int getGenerations()
Returns the number of generations.- Returns:
- the number of generations
-
setGenerations
public void setGenerations(int generations)
Sets the number of generations.- Parameters:
generations
- the number of generations- See Also:
getGenerations()
-
getOffspringsPerGeneration
public int getOffspringsPerGeneration()
Returns the number of childrenlambda
.- Returns:
- the number of children
-
setOffspringsPerGeneration
public void setOffspringsPerGeneration(int lambda)
Sets the number of childrenlambda
.- Parameters:
lambda
- the number of children
-
getParentsPerGeneration
public int getParentsPerGeneration()
Returns the number of parentsmu
.- Returns:
- the number of parents
-
setParentsPerGeneration
public void setParentsPerGeneration(int mu)
Sets the number of parentsmu
.- Parameters:
mu
- the number of parents
-
getCrossoverRateType
public EvolutionaryAlgorithmModule.CrossoverRateType getCrossoverRateType()
Returns the type of crossover rate that is used.- Returns:
- the crossoverRateType
-
setCrossoverRateType
public void setCrossoverRateType(EvolutionaryAlgorithmModule.CrossoverRateType crossoverRateType)
Sets the type of crossover rate to use.- Parameters:
crossoverRateType
- the crossoverRateType to set
-
getCrossoverRate
public double getCrossoverRate()
Returns the used crossover rate.- Returns:
- the crossoverRate
-
setCrossoverRate
public void setCrossoverRate(double crossoverRate)
Sets the crossover rate.- Parameters:
crossoverRate
- the crossoverRate to set
-
config
public void config()
- Specified by:
config
in classorg.opt4j.core.start.Opt4JModule
-
-