# SimulatedAnnealing

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/SimulatedAnnealing

```python
class boulderopal.closed_loop.SimulatedAnnealing(bounds, temperatures, temperature_cost, seed=None)
```

The simulated annealing optimizer.

### Parameters
* **bounds** ([*Bounds*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/Bounds.md#boulderopal.closed_loop.Bounds)) – The bounds on the test points.
* **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* *or* *None* *,* *optional*) – Seed for the random number generator used in the optimizer.
  If set, must be a non-negative integer.
  Use this option to generate deterministic results from the optimizer.

## Notes

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](https://en.wikipedia.org/wiki/Simulated_annealing) on Wikipedia.
