added simulated annealing; needs debugging