Package org.moeaframework.algorithm
Class NSGAII
java.lang.Object
org.moeaframework.algorithm.AbstractAlgorithm
org.moeaframework.algorithm.AbstractEvolutionaryAlgorithm
org.moeaframework.algorithm.NSGAII
- All Implemented Interfaces:
Extensible
,Algorithm
,Configurable
,EpsilonBoxEvolutionaryAlgorithm
,EvolutionaryAlgorithm
,Stateful
- Direct Known Subclasses:
EpsilonNSGAII
,NSGAIII
public class NSGAII
extends AbstractEvolutionaryAlgorithm
implements EpsilonBoxEvolutionaryAlgorithm
Implementation of NSGA-II, with the ability to attach an optional ε-dominance archive.
References:
- Deb, K. et al. "A Fast Elitist Multi-Objective Genetic Algorithm: NSGA-II." IEEE Transactions on Evolutionary Computation, 6:182-197, 2000.
- Kollat, J. B., and Reed, P. M. "Comparison of Multi-Objective Evolutionary Algorithms for Long-Term Monitoring Design." Advances in Water Resources, 29(6):792-807, 2006.
-
Field Summary
Fields inherited from class org.moeaframework.algorithm.AbstractAlgorithm
initialized, numberOfEvaluations, problem, terminated
-
Constructor Summary
ConstructorDescriptionConstructs the NSGA-II algorithm with default settings.NSGAII
(Problem problem, int initialPopulationSize, NondominatedSortingPopulation population, EpsilonBoxDominanceArchive archive, Selection selection, Variation variation, Initialization initialization) Constructs the NSGA-II algorithm with the specified components. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyConfiguration
(TypedProperties properties) Applies the properties to this instance.Returns the current non-dominated archive of the best solutions generated by this evolutionary algorithm, ornull
if no archive is used.Gets the current configuration of this instance.Returns the current population of this evolutionary algorithm.void
iterate()
Performs one iteration of the algorithm.void
setArchive
(EpsilonBoxDominanceArchive archive) Sets the archive used by this algorithm.void
setInitialPopulationSize
(int initialPopulationSize) Sets the initial population size.void
setVariation
(Variation variation) Replaces the variation operator to be used by this algorithm.Methods inherited from class org.moeaframework.algorithm.AbstractEvolutionaryAlgorithm
getInitialization, getInitialPopulationSize, getResult, getVariation, initialize, loadState, saveState, setArchive, setInitialization, setPopulation
Methods inherited from class org.moeaframework.algorithm.AbstractAlgorithm
assertNotInitialized, evaluate, getExtensions, getNumberOfEvaluations, getProblem, isInitialized, isTerminated, 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, getResult, initialize, isInitialized, isTerminated, run, run, step, terminate
Methods inherited from interface org.moeaframework.algorithm.extension.Extensible
addExtension, getExtensions, removeExtension
-
Constructor Details
-
NSGAII
Constructs the NSGA-II algorithm with default settings.- Parameters:
problem
- the problem being solved
-
NSGAII
public NSGAII(Problem problem, int initialPopulationSize, NondominatedSortingPopulation population, EpsilonBoxDominanceArchive archive, Selection selection, Variation variation, Initialization initialization) Constructs the NSGA-II algorithm with the specified components.- Parameters:
problem
- the problem being solvedinitialPopulationSize
- the initial population sizepopulation
- the population used to store solutionsarchive
- the archive used to store the result; can benull
selection
- the selection operatorvariation
- the variation operatorinitialization
- the initialization method
-
-
Method Details
-
iterate
public void iterate()Description copied from class:AbstractAlgorithm
Performs one iteration of the algorithm. This method should be overridden by implementations to perform each logical iteration of the algorithm.- Specified by:
iterate
in classAbstractAlgorithm
-
setVariation
Description copied from class:AbstractEvolutionaryAlgorithm
Replaces the variation operator to be used by this algorithm.- Overrides:
setVariation
in classAbstractEvolutionaryAlgorithm
- Parameters:
variation
- the variation operator
-
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
-
getArchive
Description copied from interface:EvolutionaryAlgorithm
Returns the current non-dominated archive of the best solutions generated by this evolutionary algorithm, ornull
if no archive is used.- Specified by:
getArchive
in interfaceEpsilonBoxEvolutionaryAlgorithm
- Specified by:
getArchive
in interfaceEvolutionaryAlgorithm
- Overrides:
getArchive
in classAbstractEvolutionaryAlgorithm
- Returns:
- the current non-dominated archive of the best solutions generated by this evolutionary algorithm,
or
null
if no archive is used
-
setArchive
Sets the archive used by this algorithm. This value can not be set after initialization.- Parameters:
archive
- the archive
-
getPopulation
Description copied from interface:EvolutionaryAlgorithm
Returns the current population of this evolutionary algorithm.- Specified by:
getPopulation
in interfaceEvolutionaryAlgorithm
- Overrides:
getPopulation
in classAbstractEvolutionaryAlgorithm
- Returns:
- the current population of this evolutionary algorithm
-
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)
.- Specified by:
applyConfiguration
in interfaceConfigurable
- 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.- Specified by:
getConfiguration
in interfaceConfigurable
- Returns:
- the properties defining this instance
-