public class SPEA2 extends AbstractEvolutionaryAlgorithm
Note: First, there is a naming difference between this implementation and
the original SPEA2 paper. The original SPEA2 paper defines a "population"
and an "archive", but the population is really the offspring and the archive
is the population. Secondly, the SPEA2 paper defines a parameter
k = sqrt(population.size())
for computing a crowding-based niching
factor. The SPEA2 C implementation in PISA (written by the same authors
as the paper) recommends using k=1
for performance reasons. This
implementation makes k
a user-specified parameter to support either
option. k
should be at least 1
and no larger than
population.size()
.
References:
Modifier and Type | Class and Description |
---|---|
static class |
SPEA2.MutableDistanceMap
Mapping of pair-wise distances between points.
|
class |
SPEA2.StrengthFitnessEvaluator
Fitness evaluator for the strength measure with crowding-based niching.
|
initialized, numberOfEvaluations, problem, terminated
Constructor and Description |
---|
SPEA2(Problem problem)
Constructs a new instance of SPEA2 with default settings.
|
SPEA2(Problem problem,
int initialPopulationSize,
Initialization initialization,
Variation variation,
int numberOfOffspring,
int k)
Constructs a new instance of SPEA2.
|
Modifier and Type | Method and Description |
---|---|
protected double[][] |
computeDistanceMatrix(Population population)
Computes the distance matrix containing the pair-wise distances between
solutions in objective space.
|
SPEA2.StrengthFitnessEvaluator |
getFitnessEvaluator()
Returns the strength-based fitness evaluator.
|
int |
getNumberOfOffspring()
Returns the number of offspring produced each iteration.
|
protected void |
initialize()
Performs any initialization that is required by this algorithm.
|
protected void |
iterate()
Performs one iteration of the algorithm.
|
void |
setInitialPopulationSize(int initialPopulationSize)
Sets the initial population size.
|
void |
setNumberOfOffspring(int numberOfOffspring)
Sets the number of offspring produced each iteration.
|
void |
setVariation(Variation variation)
Replaces the variation operator to be used by this algorithm.
|
protected Population |
truncate(Population offspring,
int size)
Returns the population of solutions that survive to the next generation.
|
getArchive, getInitialization, getInitialPopulationSize, getPopulation, getResult, getVariation, loadState, saveState, setArchive, setInitialization, setPopulation
assertNotInitialized, evaluate, evaluateAll, evaluateAll, getNumberOfEvaluations, getProblem, isInitialized, isTerminated, step, terminate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evaluate, getNumberOfEvaluations, getProblem, isTerminated, run, run, step, terminate
checkTypeSafety, getState, setState, writeTypeSafety
applyConfiguration, getConfiguration
public SPEA2(Problem problem)
problem
- the problempublic SPEA2(Problem problem, int initialPopulationSize, Initialization initialization, Variation variation, int numberOfOffspring, int k)
problem
- the probleminitialPopulationSize
- the initial population sizeinitialization
- the initialization procedurevariation
- the variation operatornumberOfOffspring
- the number of offspring generated each iterationk
- niching parameter specifying that crowding is computed using
the k
-th nearest neighbor, recommend k=1
public void setVariation(Variation variation)
AbstractEvolutionaryAlgorithm
setVariation
in class AbstractEvolutionaryAlgorithm
variation
- the variation operatorpublic void setInitialPopulationSize(int initialPopulationSize)
AbstractEvolutionaryAlgorithm
setInitialPopulationSize
in class AbstractEvolutionaryAlgorithm
initialPopulationSize
- the initial population sizepublic int getNumberOfOffspring()
public void setNumberOfOffspring(int numberOfOffspring)
numberOfOffspring
- the number of offspringpublic SPEA2.StrengthFitnessEvaluator getFitnessEvaluator()
protected void initialize()
AbstractAlgorithm
AbstractAlgorithm.step()
. Implementations should always invoke
super.initialize()
to ensure the algorithm is initialized
correctly.initialize
in class AbstractEvolutionaryAlgorithm
protected void iterate()
AbstractAlgorithm
iterate
in class AbstractAlgorithm
protected Population truncate(Population offspring, int size)
offspring
- all offspring solutionssize
- the number of solutions to retainprotected double[][] computeDistanceMatrix(Population population)
population
- the population of solutionsCopyright 2009-2024 David Hadka and other contributors. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage.