Module org.cicirello.jpt
Interface NormalizedPermutationDistanceMeasurer
- All Superinterfaces:
NormalizedPermutationDistanceMeasurerDouble,PermutationDistanceMeasurer,PermutationDistanceMeasurerDouble
- All Known Implementing Classes:
AcyclicEdgeDistance,BlockInterchangeDistance,CycleDistance,CycleEditDistance,CyclicEdgeDistance,CyclicRTypeDistance,DeviationDistance,ExactMatchDistance,InterchangeDistance,KCycleDistance,KendallTauDistance,LeeDistance,ReinsertionDistance,ReversalDistance,RTypeDistance,ScrambleDistance,SquaredDeviationDistance
public interface NormalizedPermutationDistanceMeasurer
extends NormalizedPermutationDistanceMeasurerDouble, PermutationDistanceMeasurer
Implement this interface to define a distance metric for permutations that supports normalizing
the distance to the interval [0,1], but where the base distance is an integer value.
-
Method Summary
Modifier and TypeMethodDescriptionintmax(int length) Computes the maximum possible distance between permutations of a specified length.default doublemaxf(int length) Computes the maximum possible distance between permutations of a specified length.default doublenormalizedDistance(Permutation p1, Permutation p2) Measures the distance between two permutations, normalized to the interval [0.0, 1.0].Methods inherited from interface org.cicirello.permutations.distance.PermutationDistanceMeasurer
distance, distancef
-
Method Details
-
max
int max(int length) Computes the maximum possible distance between permutations of a specified length.- Parameters:
length- Permutation length.- Returns:
- the maximum distance between a pair of permutations of the specified length.
-
maxf
default double maxf(int length) Description copied from interface:NormalizedPermutationDistanceMeasurerDoubleComputes the maximum possible distance between permutations of a specified length.- Specified by:
maxfin interfaceNormalizedPermutationDistanceMeasurerDouble- Parameters:
length- Permutation length.- Returns:
- the maximum distance between a pair of permutations of the specified length.
-
normalizedDistance
Measures the distance between two permutations, normalized to the interval [0.0, 1.0].- Specified by:
normalizedDistancein interfaceNormalizedPermutationDistanceMeasurerDouble- Parameters:
p1- first permutationp2- second permutation- Returns:
- distance between p1 and p2 normalized to the interval [0.0, 1.0]
- Throws:
IllegalArgumentException- if p1.length() is not equal to p2.length().
-