Class SimulatedAnnealing

    • Constructor Detail

      • SimulatedAnnealing

        public SimulatedAnnealing​(int epoch,
                                  double startProb,
                                  double endProb,
                                  SimulatedAnnealing.CoolingSchedule cooling,
                                  org.apache.commons.rng.UniformRandomProvider random)
        Parameters:
        epoch - Number of iterations performed at fixed temperature.
        startProb - Initial acceptance probablility.
        endProb - Final acceptance probablility.
        cooling - Computes the temperature as a function of the initial temperature and the epoch. It is called for computing a new temperature after each cycle of epoch iterations. Simulated annealing assumes that the function decreases monotically wrt the epoch (cf. provided implementation).
        random - Random number generator.
        Throws:
        IllegalArgumentException - if epoch < 1 or startProb or endProb is outside the [0, 1] interval.
    • Method Detail

      • getStartProbability

        public double getStartProbability()
        Returns:
        the acceptance probability at the beginning of the SA process.
      • getEndProbability

        public double getEndProbability()
        Returns:
        the acceptance probability at the end of the SA process.
      • metropolis

        public DoublePredicate metropolis​(double temperature)
        Factory for the Metropolis check for accepting a worse state. \( e^{-|\Delta E| / T} \geq \mathrm{rand}(0, 1) \).

        It is assumed that this check is performed after ensuring that the alternate state is worse than the current best state.

        Parameters:
        temperature - Current temperature.
        Returns:
        the acceptance test.