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
ConstructorsConstructorDescriptionStrengthFitnessEvaluator(int k) Constructs a new fitness evaluator for computing the strength measure with crowding-based niching. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif larger fitness values are preferred; otherwise smaller fitness values are preferred.voidevaluate(Population population) Evaluates the fitness of solutions in the population, updating theFitnessattribute.intgetK()Returns the valuekthat controls which nearest neighbor is used to compute the crowding distance.voidsetK(int k) Sets the valuekthat 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, waitMethods 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 valuekthat controls which nearest neighbor is used to compute the crowding distance.- Returns:
- the value
k
-
setK
public void setK(int k) Sets the valuekthat controls which nearest neighbor is used to compute the crowding distance. This is set to1by default.- Parameters:
k- the valuek
-
evaluate
Description copied from interface:FitnessEvaluatorEvaluates the fitness of solutions in the population, updating theFitnessattribute.- Specified by:
evaluatein interfaceFitnessEvaluator- Parameters:
population- the population to be evaluated
-
areLargerValuesPreferred
public boolean areLargerValuesPreferred()Description copied from interface:FitnessEvaluatorReturnstrueif larger fitness values are preferred; otherwise smaller fitness values are preferred.- Specified by:
areLargerValuesPreferredin interfaceFitnessEvaluator- Returns:
trueif larger fitness values are preferred; otherwise smaller fitness values are preferred
-