Class CachedDistanceMeasure<T>
java.lang.Object
org.moeaframework.util.clustering.CachedDistanceMeasure<T>
- Type Parameters:
T- the type of object being stored
- All Implemented Interfaces:
DistanceMeasure<T>
Wraps a
DistanceMeasure to cache or memoize the calculations in memory. This is similar to using a
precomputed distance matrix, except the distance calculations are performed lazily.-
Constructor Summary
ConstructorsConstructorDescriptionCachedDistanceMeasure(DistanceMeasure<T> distanceMeasure, boolean isSymmetric) Wraps the provided distance measure with a cached version. -
Method Summary
-
Constructor Details
-
CachedDistanceMeasure
Wraps the provided distance measure with a cached version.- Parameters:
distanceMeasure- the uncached distance measureisSymmetric-trueif the distance measure is symmetric; seeCachedDistanceMeasurefor the definition of symmetry.
-
-
Method Details
-
compute
Description copied from interface:DistanceMeasureReturns the distance between the two objects.- Specified by:
computein interfaceDistanceMeasure<T>- Parameters:
first- the first objectsecond- the second object- Returns:
- the distance
-