public final class ExactMatchDistance extends Object
Exact Match distance is an extension of Hamming distance but to non-binary strings, in this case, permutations. It is the count of the number of positions for which the two permutations contain different elements.
Runtime: O(n), where n is the permutation length.
Exact match distance was introduced in:
S. Ronald, "More distance functions for order-based encodings," in Proc. IEEE CEC. IEEE Press, 1998, pp. 558–563.
| Constructor and Description |
|---|
ExactMatchDistance()
Constructs the distance measurer as specified in the class documentation.
|
| Modifier and Type | Method and Description |
|---|---|
int |
distance(Permutation p1,
Permutation p2)
Measures the distance between two permutations.
|
double |
distancef(Permutation p1,
Permutation p2)
Measures the distance between two permutations
|
int |
max(int length)
Computes the maximum possible distance between permutations
of a specified length.
|
double |
maxf(int length)
Computes the maximum possible distance between permutations
of a specified length.
|
double |
normalizedDistance(Permutation p1,
Permutation p2)
Measures the distance between two permutations, normalized to the interval [0.0, 1.0].
|
public ExactMatchDistance()
public int distance(Permutation p1, Permutation p2)
p1 - first permutationp2 - second permutationpublic int max(int length)
length - Permutation length.public final double distancef(Permutation p1, Permutation p2)
distancef in interface PermutationDistanceMeasurerDoublep1 - first permutationp2 - second permutationpublic final double maxf(int length)
maxf in interface NormalizedPermutationDistanceMeasurerDoublelength - Permutation length.public final double normalizedDistance(Permutation p1, Permutation p2)
Measures the distance between two permutations, normalized to the interval [0.0, 1.0].
normalizedDistance in interface NormalizedPermutationDistanceMeasurerDoublep1 - first permutationp2 - second permutationCopyright © 2005-2020 Vincent A. Cicirello. All rights reserved.