Annealing algorithm implemented (buggy)