Module org.cicirello.jpt
Class CyclicIndependentDistance
- java.lang.Object
-
- org.cicirello.permutations.distance.CyclicIndependentDistance
-
- All Implemented Interfaces:
PermutationDistanceMeasurer,PermutationDistanceMeasurerDouble
public final class CyclicIndependentDistance extends Object implements PermutationDistanceMeasurer
This class implements the concept of a cyclic independent distance measure. This is relevant if any rotation of the permutation has the same problem dependent interpretation.
In this case, this class computes the minimum of the distance from permutation p1 to rotations of p2, where the underlying distance measure is passed as a parameter to the constructor.
-
-
Constructor Summary
Constructors Constructor Description CyclicIndependentDistance(PermutationDistanceMeasurer d)Constructs a distance measure for measuring distance with cyclic independence, such that distance = min_{i in [0,N)} distance(p1,rotate(p2,i))
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdistance(Permutation p1, Permutation p2)Measures the distance between two permutations, with cyclic independence: distance = min_{i in [0,N)} distance(p1,rotate(p2,i))-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cicirello.permutations.distance.PermutationDistanceMeasurer
distancef
-
-
-
-
Constructor Detail
-
CyclicIndependentDistance
public CyclicIndependentDistance(PermutationDistanceMeasurer d)
Constructs a distance measure for measuring distance with cyclic independence, such that distance = min_{i in [0,N)} distance(p1,rotate(p2,i))- Parameters:
d- A distance measure.
-
-
Method Detail
-
distance
public int distance(Permutation p1, Permutation p2)
Measures the distance between two permutations, with cyclic independence: distance = min_{i in [0,N)} distance(p1,rotate(p2,i))- Specified by:
distancein interfacePermutationDistanceMeasurer- Parameters:
p1- first permutationp2- second permutation- Returns:
- distance between p1 and p2
- Throws:
IllegalArgumentException- if p1.length() is not equal to p2.length().
-
-