26 lines
638 B
MiniZinc
26 lines
638 B
MiniZinc
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;
|