Simulated annealing (with pseudo code)