
Simulated Annealing
Simulated Annealing
From Hand Calculations to AI-Assisted Code
You can already ask an AI to write you a Simulated Annealing routine. The problem is knowing whether its cooling schedule is tuned — or whether it cooled too fast and froze into the first mediocre solution it found, or too slow and burned hours wandering at random. The whole method hinges on that schedule, and it's the part a copy-paste implementation almost always gets wrong. This is the course that gives you that judgment.
Five parts, one algorithm, no gaps:
Part 1 — Intro. Why deliberately accepting a worse move sometimes — often at the start, rarely near the end — is exactly what lets this method escape the local optima that trap greedy searches, and how a single cooling "temperature," borrowed from the way metal anneals, controls that willingness. The intuition before the notation.
Part 2 — By Hand. A complete worked example, step by step: propose a move, compute the change in cost, decide whether to accept it using the acceptance probability, then cool the temperature and repeat — every calculation and every number shown. Nothing waved away, nothing left "as an exercise." You prove the algorithm to yourself.
Part 3 — In Excel. The same example built out in a spreadsheet you can open and poke at, so you watch the search accept bad moves early and settle down as it cools — and see for yourself how a faster or slower cooling schedule changes where it lands.
Part 4 — In Python. A clean, executable, verified reference implementation — the known-good version you can check any other code against.
Part 5 — With AI. A tested prompt that directs an AI assistant to carry this same algorithm to your problem, plus the understanding to catch it when it's wrong.
By the end you won't just have working code. You'll have followed the algorithm from first principles through a hand calculation, a spreadsheet, and production Python — so when you point an AI at your own optimization problem, you'll know how to set the starting temperature and cooling schedule on purpose, read when the search has frozen too early, and tell when the answer is right.
Written for practicing engineers and STEM professionals who'd rather understand a method than trust a black box.