Adding a max limit for simulated annealing.