Simulated Annealing
A class that implements the simulated annealing optimization algorithm for solving stochastic or deterministic problems. Simulated annealing is an iterative optimization method inspired by the physical process of annealing in metallurgy. It uses a probabilistic approach to escape local optima by accepting worse solutions with a certain probability, which decreases over time according to a cooling schedule.
Parameters
the problem being solved
The evaluator responsible for calculating the objective function value of a solution. It must implement the EvaluatorIfc interface.
The starting temperature for the simulated annealing algorithm. Must be greater than 0.0.
the cooling schedule for the annealing process
the temperature used to stop the annealing process. If the current temperature goes below this temperature, the search process stops.
the maximum number of iterations permitted for the search process
An instance of ReplicationPerEvaluationIfc defining the strategy for determining the number of replications per evaluation.
An optional random number stream used for stochastic behavior. Defaults to KSLRandom.defaultRNStream().
An optional name for this solver instance.
Constructors
Constructs a SimulatedAnnealing solver with the specified parameters.
Secondary constructor for the SimulatedAnnealing class. This constructor provides a simplified way to initialize the Simulated Annealing algorithm with configurable parameters, while delegating certain default parameters to their respective values or functional objects.
Properties
Represents the difference in cost between the current solution and a potential new solution in the simulated annealing process. This value directly influences the acceptance probability of new solutions as the algorithm progresses.
Represents the current temperature in the simulated annealing process. It is initialized to the value of initialTemperature and dynamically updated during each iteration of the algorithm based on the cooling schedule.
Changing the initial temperature will also change it for the associated cooling schedule.
Tracks the last computed acceptance probability in the simulated annealing process.
Used to check if the last set of solutions that were captured are the same.
Represents the temperature threshold at which the simulated annealing algorithm will stop iterating. The stopping temperature serves as a termination criterion, ensuring the optimization process concludes when the system has sufficiently cooled. The target temperature below which the optimization process should stop. Must be greater than 0.0.
Functions
Calculates the probability of accepting a new solution in the simulated annealing algorithm. The probability is determined based on the difference in cost between the current and new solutions, as well as the current temperature of the system.
Subclasses may implement this function to prepare the solver before running the first iteration. Generally, it is sufficient to just implement the startingPoint() function.
Subclasses should implement this function to determine if the solver should continue running iterations. This will likely include some implementation of stopping criteria. This function should implement stopping criteria based on the quality of the solution. The number of iterations, compared to the maximum number of iterations, is automatically checked after each step in the iterative process. Unless overridden, this function returns false by default, which indicates that the solution quality criteria have not been satisfied. This will cause the solver to iterate through all iterations of the solution process up to the maximum number of iterations. Alternatively, the user can specify an instance of the SolutionQualityEvaluatorIfc interface to determine if the solution quality has been reached.
This function should contain the logic that iteratively executes until the maximum number of iterations is reached or until the stopping criteria is met. The base implementation calls nextPoint() to determine the next point to evaluate, requests an evaluation of the point, and then updates the current solution if the resulting solution is better than the current solution. Generally, implementing startingPoint() and nextPoint() should be adequate. The property iterationCounter represents the current iteration within the mainIteration() function. That is, the value of iterationCounter is incremented prior to the execution of the mainIteration() function.