Class InterchangeDistance

    • Constructor Detail

      • InterchangeDistance

        public InterchangeDistance()
        Constructs the distance measurer as specified in the class documentation.
    • Method Detail

      • distance

        public int distance​(Permutation p1,
                            Permutation p2)
        Measures the distance between two permutations.
        Parameters:
        p1 - first permutation
        p2 - second permutation
        Returns:
        distance between p1 and p2
        Throws:
        IllegalArgumentException - if p1.length() is not equal to p2.length().
      • max

        public int max​(int length)
        Description copied from interface: NormalizedPermutationDistanceMeasurer
        Computes the maximum possible distance between permutations of a specified length.
        Parameters:
        length - Permutation length.
        Returns:
        the maximum distance between a pair of permutations of the specified length.