Basic simulated annealing