public final class DeviationDistanceNormalized extends Object implements PermutationDistanceMeasurerDouble, NormalizedPermutationDistanceMeasurerDouble
Normalized Deviation distance is the sum of the positional deviation of the permutation elements divided by N-1 (where N is the length of the permutation). The positional deviation of an element is the difference in its location in the two permutations. Normalizing by dividing by N-1 causes each element's contribution to distance to be in the interval [0,1].
For example, consider p1 = [0, 1, 2, 3, 4, 5] and p2 = [1, 0, 5, 2, 4, 3]. Element 0 is displaced by 1 position. Likewise for elements 1 and 2. Element 3 is displaced by 2 positions. Element 4 is in the same position in both. Element 5 is displaced by 3 positions.
Sum the deviations: 1 + 1 + 1 + 2 + 0 + 3 = 8.
The length is 6. So, normalized deviation distance is 8 / (6-1) = 1.6.
Runtime: O(n), where n is the permutation length.
Normalized deviation 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 |
|---|
DeviationDistanceNormalized()
Constructs the distance measurer as specified in the class documentation.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distancef(Permutation p1,
Permutation p2)
Measures the distance between two permutations
|
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 DeviationDistanceNormalized()
public double distancef(Permutation p1, Permutation p2)
distancef in interface PermutationDistanceMeasurerDoublep1 - first permutationp2 - second permutationpublic double maxf(int length)
maxf in interface NormalizedPermutationDistanceMeasurerDoublelength - Permutation length.public 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.