net.sourceforge.cilib.util
Class ChebyshevDistanceMeasure

java.lang.Object
  extended by net.sourceforge.cilib.util.MinkowskiMetric
      extended by net.sourceforge.cilib.util.ChebyshevDistanceMeasure
All Implemented Interfaces:
DistanceMeasure

public class ChebyshevDistanceMeasure
extends MinkowskiMetric

Chebyshev Distance is a special case of the Minkowski Metric with 'alpha' := infinity. It calculates the distance between to vectors as the largest coordinate difference between both vectors.

Author:
Olusegun Olorunda

Field Summary
 
Fields inherited from class net.sourceforge.cilib.util.MinkowskiMetric
alpha
 
Constructor Summary
ChebyshevDistanceMeasure()
          Create an instance of the ChebyshevDistanceMeasure.
 
Method Summary
<T extends Collection<? extends Number>>
double
distance(T x, T y)
          Calculate the distance between two vectors represented by Java Collection objects.
<T extends Type,U extends StructuredType<T>>
double
distance(U x, U y)
          Calculate the distance between two vectors.
 void setAlpha(int a)
          Set the 'alpha' value that will be used in the calculation of the Minkowski Metric.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChebyshevDistanceMeasure

public ChebyshevDistanceMeasure()
Create an instance of the ChebyshevDistanceMeasure.

Method Detail

distance

public <T extends Type,U extends StructuredType<T>> double distance(U x,
                                                                    U y)
Calculate the distance between two vectors.

Specified by:
distance in interface DistanceMeasure
Overrides:
distance in class MinkowskiMetric
Parameters:
x - the one vector.
y - the other vector.
Returns:
the distance (as a double) between the two vectors.

distance

public <T extends Collection<? extends Number>> double distance(T x,
                                                                T y)
Calculate the distance between two vectors represented by Java Collection objects.

Specified by:
distance in interface DistanceMeasure
Overrides:
distance in class MinkowskiMetric
Type Parameters:
T - The Collection type.
Parameters:
x - the one Java Collection object.
y - the other Java Collection object.
Returns:
the distance (as a double) between the two vectors.

setAlpha

public void setAlpha(int a)
Set the 'alpha' value that will be used in the calculation of the Minkowski Metric.

Overrides:
setAlpha in class MinkowskiMetric
Parameters:
a - the new 'alpha' value


Copyright © 2009 CIRG. All Rights Reserved.