Skip to content

Simulated Annealing

Simulated Annealing.

simulated_annealing(problem, *, stop, rng=None, neighbor=swap_neighbor, initial_temperature=100.0, cooling=geometric_cooling(0.95), max_neighbor_tries=100, max_start_tries=1000)

Metropolis acceptance: a worse move of oriented size d is accepted with probability exp(-d / T). The start is drawn up to max_start_tries times for a feasible one. Infeasible neighbours are redrawn up to max_neighbor_tries times, else the iteration keeps the current solution. history is the best value after each iteration (first entry: the start); metadata has evaluations, final_temperature, termination ('stop') and state (the final State).

geometric_cooling(alpha=0.95)

T <- alpha * T, with 0 < alpha < 1.

linear_cooling(step)

T <- max(T - step, 0).

bit_flip_neighbor(solution, rng)

Binary move: flip one random bit.

swap_neighbor(solution, rng)

Permutation move: swap two random positions.

two_opt_neighbor(solution, rng)

Permutation move: reverse a random segment (2-opt).