adding dealing with local maximum and simulated annealing