Skip to content

Commit 9e2723f

Browse files
committed
documentation update
1 parent 5988b42 commit 9e2723f

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

src/main/java/org/cicirello/experiments/cyclemutation/CycleDistance.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@
2323

2424
/**
2525
* <p>Cycle distance is the count of the number of non-singleton permutation cycles
26-
* between a pair of permutations.</p>
26+
* between a pair of permutations. Cycle distance is a semi-metric, satisfying all
27+
* of the metric properties except for the triangle inequality.</p>
28+
*
29+
* <p>It was introduced in the following article:</p>
30+
*
31+
* <p>Vincent A. Cicirello. 2022. Cycle Mutation: Evolving Permutations via Cycle Induction.
32+
* <i>Applied Sciences</i>, 12, 11, Article 5506 (May 2022).
33+
* <a href="https://doi.org/10.3390/app12115506">https://doi.org/10.3390/app12115506</a></p>
2734
*
2835
* <p>Runtime: O(n), where n is the permutation length.</p>
2936
*

src/main/java/org/cicirello/experiments/cyclemutation/CycleEditDistance.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@
2727
* is 0. If p1 and p2 have a single permutation cycle, then this distance is clearly 1
2828
* since the inverse of that cycle will produce n fixed points. Otherwise, this distance
2929
* is equal to 2 since it can be shown that at most 2 permutation cycle operations are
30-
* necessary to transform any permutation of length n into any other.</p>
30+
* necessary to transform any permutation of length n into any other. Cycle edit distance
31+
* satisfies all of the metric properties.</p>
32+
*
33+
* <p>Cycle edit distance was introduced in the following article:</p>
34+
*
35+
* <p>Vincent A. Cicirello. 2022. Cycle Mutation: Evolving Permutations via Cycle Induction.
36+
* <i>Applied Sciences</i>, 12, 11, Article 5506 (May 2022).
37+
* <a href="https://doi.org/10.3390/app12115506">https://doi.org/10.3390/app12115506</a></p>
3138
*
3239
* <p>Runtime: O(n), where n is the permutation length.</p>
3340
*

src/main/java/org/cicirello/experiments/cyclemutation/KCycleDistance.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@
2525
* <p>K-Cycle distance is the count of the number of non-singleton permutation cycles
2626
* of length at most K. Specifically, each non-singleton cycle contributes to the
2727
* total distance the number of cycles of length at most K necessary to transform
28-
* the cycle to all fixed points.</p>
28+
* the cycle to all fixed points. K-cycle distance is a metric provided that K &le; 4.
29+
* However, if K &gt; 4, it is only a semi-metric because it fails to satisfy the
30+
* triangle inequality when K &ge; 5.</p>
31+
*
32+
* <p>K-Cycle distance was introduced in the following article:</p>
33+
*
34+
* <p>Vincent A. Cicirello. 2022. Cycle Mutation: Evolving Permutations via Cycle Induction.
35+
* <i>Applied Sciences</i>, 12, 11, Article 5506 (May 2022).
36+
* <a href="https://doi.org/10.3390/app12115506">https://doi.org/10.3390/app12115506</a></p>
2937
*
3038
* <p>Runtime: O(n), where n is the permutation length.</p>
3139
*
@@ -86,14 +94,6 @@ public int distance(Permutation p1, Permutation p2) {
8694

8795
if (cycleLength > maxCycleLength) {
8896
cycleCount += (int)Math.ceil((cycleLength-1.0)/(maxCycleLength-1.0));
89-
/*
90-
cycleCount += (cycleLength - maxCycleLength) / (maxCycleLength - 1);
91-
if (((cycleLength - maxCycleLength) % (maxCycleLength - 1)) > 0) {
92-
cycleCount += 2;
93-
} else {
94-
cycleCount++;
95-
}
96-
*/
9797
} else {
9898
cycleCount++;
9999
}

0 commit comments

Comments
 (0)