Class PermutationInAHaystack
 All Implemented Interfaces:
IntegerCostOptimizationProblem<Permutation>
,Problem<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 = argmin_{p'} δ(p', p_{n}),
where p_{n} = [0, 1, ..., (n1)]. The p_{n} is called the target permutation,
and is just the permutation of the first n nonnegative integers in increasing order.
The p_{n} 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):434446, June 2016.

Constructor Summary
ConstructorDescriptionPermutationInAHaystack
(PermutationDistanceMeasurer distance, int n) Constructs an instance of the Permutation in a Haystack problem, for a given distance measure.PermutationInAHaystack
(PermutationDistanceMeasurer distance, Permutation target) Constructs an instance of the Permutation in a Haystack problem, for a given distance measure, and given target permutation. 
Method Summary
Modifier and TypeMethodDescriptionint
cost
(Permutation candidate) Computes the cost of a candidate solution to the problem instance.boolean
isMinCost
(int cost) 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.int
minCost()
A lower bound on the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution.int
value
(Permutation candidate) Computes the value of the candidate solution within the usual constraints and interpretation of the problem.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cicirello.search.problems.IntegerCostOptimizationProblem
costAsDouble, getSolutionCostPair

Constructor Details

PermutationInAHaystack
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, ..., (n1)]. 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
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 Details

cost
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 interfaceIntegerCostOptimizationProblem<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 interfaceIntegerCostOptimizationProblem<Permutation>
 Returns:
 A lower bound on the minimum theoretical cost of the problem instance.

value
Description copied from interface:IntegerCostOptimizationProblem
Computes the value of the candidate solution within the usual constraints and interpretation of the problem. Specified by:
value
in interfaceIntegerCostOptimizationProblem<Permutation>
 Parameters:
candidate
 The candidate solution to evaluate. Returns:
 The actual optimization value of the candidate solution.

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 interfaceIntegerCostOptimizationProblem<Permutation>
 Parameters:
cost
 The cost to check. Returns:
 true if cost is equal to the minimum theoretical cost,
