by Sajjad Ahmed Niloy
Heating metal allows its atoms to move freely out of stressed positions (local optima). As it cools slowly, the atoms settle into a strong, stable structure (the global optimum).
A particle (orange dot) explores a landscape to find the lowest point (global minimum, green marker). Watch as it uses high "temperature" to "jump" out of shallow valleys (local minima). As it cools, it settles into the best solution. Click "Run Simulation" to start over.
1. The Landscape & Particle: The landscape represents all possible solutions, where height is the "cost" (we want to find the lowest point). The orange particle is the current solution being tested.
2. Energy (Cost): The "energy" of the particle is its Y-position on the graph. A lower energy (a deeper valley) is a better solution.
3. Temperature: This is a crucial parameter that starts high and slowly decreases. When the temperature is high, the particle has more "energy" and is more likely to accept a "bad" move (jumping uphill to a worse solution) to escape a local minimum.
4. Acceptance Probability: The decision to move to a worse solution is calculated with the formula `P = exp(ΔV / T)`. If a random number is less than P, the bad move is accepted. You can see that a high temperature (T) makes this probability higher, and as T approaches zero, the probability of accepting a bad move also approaches zero.
This process allows the algorithm to explore widely at the start and then focus on the best area as it "cools down," preventing it from getting stuck too early.