codes with simulated annealing