Simulated annealing algorithm for Ising model