Package org.moeaframework.algorithm
Class SPEA2.MutableDistanceMap
java.lang.Object
org.moeaframework.algorithm.SPEA2.MutableDistanceMap
- Enclosing class:
- SPEA2
Mapping of pair-wise distances between points. This mapping is mutable, allowing points to be removed.
-
Constructor Summary
ConstructorDescriptionMutableDistanceMap
(double[][] rawDistanceMatrix) Constructs a new mapping of pair-wise distances between points. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the most crowded point according to SPEA2's truncation strategy.protected void
initialize
(double[][] rawDistanceMatrix) Initializes the internal data structures.void
removePoint
(int index) Removes the point with the given index.
-
Constructor Details
-
MutableDistanceMap
public MutableDistanceMap(double[][] rawDistanceMatrix) Constructs a new mapping of pair-wise distances between points.- Parameters:
rawDistanceMatrix
- the distance matrix
-
-
Method Details
-
initialize
protected void initialize(double[][] rawDistanceMatrix) Initializes the internal data structures.- Parameters:
rawDistanceMatrix
- the distance matrix
-
findMostCrowdedPoint
public int findMostCrowdedPoint()Returns the most crowded point according to SPEA2's truncation strategy. The most crowded point is the point with the smallest distance to its nearest neighbor. Ties are broken by looking at the next nearest neighbor repeatedly until a difference is found.- Returns:
- the index of the most crowded point
-
removePoint
public void removePoint(int index) Removes the point with the given index.- Parameters:
index
- the index to remove
-