The Boulder Opal Toolkits are currently in beta phase of development. Breaking changes may be introduced.

class SimulatedAnnealing(temperatures, temperature_cost, seed=None)

The simulated annealing optimizer.

  • temperatures (np.ndarray) – The array of initial per-parameter annealing temperatures \(T_0\) used to generate new test points. Higher temperatures correspond to higher exploration. The per-parameter adjustments from the current test point are sampled from Cauchy distributions with scales given by temperatures. The temperatures are currently implemented to decay such that each temperature at the k-th step is set according to \(T_k=\frac{T_0}{1+k}\). All temperatures must be positive.

  • temperature_cost (float) – The parameter for controlling the optimizer’s greediness. A high cost temperature allows the optimizer to explore test points which may not immediately improve the cost. A higher level of exploration can be helpful for more difficult optimization problems. The cost temperature is set to decay according to the same schedule as the temperatures. Must be positive.

  • seed (int, optional) – Seed for the random number generator. Use this option to generate deterministic results from the optimizer.


This simulated annealing performs a temperature based random walk within the parameter bounds. The new test points are sampled from a distribution whose variance is given by the current temperatures. Higher temperatures translate to high levels of exploration, which can be useful for non-convex optimization. The temperature_cost parameter can be set independently of the temperatures, and controls the overall greediness of each update. A high temperature_cost allows the optimizer to accept updates which do not immediately improve the cost. Both temperatures and the temperature_cost automatically decay between iterations.

For more information on this method see simulated annealing on Wikipedia.