Class PermutationInAHaystack

  • All Implemented Interfaces:
    IntegerCostOptimizationProblem<Permutation>, Problem<Permutation>

    public final class PermutationInAHaystack
    extends Object
    implements IntegerCostOptimizationProblem<Permutation>

    The Permutation in a Haystack is a family of optimization problems that can be parameterized to the various types of permutation problem (e.g., absolute versus relative positioning). The Permutation in a Haystack problem uses permutation distance metrics to specify search landscape topology, providing an easy means of studying the behavior of search operators on a wide variety of permutation landscapes.

    The Permutation in a Haystack Problem, Haystack(δ, n), is defined as follows. Find the permutation p such that, p = argminp' δ(p', pn), where pn = [0, 1, ..., (n-1)]. The pn is called the target permutation, and is just the permutation of the first n non-negative integers in increasing order. The pn is our figurative needle for which we are searching our haystack. It is also the optimal solution to the problem, so in this way the search problem has a known optimal. The δ is a measure of the distance for permutations. There are many measures of permutation distance available in the literature. Some focus on exact positions of elements in the permutation, others focus on relative ordering of permutation elements, others focus on element precedences, etc. In this way, the choice of δ enables you to control the search space topology. The org.cicirello.permutations.distance package includes implementations of many permutation distance measures. The class includes a constructor that uses the target permutation as defined above, as well as an additional constructor that enables you to specify a different target.

    The Permutation in a Haystack Problem was introduced in the following paper:
    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 Detail

      • PermutationInAHaystack

        public PermutationInAHaystack​(PermutationDistanceMeasurer distance,
                                      int n)
        Constructs an instance of the Permutation in a Haystack problem, for a given distance measure. The target permutation, the figurative needle for which we are searching the haystack, is set to the following permutation: [0, 1, ..., (n-1)]. That is, the known optimal solution to the problem is just the permutation of the first n integers in increasing order.
        Parameters:
        distance - A permutation distance measure,
        n - The length of the target permutation.
      • PermutationInAHaystack

        public PermutationInAHaystack​(PermutationDistanceMeasurer distance,
                                      Permutation target)
        Constructs an instance of the Permutation in a Haystack problem, for a given distance measure, and given target permutation.
        Parameters:
        distance - A permutation distance measure,
        target - The target permutation, such that the problem is to find the permutation with minimum distance to the target. That is, target is our figurative needle for which we are searching the haystack. It is the known optimal solution to the problem.
    • Method Detail

      • cost

        public int cost​(Permutation candidate)
        Description copied from interface: IntegerCostOptimizationProblem
        Computes the cost of a candidate solution to the problem instance. The lower the cost, the more optimal the candidate solution.
        Specified by:
        cost in interface IntegerCostOptimizationProblem<Permutation>
        Parameters:
        candidate - The candidate solution to evaluate.
        Returns:
        The cost of the candidate solution. Lower cost means better solution.
      • minCost

        public int minCost()
        Description copied from interface: IntegerCostOptimizationProblem
        A lower bound on the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution. The default implementation returns Integer.MIN_VALUE.
        Specified by:
        minCost in interface IntegerCostOptimizationProblem<Permutation>
        Returns:
        A lower bound on the minimum theoretical cost of the problem instance.
      • isMinCost

        public boolean isMinCost​(int cost)
        Description copied from interface: IntegerCostOptimizationProblem
        Checks if a given cost value is equal to the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution.
        Specified by:
        isMinCost in interface IntegerCostOptimizationProblem<Permutation>
        Parameters:
        cost - The cost to check.
        Returns:
        true if cost is equal to the minimum theoretical cost,