Small Group Tutorials

Here to help students catch up, keep up, and move ahead. Book a consultation here.

How to Learn Simulated Annealing: Temperature, Acceptance Probability, Cooling Schedules and Search Trade-Offs

Wait, What?

Sometimes the right way to improve a solution is to deliberately accept a worse one.

Simulated annealing is a stochastic optimisation method inspired by thermal annealing. Its central learning value is not the metaphor but the control logic: when search becomes trapped in a local optimum, occasional uphill moves can preserve the possibility of reaching a better region. As temperature falls, the search becomes increasingly selective.

Quick Answer

Learn simulated annealing through objective function → neighbourhood → candidate move → cost difference → temperature-dependent acceptance → cooling schedule → repeated trials → empirical evaluation.

1. Define the Search Space Before the Algorithm

State what a solution is, what makes a solution valid, how quality is scored and which local modifications count as neighbours. Poor neighbourhood design can cripple an otherwise correct implementation because the algorithm can only explore states reachable through its move set.

2. Separate Better Moves From Worse Moves

If a candidate improves the objective, accept it. If it is worse, acceptance becomes probabilistic. A common form uses an exponential rule based on the increase in cost divided by temperature. At high temperature, the search is more willing to cross barriers. At low temperature, worsening moves become increasingly unlikely.

3. Understand Temperature as Search Freedom

Temperature is not physical heat inside the program. It is a control parameter governing how strongly the search resists worsening moves. Ask learners to compare acceptance probabilities for the same uphill cost at several temperatures. This makes exploration–exploitation behaviour visible numerically rather than metaphorically.

4. Cooling Schedule Is Part of the Algorithm

A schedule determines how temperature changes. Cool too quickly and the search may freeze around a mediocre basin. Cool very slowly and search may become expensive. Theoretical convergence results rely on demanding schedules that are often impractical, so real engineering typically evaluates schedules empirically for the target problem.

5. Trace One Small Landscape by Hand

Use a tiny one-dimensional objective with several local minima. Start from one position, generate a neighbouring state, compute the score difference and then calculate or look up the acceptance probability. Repeat at high and low temperature. This exposes why stochastic acceptance can escape a basin that greedy hill climbing cannot.

6. Randomness Requires Repeated Evaluation

One successful run proves little about a stochastic optimiser. Compare distributions across repeated seeds. Record best solution, median solution, variation, runtime and sensitivity to starting state. Professional evaluation should distinguish algorithm design from lucky random trajectories.

7. Compare With Greedy and Other Metaheuristics

  • Greedy local search usually rejects worsening moves.
  • Simulated annealing sometimes accepts them according to temperature.
  • Random restart explores by starting again rather than crossing barriers.
  • Evolutionary methods maintain populations rather than one current state.

Common Failure States

  • Using a neighbourhood that cannot reach important regions of the search space.
  • Setting temperature without inspecting objective-scale differences.
  • Cooling so quickly that the method becomes almost greedy.
  • Claiming convergence from one run.
  • Comparing methods using different time budgets.
  • Assuming a heuristic’s best observed result is globally optimal.

Practice Ladder

  • Trace acceptance decisions with fixed random numbers.
  • Plot acceptance probability against temperature.
  • Design two neighbourhoods for the same problem and compare reachability.
  • Run multiple seeds and summarise the result distribution.
  • Compare against a greedy baseline under equal budgets.
  • Defend a cooling schedule and stopping rule for a real workload.

Learning Hall Boundary

This article owns simulated-annealing mechanics and search judgement. It does not replace the existing randomised-algorithms or evolutionary-algorithms articles. Those pages own broader families; this page owns the temperature-controlled single-state search process.

Evidence Boundary

Simulated annealing can be powerful on difficult optimisation landscapes, but practical performance depends heavily on representation, neighbourhood, schedule, time budget and problem structure. A heuristic result should be reported with uncertainty and baseline comparisons rather than presented as a universal guarantee.

Professional rule: understand simulated annealing when you can explain why accepting a worse move can improve long-run search, quantify how temperature changes that acceptance, and evaluate the method across repeated runs rather than anecdotes.