Simulated annealing is a stochastic optimisation procedure.
Example: Find value for x so that x^2 - 7x + 10 = 0, with x in range [0,10].
make_instance:
procedure make_instance(x)
if /x then {
return 10 * ?0 # random number [0.0,10.0)
} else {
new_x := x + 0.02 * ?0 - 0.01
if new_x < 0 then new_x := 0
if new_x > 10 then new_x := 10
return new_x
}
end
evaluation:
procedure evaluation(x)
y := x * x - 7 * x + 10
return y * y # returns positive number, 0 is best result
end
run:
result := simulated_annealing(make_instance, evaluation, 1000)
write("Final value of x: ", result)
metropolis_acceptance_criterion (es, en, temp)
Computes the Metropolis acceptance criterion.
simulated_annealing (instance_maker, evaluate_instance, num_iterations, can_stop)
Returns the best instance found after performing simulated-annealing stochastic search.