Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cpmpy/solvers/minizinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class CPM_minizinc(SolverInterface):
https://minizinc-python.readthedocs.io/
"""

supported_global_constraints = frozenset({"alldifferent", "alldifferent_except0", "allequal",
supported_global_constraints = frozenset({"alldifferent", "alldifferent_except_n", "allequal",
"inverse", "ite", "xor", "table", "indomain", "negative_table", "mdd", "regular", "cumulative", "circuit", "gcc",
"increasing", "decreasing",
"strictly_increasing", "strictly_decreasing", "lex_lesseq", "lex_less",
Expand Down Expand Up @@ -720,9 +720,11 @@ def zero_based(array):
str_rev = zero_based(expr.args[1])
return "inverse({}, {})".format(str_fwd, str_rev)

if expr.name == "alldifferent_except0":
args_str = [self._convert_expression(e) for e in expr.args]
return "alldifferent_except_0([{}])".format(",".join(args_str))
if expr.name == "alldifferent_except_n":
arr, n = expr.args
arr_str = self._convert_expression(arr)
n_str = "{" + ",".join(self._convert_expression(v) for v in n) + "}"
return "all_different_except({}, {})".format(arr_str, n_str)

if expr.name in ["lex_lesseq", "lex_less"]:
X = [self._convert_expression(e) for e in expr.args[0]]
Expand Down
Loading