Simulated Annealing

References

Thomas Weise - Metaheuristic Optimization

Th.Bäck A.E.Eiben J.N.Kok H.P.Spaink - Natural Computing Series

Pseudo Code
\begin{algorithm}
\caption{SA Algorithm}
\begin{algorithmic}
\STATE $f \gets \text{the objective function subject to minization}$
\STATE $shouldTerminate \gets \text{the termination criterion}$
\STATE $x_{new} \gets random() \text{the newly generated individual}$
\STATE $x_{cur} \gets x_new \text{the point currently investigated}$
\STATE $\textit{Best} \gets x_cur \text{the best individual ever discovered}$
\STATE $\textit{T} \gets \text{the temperature of the system which is decreased over time}$
\STATE $t \gets 0$
\WHILE{$shouldTerminate$}
\STATE $x_{new} \gets mutation(x_{cur})$
\STATE $\Delta E \gets x_{new} - x_{cur}$
\IF{$\Delta E \leq 0$}
\STATE $x_{cur} \gets x_{new}$
\IF{$f(\textit{Best}) > f(x_{cur})$}
\STATE $\textit{Best} \gets x_{cur}$
\ENDIF
\ELSE
\STATE $T \gets getsTemperature()$
\IF{$\text{randomly from [0,1]} < e^{-(\Delta E/T)}$}
\STATE $x_{cur} \gets x_{new}$
\ENDIF
\ENDIF
\STATE $t \gets t+1$
\ENDWHILE
\RETURN $\textit{Best}$
\end{algorithmic}
\end{algorithm}