public final class CyclicRTypeDistance extends Object
Cyclic RType distance treats the permutations as if they represent sets of directed edges, and counts the number of edges that differ. It treats the last to the first element as an edge.
Consider the example permutation: [1, 5, 2, 4, 0, 3]. Cyclic RType distance treats this as equivalent to the set of directed edges: {(1,5), (5,2), (2,4), (4,0), (0,3), (3,1)}.
E.g., distance between [1, 5, 2, 4, 0, 3] and [ 5, 1, 4, 0, 3, 2] is 4. Why? Well, the first permutation has the directed edges: {(1,5), (5,2), (2,4), (4,0), (0,3), (3,1)}. The second has 2 of these (4,0), and (0,3), but does not include 4 of the edges: (1,5), (5,2), (2,4), (3,1)
Runtime: O(n), where n is the permutation length.
Cyclic RType distance was introduced in:
V.A. Cicirello, "The Permutation in a Haystack Problem
and the Calculus of Search Landscapes,"
IEEE Transactions on Evolutionary Computation, 20(3):434-446, June 2016.
| Constructor and Description |
|---|
CyclicRTypeDistance()
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 CyclicRTypeDistance()
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.