This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
dekker-phd-thesis/assets/listing/inc_lex_min.mzn

19 lines
472 B
MiniZinc

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
/\ _objective = o[stage];
/\ forall(i in min(index_set(o))..stage-1) (
o[i] = sol(o[i])
)
/\ if stage > max(index_set(o)) then
complete()
endif;