Skip to content

Commit

Permalink
more verbose warning and error
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnaceBleukx committed Jul 23, 2024
1 parent 1c52cd4 commit fe990d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cpmpy/solvers/exact.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def solveAll(self, display=None, time_limit=None, solution_limit=None, call_from
timelim = time_limit if time_limit is not None else 0

if self.has_objective():
if not call_from_model:
warnings.warn("Adding constraints to solver object to find all solutions, solver state will be invalid after this call!")

(my_status, objval) = self.xct_solver.toOptimum(timelim) # fix the solution to the optimal objective
if my_status == "UNSAT": # found unsatisfiability
self._fillObjAndVars() # erases the solution
Expand All @@ -231,7 +234,8 @@ def solveAll(self, display=None, time_limit=None, solution_limit=None, call_from
raise ValueError("Error: inconsistency during solveAll should not happen, please warn the developers of this bug")
elif my_status == "TIMEOUT": # found timeout
return 0

else:
assert my_status == "SAT", "Unexpected status from Exact"
self += self.objective_ == objval # fix obj val

solsfound = 0
Expand Down

0 comments on commit fe990d4

Please sign in to comment.