Package org.moeaframework.algorithm
Class SPEA2.StrengthFitnessEvaluator
java.lang.Object
org.moeaframework.algorithm.SPEA2.StrengthFitnessEvaluator
- All Implemented Interfaces:
Configurable
,FitnessEvaluator
- Enclosing class:
- SPEA2
public class SPEA2.StrengthFitnessEvaluator
extends Object
implements FitnessEvaluator, Configurable
Fitness evaluator for the strength measure with crowding-based niching.
-
Constructor Summary
ConstructorDescriptionStrengthFitnessEvaluator
(int k) Constructs a new fitness evaluator for computing the strength measure with crowding-based niching. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if larger fitness values are preferred; otherwise smaller fitness values are preferred.void
evaluate
(Population population) Evaluates the fitness of solutions in the population, updating theFitness
attribute.int
getK()
Returns the valuek
that controls which nearest neighbor is used to compute the crowding distance.void
setK
(int k) Sets the valuek
that controls which nearest neighbor is used to compute the crowding distance.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.configuration.Configurable
applyConfiguration, getConfiguration
-
Constructor Details
-
StrengthFitnessEvaluator
public StrengthFitnessEvaluator(int k) Constructs a new fitness evaluator for computing the strength measure with crowding-based niching.- Parameters:
k
- crowding is based on the distance to thek
-th nearest neighbor
-
-
Method Details
-
getK
public int getK()Returns the valuek
that controls which nearest neighbor is used to compute the crowding distance.- Returns:
- the value
k
-
setK
public void setK(int k) Sets the valuek
that controls which nearest neighbor is used to compute the crowding distance. This is set to1
by default.- Parameters:
k
- the valuek
-
evaluate
Description copied from interface:FitnessEvaluator
Evaluates the fitness of solutions in the population, updating theFitness
attribute.- Specified by:
evaluate
in interfaceFitnessEvaluator
- Parameters:
population
- the population to be evaluated
-
areLargerValuesPreferred
public boolean areLargerValuesPreferred()Description copied from interface:FitnessEvaluator
Returnstrue
if larger fitness values are preferred; otherwise smaller fitness values are preferred.- Specified by:
areLargerValuesPreferred
in interfaceFitnessEvaluator
- Returns:
true
if larger fitness values are preferred; otherwise smaller fitness values are preferred
-