From 3dbbe3cbbefefeb37c6c62c9dec1d494223f1ed8 Mon Sep 17 00:00:00 2001 From: Ignace Bleukx Date: Tue, 10 Oct 2023 13:44:21 +0200 Subject: [PATCH] fix import --- cpmpy/tools/mus.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpmpy/tools/mus.py b/cpmpy/tools/mus.py index 441f6212e..496eaca01 100644 --- a/cpmpy/tools/mus.py +++ b/cpmpy/tools/mus.py @@ -77,18 +77,18 @@ def mus_naive(soft, hard=[], solver="ortools"): # ensure toplevel list soft = toplevel_list(soft, merge_and=False) - m = Model(hard+soft) + m = cp.Model(hard + soft) assert not m.solve(solver=solver), "MUS: model must be UNSAT" mus = [] # order so that constraints with many variables are tried and removed first core = sorted(soft, key=lambda c: -len(get_variables(c))) for i in range(len(core)): - subcore = mus + core[i+1:] # check if all but 'i' makes core SAT - - if Model(hard+subcore).solve(solver=solver): + subcore = mus + core[i + 1:] # check if all but 'i' makes core SAT + + if cp.Model(hard + subcore).solve(solver=solver): # removing it makes it SAT, must keep for UNSAT mus.append(core[i]) # else: still UNSAT so don't need this candidate - + return mus