Annealing algorithm working