Den
Den

Reputation: 37

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)
}

Upvotes: 0

Views: 436

Answers (1)

Simpl
Simpl

Reputation: 2036

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.

Upvotes: 1

Related Questions