Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnaceBleukx committed Mar 25, 2024
1 parent 100f0b9 commit 00be5a5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cpmpy/solvers/choco.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def solve(self, time_limit=None, **kwargs):

return has_sol

def solveAll(self, display=None, time_limit=None, solution_limit=None, **kwargs):
def solveAll(self, display=None, time_limit=None, solution_limit=None, call_from_model=False, **kwargs):
"""
Compute all (optimal) solutions, map them to CPMpy and optionally display the solutions.
Expand Down Expand Up @@ -386,7 +386,7 @@ def _get_constraint(self, cpm_expr):
bv = self._get_constraint(cond).reify()
chc_var = self.solver_var(subexpr)
else:
raise ValueError(f"Unexpected reification {cpm_expr}")
raise ValueError(f"Unexpected implication {cpm_expr}")

return self.chc_model.or_([~bv, chc_var])

Expand Down Expand Up @@ -496,8 +496,6 @@ def _get_constraint(self, cpm_expr):
elif cpm_expr.name == "circuit":
return self.chc_model.circuit(chc_args)
elif cpm_expr.name == "inverse":
if min(get_bounds(cpm_expr.args[0])[0]) <= 0 or min(get_bounds(cpm_expr.args[1])[0]) <= 0:
raise NotSupportedError("Issue in the Choco solver (github #1090) prevents posting inverse constraint with negative bounds for any variable, decomposing the constraint")
return self.chc_model.inverse_channeling(*chc_args)

# but not all
Expand Down Expand Up @@ -534,7 +532,7 @@ def _get_constraint(self, cpm_expr):
if cpm_expr.args[0] is True:
return None
else:
if self.helper_var is not None:
if self.helper_var is None:
self.helper_var = self.chc_model.intvar(0, 0)
return self.chc_model.arithm(self.helper_var, "<", 0)

Expand Down

0 comments on commit 00be5a5

Please sign in to comment.