algorithmmachine-learningsearchoptimizationsimulated-annealing

Probability calculation and comparison in Simulated Annealing


I just realized I made a mistake in an algorithm I wrote years ago.

https://www.researchgate.net/publication/298209081/figure/fig7/AS:341632911200275@1458463041655/Flowchart-of-simulated-annealing-algorithm.png

Instead of r < p in this flow, what I did was checking if p <= r. Honestly, I cannot put my mind together to decide if this is a huge mistake or not.

delta = old state - new state
P = exp(delta / T) * 100
if(delta > 0 or P <= random(100))
{
 accept(new state)
}

Solution

  • P becomes smaller and smaller as the temperature rises. When you check for r < p it becomes increasingly unlikely that your search will switch from the current state to a worse new state. This is the idea of Simulated Annealing.

    You check for p <= r, which makes it increasingly likely that your search will switch to a worse state in the end and less likely at the beginning. I assume you will get very mixed results with this as you are doing exploitation first and exploration later.