Class Mix

  • All Implemented Interfaces:
    OptimizationProblem<BitVector>, Problem<BitVector>

    public final class Mix
    extends Object
    implements OptimizationProblem<BitVector>

    This class implements Ackley's Mix problem, an artificial landscape that is a mix of the OneMax, TwoMax, Trap, and Plateau problems, which provides for a landscape that combines all of the properties of these benchmarking problems. For details of the 5 component search landscapes, see the 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 
      Constructor Description
      Mix()
      Constructs an instance of Ackley's Mix problem.
    • Constructor Detail

      • Mix

        public Mix()
        Constructs an instance of Ackley's Mix problem.
    • Method Detail

      • cost

        public double cost​(BitVector candidate)
        Description copied from interface: OptimizationProblem
        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 OptimizationProblem<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: OptimizationProblem
        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 Double.NEGATIVE_INFINITY.
        Specified by:
        minCost in interface OptimizationProblem<BitVector>
        Returns:
        A lower bound on the minimum theoretical cost of the problem instance.
      • value

        public double value​(BitVector candidate)
        Description copied from interface: OptimizationProblem
        Computes the value of the candidate solution within the usual constraints and interpretation of the problem.
        Specified by:
        value in interface OptimizationProblem<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: OptimizationProblem
        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 OptimizationProblem<BitVector>
        Parameters:
        cost - The cost to check.
        Returns:
        true if cost is equal to the minimum theoretical cost,