Class DistanceMeasure.ApacheDistanceMeasure<T extends org.apache.commons.math3.ml.clustering.Clusterable>

java.lang.Object
org.moeaframework.util.clustering.DistanceMeasure.ApacheDistanceMeasure<T>
Type Parameters:
T - the type, which must be Clusterable
All Implemented Interfaces:
Serializable, org.apache.commons.math3.ml.distance.DistanceMeasure, DistanceMeasure<T>
Enclosing interface:
DistanceMeasure<T>

public static class DistanceMeasure.ApacheDistanceMeasure<T extends org.apache.commons.math3.ml.clustering.Clusterable> extends Object implements DistanceMeasure<T>, org.apache.commons.math3.ml.distance.DistanceMeasure
Wraps one of the Apache Commons Math distance measures to be compatible with our generic distance measure. Computed distances are also cached / memoized.
See Also:
  • Constructor Details

    • ApacheDistanceMeasure

      public ApacheDistanceMeasure(org.apache.commons.math3.ml.distance.DistanceMeasure measure)
      Constructs a new distance measure implemented by Apache Commons Math.
      Parameters:
      measure - the underlying distance measure
  • Method Details

    • compute

      public double compute(double[] first, double[] second)
      Specified by:
      compute in interface org.apache.commons.math3.ml.distance.DistanceMeasure
    • compute

      public double compute(T first, T second)
      Description copied from interface: DistanceMeasure
      Returns the distance between the two objects.
      Specified by:
      compute in interface DistanceMeasure<T extends org.apache.commons.math3.ml.clustering.Clusterable>
      Parameters:
      first - the first object
      second - the second object
      Returns:
      the distance