Optimization & Search
Simulated Annealing


This week assignment was to compare two search algorithms: a simulated annealing and a genetic algorithm. This page shows the Simulated Annealing search algorithm. Consider a 1D spin glass defined by a set of spins S1, S2, ..., SN, where each spin can be either +1 or -1. The energy of the spins is defined by :

E = -sum(Ji * Si * Si+1) for i = [1..N] and SN+1 = S1

where Ji's are random variables drawn from a Gaussian distribution with zero mean and unit variance.

The graph below shows the decreasing Energy over Time for different cooling rates :

The red line represents the minimum possible Energy.

 

Here is the Matlab code :

annealing.m