1: Setting initial and final temperatures
2: Create from Initial solution
3: =
4: While ( > ) do // Temperature Cycle
5:  While (stop criteria) // Metropolis Cycle
6:   Create using a perturbation to S current
7:   Obtain difference similarity between and
8:   If (difference 0) then
9:    Accept
10:   else
11:    Boltzmann probability = exp (−difference/T)
12:    If (Boltzmann probability) > random (0,1) then
13:     Accept
14:    end if
15:  end if
16:  end while
17:  Decrease
18: end while
Algorithm 1: Pseudocode of classical Simulated Annealing.