Simulated Annealing, explained.
Simulated annealing is a stochastic optimisation approach that can accept worse proposals according to a temperature-dependent rule, seeking to avoid premature trapping in local optima.
Why it happens
Positions zero to twenty have energy min((x−4)²+4,(x−16)²). Start at local minimum four. Propose neighbouring moves; downhill moves are accepted and uphill moves with probability exp(−ΔE/T). Optional cooling multiplies temperature by 0.95 after each proposal. Track current and best positions.
Simulated annealing is a stochastic optimisation approach that can accept worse proposals according to a temperature-dependent rule, seeking to avoid premature trapping in local optima.
Read the result
Read the energy change and acceptance decision separately. Uphill acceptance is a probabilistic search rule, not evidence that a worse outcome was secretly better.
A worked example
A valley that traps greedy search
Start at position four with temperature zero and propose a right step; the uphill energy change is rejected.
Raise temperature and keep proposing neighbours, observing that some uphill moves can be accepted while best-found energy is preserved separately.
Compare the path with the visible global minimum at sixteen, and try optional cooling without expecting every finite run to reach it.
OPTIONAL DEEPER DETAILGo deeper: inside the model
Inside this model
Positions zero to twenty have energy min((x−4)²+4,(x−16)²). Start at local minimum four. Propose neighbouring moves; downhill moves are accepted and uphill moves with probability exp(−ΔE/T). Optional cooling multiplies temperature by 0.95 after each proposal. Track current and best positions.
Where this idea is useful
A practical use
A search that only accepts immediate improvement can miss a better solution separated by temporarily worse choices.
A common misconception
“Accepting worse moves guarantees finding the global optimum.”
Finite stochastic searches can still fail, and cooling or proposal rules matter. The board demonstrates escape opportunities rather than a convergence guarantee.
What this explanation leaves out
- Manual proposals, finite steps and this cooling schedule do not guarantee convergence to the global optimum. The landscape is authored and visible, and this does not imply that arbitrary real-world setbacks are beneficial.
Why track the best position separately from the current one?
The current state can be deliberately worse during exploration. Remembering the best state preserves the strongest candidate found without pretending every accepted move is an improvement.
Where might immediate-improvement-only search prevent you from considering an alternative with a temporary setup cost?
Associated thinkers
Associations marked provisional are awaiting source review.
Further reading
Explore the original research or the teaching reference behind this experiment.