Class SquaredDeviationDistance

java.lang.Object
org.cicirello.permutations.distance.SquaredDeviationDistance
All Implemented Interfaces:
NormalizedPermutationDistanceMeasurer, NormalizedPermutationDistanceMeasurerDouble, PermutationDistanceMeasurer, PermutationDistanceMeasurerDouble

public final class SquaredDeviationDistance extends Object implements NormalizedPermutationDistanceMeasurer
Squared Deviation distance is the sum of the squares of the positional deviations of the permutation elements. The positional deviation of an element is the difference in its location in the two permutations.

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 squared deviations: 1^2 + 1^2 + 1^2 + 2^2 + 0^2 + 3^2 = 1 + 1 + 1 + 4 + 9 = 16.

Runtime: O(n), where n is the permutation length.

Squared deviation distance is described in:
M. Sevaux and K. Sorensen, "Permutation distance measures for memetic algorithms with population management," The 6th Metaheuristics International Conference, August, 2005.

  • Constructor Details

    • SquaredDeviationDistance

      public SquaredDeviationDistance()
      Constructs the distance measurer as specified in the class documentation.
  • Method Details