public final class CyclicReversalIndependentDistanceDouble extends Object implements PermutationDistanceMeasurerDouble
This class implements the combination of cyclic independence and reversal independence. This is relevant if any rotation of the permutation or its reverse has the same problem dependent interpretation. For example, if the permutation represents a solution to a traveling salesperson problem (i.e. a tour of a set of cities), then the cost of that tour is the same if you rotate it, reverse it, or reverse it and rotate it.
In this case, this class computes the minimum of the distance from permutation p1 to rotations of p2 and rotations of the reverse of p2, where the underlying distance measure is passed as a parameter to the constructor.
| Constructor and Description |
|---|
CyclicReversalIndependentDistanceDouble(PermutationDistanceMeasurerDouble d)
Constructs a distance measure for measuring distance with cyclic and reversal independence, such that
distance = min_{i in [0,N)} { distance(p1,rotate(p2,i)), distance(p1,rotate(reverse(p2),i)) }
|
| Modifier and Type | Method and Description |
|---|---|
double |
distancef(Permutation p1,
Permutation p2)
Measures the distance between two permutations, with cyclic and reversal independence:
distance = min_{i in [0,N)} { distance(p1,rotate(p2,i)), distance(p1,rotate(reverse(p2),i)) }
|
public CyclicReversalIndependentDistanceDouble(PermutationDistanceMeasurerDouble d)
d - A distance measure.public double distancef(Permutation p1, Permutation p2)
distancef in interface PermutationDistanceMeasurerDoublep1 - first permutationp2 - second permutationCopyright © 2005-2020 Vincent A. Cicirello. All rights reserved.