Update lexicographic_minimize definition

This commit is contained in:
Jip J. Dekker 2021-07-09 13:32:31 +10:00
parent 3a623816c8
commit 8f6d5f1835
No known key found for this signature in database
GPG Key ID: 517DF4A00618C9C3

View File

@ -205,31 +205,23 @@ It required that, once a solution is found, each subsequent solution must either
We can model this strategy restarts as such:
\begin{mzn}
predicate lex_minimize(array[int] of var int: o) =
let {
var index_set(o): stage
array[index_set(o)] of var int: best;
} in if status() = START then
stage = min(index_set(o))
else
if status() = UNSAT then
if lastval(stage) < l then
stage = lastval(stage) + 1
else
complete() % we are finished
endif
else
stage = lastval(stage)
/\ best[stage] = sol(_objective)
endif
/\ for(i in min(index_set(o))..stage-1) (
o[i] = lastval(best[i])
)
/\ if status() = SAT then
o[stage] < sol(_objective)
endif
/\ _objective = o[stage]
endif;
predicate lex_minimize(array[int] of var int: o) =
let {
var min(index_set(o))..max(index_set(o))+1: stage;
} in if status() = START then
stage = min(index_set(o))
elseif status() = UNSAT then
stage = lastval(stage) + 1
else /* status() = SAT */
stage = lastval(stage)
/\ o[stage] < sol(o[stage])
endif
/\ forall(i in min(index_set(o))..stage-1) (
o[i] = sol(o[i])
)
/\ if stage > max(index_set(o)) then
complete()
endif;
\end{mzn}
The lexicographic objective changes the objective at each stage in the evaluation.