- All Implemented Interfaces:
OptimizationProblem<BitVector>,Problem<BitVector>
OneMaxAckley, TwoMax, Trap, Porcupine, and Plateaus
classes.
The Mix problem is defined as the following maximization problem. Maximize the fitness function, f(x), of bit string x, such that we do the following. Break x into 5 equal-sized segments, and sum the fitnesses of the 5 segments, where the first segment is scores as a OneMax instance, the second segment is scored as a TwoMax instance, the third segment is scored as a Trap instance, the fourth segment is scores as a Porcupine instance, and the fifth is scored as one segment of a Plateau instance. Note that the fifth segment is not scored directly as a full Plateau instance, but rather if all of the bits of that segment are 1s, then it scores as 10*p, where p is the length of that segment, and otherwise it scores as 0. The optimum occurs when the entire bit string is all 1s, which has a maximum fitness of 10*n.
The value method implements the original maximization version of the Mix
problem, as described above. The algorithms of the Chips-n-Salsa library are defined for
minimization, requiring a cost function. The cost method implements the equivalent
as the following minimization problem: minimize cost(x) = 10*n - f(x), where f(x) is the Mix
function as defined above. The global optima is all 1-bits, which has a cost equal to 0.
The Mix problem was introduced by David Ackley in the following paper:
David H. Ackley. An empirical study of bit vector function optimization. Genetic Algorithms and
Simulated Annealing, pages 170-204, 1987.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleComputes the cost of a candidate solution to the problem instance.booleanisMinCost(double 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.doubleminCost()A lower bound on the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution.doubleComputes 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, waitMethods inherited from interface org.cicirello.search.problems.OptimizationProblem
costAsDouble, getSolutionCostPair
-
Constructor Details
-
Mix
public Mix()Constructs an instance of Ackley's Mix problem.
-
-
Method Details
-
cost
Description copied from interface:OptimizationProblemComputes the cost of a candidate solution to the problem instance. The lower the cost, the more optimal the candidate solution.- Specified by:
costin interfaceOptimizationProblem<BitVector>- Parameters:
candidate- The candidate solution to evaluate.- Returns:
- The cost of the candidate solution. Lower cost means better solution.
-
minCost
public double minCost()Description copied from interface:OptimizationProblemA 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 Double.NEGATIVE_INFINITY.- Specified by:
minCostin interfaceOptimizationProblem<BitVector>- Returns:
- A lower bound on the minimum theoretical cost of the problem instance.
-
value
Description copied from interface:OptimizationProblemComputes the value of the candidate solution within the usual constraints and interpretation of the problem.- Specified by:
valuein interfaceOptimizationProblem<BitVector>- Parameters:
candidate- The candidate solution to evaluate.- Returns:
- The actual optimization value of the candidate solution.
-
isMinCost
public boolean isMinCost(double cost) Description copied from interface:OptimizationProblemChecks 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:
isMinCostin interfaceOptimizationProblem<BitVector>- Parameters:
cost- The cost to check.- Returns:
- true if cost is equal to the minimum theoretical cost,
-