10 lines
290 B
MiniZinc
10 lines
290 B
MiniZinc
predicate simulated_annealing(float: init_temp, float: cooling_rate) =
|
|
let {
|
|
var float: temp;
|
|
} in if status() = START then
|
|
temp = init_temp
|
|
else
|
|
temp = last_val(temp) * (1 - cooling_rate) % cool down
|
|
/\ _objective < sol(_objective) - ceil(log(uniform(0.0, 1.0)) * temp)
|
|
endif;
|