Simulated Annealing Optimizer Screensaver
The Simulated Annealing Optimizer screensaver runs a real simulated-annealing algorithm live, improving a random tour by accepting occasional worse moves early and cooling into a refined solution. It is free, runs in your browser, and ESC exits.
How the Simulated Annealing Optimizer screensaver works
The saver starts with a real random tour through scattered points and a high starting "temperature" parameter.
At each step, a real random tour tweak is proposed; better tweaks are always accepted, and worse ones are accepted with a real probability that shrinks as temperature cools.
This real occasional acceptance of worse moves lets the search escape local dead ends that a strictly-downhill method would get stuck in.
As the real temperature cools toward zero, the tour settles into a genuinely refined, rarely-worsening solution; it holds briefly, then a fresh run begins.
From cooling metal to hard optimisation
Annealing is the old metalworking process of heating a material and cooling it slowly so its atoms settle into a low-energy, orderly arrangement. In 1953 Nicholas Metropolis and colleagues published a Monte Carlo method for sampling the states of a thermodynamic system, and in 1983 Scott Kirkpatrick, Daniel Gelatt and Mario Vecchi adapted it as a general optimisation technique, applying it to the travelling salesman problem and naming it simulated annealing. Vladimír Černý arrived at a similar idea independently in 1985.
The key is the acceptance rule. A move that improves the solution is always taken, while a worse move is taken with probability exp(-Δ/T), where Δ is how much worse it is and T is the temperature. When T is large the search wanders freely and can climb out of poor local optima; as T falls, the process becomes more selective and eventually behaves like pure descent.
The travelling salesman problem, which asks for the shortest closed tour through a set of points, is the standard demonstration, because it is easy to state and hard in general. Simulated annealing is a heuristic: it usually finds a very good tour but gives no practical guarantee of the best one. Convergence to a global optimum has been shown only in the limit of an extended cooling schedule, and the result depends on how slowly the temperature is lowered.
A worked example
Early in the run, the tour visibly jumps to longer, worse configurations now and then; as the real temperature drops, those jumps stop happening and the tour steadily, monotonically improves instead.
Settings & tips
- Accent recolours the current tour.
- The cooling schedule and acceptance rule are real, not scripted.
- A fresh random tour and full cooling schedule begins automatically once it finishes.
Frequently asked questions
- Is this real simulated annealing?
- Yes — a real cooling schedule and real probabilistic acceptance rule, the same core algorithm used in real optimization software.
- Why accept worse solutions sometimes?
- It is a real, deliberate strategy — occasionally accepting worse moves helps the search escape local optima it would otherwise get stuck in.
- Is a key needed?
- No — it is a pure local computation.
- Is it free?
- Yes — free, no download, in your browser.
- What does the temperature mean in the algorithm?
- It is a control parameter, not a physical temperature. It sets how willing the search is to accept a worse solution, high at the start and low at the end.
- Does simulated annealing find the best possible tour?
- Not reliably. It is a heuristic that usually finds a good answer, and slower cooling improves the odds. Guarantees of reaching the global optimum only hold for very long cooling schedules that are rarely practical.
- What else is it used for?
- Problems with a huge space of possible arrangements, where trying them all is impossible. Circuit layout was among the early applications.