← Wiki Index / Computation & Algorithms / Simulated Annealing
💻 Computation & Algorithms

Simulated Annealing

Simulated annealing is a stochastic global optimization metaheuristic inspired by metallurgical annealing that escapes local minima on rugged objective landscapes by accepting uphill energy transitions according to the temperature-scheduled Metropolis Boltzmann criterion.

Simulated annealing (SA) is a probabilistic global optimization metaheuristic in computation and algorithms designed to locate the global minimum of a cost or energy function E(x) over a large, rugged discrete or continuous search space Ω Containing numerous local minima. Introduced independently by Scott Kirkpatrick, C. Daniel Gelatt Jr., and Mario P. Vecchi at IBM Thomas J. Watson Research Center in Science in May 1983, and by Slovak physicist Vlado Černý in 1985, the algorithm adapts the statistical-mechanics Metropolis–Hastings algorithm by replacing its fixed temperature parameter with a monotonically decreasing cooling schedule T0 ≥ T1 ≥ T2 ≥ ··· → 0.

Whereas a deterministic greedy algorithm or steepest-descent local search accepts only cost-reducing transitions (ΔE ≤ 0) and becomes permanently trapped in the first local minimum basin it encounters, simulated annealing accepts cost-increasing uphill moves (ΔE > 0) with Boltzmann probability exp(−ΔE / Tk). At high initial temperatures Tk ≫ ΔE, the walker traverses energy barriers freely across the entire state space; as Tk is gradually lowered, uphill transitions become progressively rarer until the trajectory settles into deep, low-energy basins of attraction.

Statistical Mechanics Analogy: Physical Annealing vs. Rapid Quenching

The name and mathematical structure of the algorithm derive from the physical metallurgy of annealing. To grow a defect-free single crystal with minimum lattice potential energy, a solid is first heated above its recrystallization temperature so that atoms undergo random thermal motion across all configurational microstates. At thermal equilibrium at thermodynamic temperature T, the probability that the system occupies microstate x with energy E(x) is governed by the canonical Boltzmann distribution:

πT(x) = (1 / Z(T)) · exp(−E(x) / (kBT)), where Z(T) = ∑y∈Ω exp(−E(y) / (kBT))

As temperature approaches zero (T → 0+), the Boltzmann distribution πT(x) concentrates its probability mass uniformly onto the set of global minimum-energy ground states Ωmin = { x* ∈ Ω : E(x*) = Emin }, because for any suboptimal state x with E(x) > Emin, the Boltzmann ratio exp(−(E(x) − Emin) / (kBT)) decays to zero.

  • Rapid Quenching (Greedy Local Search, T → 0 Abruptly): If a molten metal is plunged directly into a cold bath, atoms lose thermal mobility before finding long-range crystalline order, freezing into an amorphous glass or polycrystalline solid riddled with high-energy grain-boundary defects—the physical analog of a local optimization algorithm trapped in a poor local minimum.
  • Controlled Annealing (Quasi-Equilibrium Cooling): If temperature is reduced slowly enough that the system re-establishes quasi-thermal equilibrium at each intermediate temperature stage, thermal fluctuations allow atoms to hop out of shallow metastable traps and lock into the global ground-state lattice.

The Metropolis Transition Kernel and Algorithm Structure

To optimize an arbitrary mathematical objective function E : Ω → R without physical dimensions, the Boltzmann constant kB is absorbed into the dimensionless control parameter computational temperature T > 0. Simulated annealing requires three design components:

  1. State Space (Ω) and Objective Function (E(x)): A representation of candidate solutions x ∈ Ω and a scalar cost E(x) to be minimized.
  2. Neighborhood Generator (q(x′ | x)): A stochastic perturbation rule that proposes a neighboring state x′ ∈ N(x) from the current state x (such as swapping two cities in a tour, flipping a spin in an Ising lattice, or perturbing a torsion angle in a molecule).
  3. Cooling Schedule (Tk): A sequence of temperatures specifying the initial temperature T0, the temperature decay law Tk, the number of Monte Carlo method steps Lk executed at each temperature plateau, and a stopping criterion.

Step-by-Step Transition Rule

At iteration k with current state xk = x and temperature Tk:

  1. Sample a candidate neighbor x′ ~ q(· | x) and evaluate the energy difference ΔE = E(x′) − E(x).
  2. Compute the Metropolis acceptance probability:

Paccept(x → x′; Tk) = 1 if ΔE ≤ 0 Paccept(x → x′; Tk) = exp(−ΔE / Tk) if ΔE > 0

  1. If ΔE ≤ 0, accept the downhill move unconditionally (xk+1 ← x′). If ΔE > 0, draw a uniform random number u ~ Uniform(0, 1); if u < exp(−ΔE / Tk), accept the uphill move (xk+1 ← x′); otherwise reject the move and retain xk+1 ← x.

At any fixed temperature Tk = T with a symmetric proposal distribution q(x′ | x) = q(x | x′), this transition kernel defines a homogeneous Markov chain satisfying detailed balance πT(x)P(x → x′) = πT(x′)P(x′ → x) with stationary distribution πT(x) ∝ exp(−E(x) / T). When Tk changes with k, the process becomes an inhomogeneous Markov chain.

Cooling Schedules and Hajek's Convergence Theorem

Hajek's Necessary and Sufficient Condition (1988)

A central theoretical milestone in computational complexity theory and stochastic optimization is Bruce Hajek's 1988 theorem, which established the cooling rate required for simulated annealing to converge to the global optimum with probability 1 on any finite state space Ω.

For any local minimum m ∉ Ωmin that is not a global minimum, define its basin depth d(m) as the smallest maximum energy elevation ΔE along any path of transitions connecting m to a state of lower energy E(y) < E(m). Let d* = maxm∉Ωmin d(m) denote the depth of the deepest non-global local minimum basin in Ω. Hajek proved that under a logarithmic cooling schedule:

T(k) = c / ln(1 + k)

the inhomogeneous Markov chain satisfies limk→∞ Pr(xk ∈ Ωmin) = 1 if and only if c ≥ d* (equivalently, ∑k=1∞ exp(−d* / T(k)) = ∞). Intuitively, the harmonic divergence of ∑ (1 + k)−d*/c for c ≥ d* ensures that the walker retains enough cumulative probability across infinite time to climb over the tallest local barrier d* infinitely often until it enters the global minimum basin.

Comparison of Theoretical and Practical Cooling Schedules

Because logarithmic cooling T(k) = c / ln(1 + k) decreases too slowly for finite computational budgets, practical engineering implementations employ faster finite-time schedules:

Cooling ScheduleTemperature Update FormulaAsymptotic Theory vs. Finite-Time BehaviorTypical Parameter Regime
Logarithmic (Geman–Geman / Hajek)Tk = c / ln(1 + k)Provably globally convergent for c ≥ d*, but requires O(exp(d*/T)) stepsTheoretical benchmark; MCMC image restoration
Geometric (Kirkpatrick et al.)Tk+1 = α · Tk (after L steps per plateau)Fast finite-time heuristic; approximates equilibrium when α → 1−α ∈ [0.85, 0.999], L ∝ |N(x)| neighborhood size
Fast / Cauchy Annealing (Szu–Hartley)Tk = T0 / (1 + k) with Cauchy proposal jumpsHeavy-tailed Cauchy jumps allow long-range tunneling across barriersContinuous multi-modal parameter spaces
Adaptive / Specific-Heat (Lam–Delosme)Adjusts ΔT inversely with energy variance σE2(T)Slows cooling automatically during phase transitions where specific heat Cv = σE2 / T2 peaksVLSI layout, spin glasses, protein folding
Simulated Annealing with Reheating / Parallel TemperingPeriodic resets of T or replica swaps between M parallel chains at T1 < ··· < TMPreserves canonical equilibrium across all temperatures simultaneouslyBiomolecular molecular dynamics & phylogenetic inference

Applications in Combinatorial Design and Structural Biology

Traveling Salesperson Problem (TSP) and VLSI Electronic Design Automation

In Kirkpatrick, Gelatt, and Vecchi's 1983 paper, simulated annealing was applied to two NP-hard combinatorial problems:

  1. Traveling Salesperson Problem (TSP): Given N cities with pairwise distances d(i, j), a state x is a permutation tour of {1, ..., N} with length E(x) = ∑ d(xi, xi+1). Using Croes's 2-opt move (reversing a contiguous tour segment between two indices a < b, which changes only 2 edges in O(1) time), simulated annealing escapes crossed-edge local minima and consistently finds tours within 0.5% to 1.5% of the Held–Karp lower bound on instances with tens of thousands of cities.
  2. VLSI Chip Placement and Wire Routing: When placing thousands of logic macrocells on a silicon wafer (such as the IBM 3081 processor designed by Kirkpatrick's team and Carl Sechen's TimberWolf placement suite), the energy function E(x) combines total Manhattan wirelength with cell-overlap penalties and routing-channel congestion. Simulated annealing reduced wire congestion by 15–30% over human layout engineers and became a standard industrial engine in electronic design automation (EDA).

Crystallographic Refinement and Biomolecular Conformational Search

In structural biology and computational chemistry, Axel T. Brünger introduced simulated annealing refinement (implemented in X-PLOR and CNS) for X-ray crystallography and nuclear magnetic resonance (NMR) spectroscopy in 1987. By coupling a physical force field Echem with an experimental diffraction residual wX-rayEX-ray and heating a protein atomic model to T = 3,000–4,000 K in molecular dynamics before slow cooling to 300 K, simulated annealing flips misoriented peptide side chains across 10–30 kJ/mol steric barriers without manual human rebuilding. Similarly, small-molecule molecular docking packages (such as AutoDock) and de novo protein design suites (Rosetta fragment assembly) use simulated annealing over backbone torsion angles (φ, ψ, χ) to sample low-free-energy binding poses and tertiary folds.

Frequently Asked Questions

How should the initial temperature T0 be chosen in simulated annealing?

A standard empirical calibration runs a short preliminary random walk of 100 to 500 trial moves, computes the average positive uphill energy change ⟨ΔE+⟩, and sets T0 = −⟨ΔE+⟩ / ln(p0) so that the initial uphill acceptance rate p0 = exp(−⟨ΔE+⟩ / T0) is approximately 80% to 90% (p0 ≈ 0.85), ensuring the chain is initially melted and unrestrained by local barriers.

Why should cooling slow down when the energy variance (specific heat) is large?

In statistical physics, the dimensionless specific heat at temperature T is proportional to the energy variance of the chain: C(T) = VarT(E) / T2. A sharp spike in C(T) signals a configurational phase transition where the system is freezing into its macroscopic structural arrangement (such as global tour topology in TSP or secondary/tertiary core packing in a protein); cooling too rapidly through this critical temperature window locks in large-scale topological defects that lower temperatures cannot undo.

References

  1. Kirkpatrick, S., Gelatt, C. D., Jr., & Vecchi, M. P. (1983). Optimization by simulated annealing. Science, 220(4598), 671–680. https://doi.org/10.1126/science.220.4598.671
  2. Černý, V. (1985). Thermodynamical approach to the traveling salesman problem: An efficient simulation algorithm. Journal of Optimization Theory and Applications, 45(1), 41–51. https://doi.org/10.1007/BF00940812
  3. Hajek, B. (1988). Cooling schedules for optimal annealing. Mathematics of Operations Research, 13(2), 311–329. https://doi.org/10.1287/moor.13.2.311
  4. Brünger, A. T., Kuriyan, J., & Karplus, M. (1987). Crystallographic R factor refinement by molecular dynamics. Science, 235(4787), 458–460. https://doi.org/10.1126/science.235.4787.458
🧬 Support Open Science
Explore interactive science games on LowKey Games or browse scientific apparel & accessories in the CRV Science Shop.
💡 Spot an inaccuracy or have primary literature to expand this article?
Submit a citation or revision note using your shared CRV Science / LowKey Games profile ID.
Suggest Revision