Fixed a bug in SumulatedAnnealing algorithm