Class SingleObjectiveEvolutionaryAlgorithm
java.lang.Object
org.moeaframework.algorithm.AbstractAlgorithm
org.moeaframework.algorithm.AbstractEvolutionaryAlgorithm
org.moeaframework.algorithm.single.SingleObjectiveEvolutionaryAlgorithm
- All Implemented Interfaces:
Extensible
,Algorithm
,Configurable
,EvolutionaryAlgorithm
,Stateful
- Direct Known Subclasses:
DifferentialEvolution
,EvolutionStrategy
,GeneticAlgorithm
Abstract class for building single-objective evolutionary algorithms. These use an aggregating or scalarizing
function that converts multiple objective values into a single fitness value.
-
Field Summary
Modifier and TypeFieldDescriptionprotected AggregateObjectiveComparator
The aggregate objective comparator.Fields inherited from class org.moeaframework.algorithm.AbstractAlgorithm
initialized, numberOfEvaluations, problem, terminated
-
Constructor Summary
ConstructorDescriptionSingleObjectiveEvolutionaryAlgorithm
(Problem problem, int initialPopulationSize, Population population, NondominatedPopulation archive, AggregateObjectiveComparator comparator, Initialization initialization, Variation variation) Constructs a new single-objective algorithm. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyConfiguration
(TypedProperties properties) Applies the properties to this instance.Returns the aggregate objective comparator that scalarizes multiple objectives into a single fitness value.Gets the current configuration of this instance.Returns the current best-known result.void
setComparator
(AggregateObjectiveComparator comparator) Sets the aggregate objective comparator that scalarizes multiple objectives into a single fitness value.void
setInitialPopulationSize
(int initialPopulationSize) Sets the initial population size.Methods inherited from class org.moeaframework.algorithm.AbstractEvolutionaryAlgorithm
getArchive, getInitialization, getInitialPopulationSize, getPopulation, getVariation, initialize, loadState, saveState, setArchive, setInitialization, setPopulation, setVariation
Methods inherited from class org.moeaframework.algorithm.AbstractAlgorithm
assertNotInitialized, evaluate, getExtensions, getNumberOfEvaluations, getProblem, isInitialized, isTerminated, iterate, step, terminate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.core.Algorithm
evaluate, evaluateAll, evaluateAll, getNumberOfEvaluations, getProblem, isInitialized, isTerminated, run, run, step, terminate
Methods inherited from interface org.moeaframework.algorithm.extension.Extensible
addExtension, getExtensions, removeExtension
-
Field Details
-
comparator
The aggregate objective comparator.
-
-
Constructor Details
-
SingleObjectiveEvolutionaryAlgorithm
public SingleObjectiveEvolutionaryAlgorithm(Problem problem, int initialPopulationSize, Population population, NondominatedPopulation archive, AggregateObjectiveComparator comparator, Initialization initialization, Variation variation) Constructs a new single-objective algorithm.- Parameters:
problem
- the problem to solveinitialPopulationSize
- the initial population sizepopulation
- the populationarchive
- the archive storing the non-dominated solutionscomparator
- the aggregate objective comparatorinitialization
- the initialization methodvariation
- the variation operator
-
-
Method Details
-
getResult
Description copied from interface:Algorithm
Returns the current best-known result.- Specified by:
getResult
in interfaceAlgorithm
- Overrides:
getResult
in classAbstractEvolutionaryAlgorithm
- Returns:
- the current best-known result
-
getComparator
Returns the aggregate objective comparator that scalarizes multiple objectives into a single fitness value.- Returns:
- the aggregate objective comparator
-
setComparator
Sets the aggregate objective comparator that scalarizes multiple objectives into a single fitness value.- Parameters:
comparator
- the aggregate objective comparator
-
setInitialPopulationSize
public void setInitialPopulationSize(int initialPopulationSize) Description copied from class:AbstractEvolutionaryAlgorithm
Sets the initial population size. This value can not be set after initialization.- Overrides:
setInitialPopulationSize
in classAbstractEvolutionaryAlgorithm
- Parameters:
initialPopulationSize
- the initial population size
-
applyConfiguration
Description copied from interface:Configurable
Applies the properties to this instance. It is strongly recommended to apply a configuration immediately after creating the instance, as some properties can not be changed after the class is used. Exceptions may be thrown if attempting to set such properties. After calling this method, we encourage users to callTypedProperties.warnIfUnaccessedProperties()
to verify all properties were processed. This can identify simple mistakes like typos. If overriding this method, properties should only be updated if a new value is provided. Additionally, if updating anyConfigurable
objects inside this object, they should be updated before callingsuper.applyConfiguration(properties)
.- Parameters:
properties
- the user-defined properties
-
getConfiguration
Description copied from interface:Configurable
Gets the current configuration of this instance. In theory, these properties should be able to create a duplicate instance. Note however, they are unlikely to behave identically due to random numbers and other transient fields.- Returns:
- the properties defining this instance
-