Skip to content

Commit

Permalink
pychoco has a bug on finding all optimal solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimosts committed Sep 18, 2023
1 parent a67ffc8 commit c589e1b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cpmpy/solvers/choco.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"""
import time

from cpmpy.exceptions import NotSupportedError

import cpmpy
from ..transformations.normalize import toplevel_list
from .solver_interface import SolverInterface, SolverStatus, ExitStatus
Expand Down Expand Up @@ -108,7 +110,7 @@ def solve(self, time_limit=None, **kwargs):
"""

if time_limit is not None:
raise Exception("Pychoco time_limit is not working properly. Not implemented in CPMpy")
raise NotSupportedError("Pychoco time_limit is not working properly. Not implemented in CPMpy")

# call the solver, with parameters
self.chc_solver = self.chc_model.get_solver()
Expand Down Expand Up @@ -171,9 +173,11 @@ def solveAll(self, display=None, time_limit=None, solution_limit=None, **kwargs)
self.chc_solver = self.chc_model.get_solver()
start = time.time()
if self.has_objective():
sols = self.chc_solver.find_all_optimal_solutions(maximize=self.maximize_obj,
solution_limit=solution_limit,
objective=self.solver_var(self.obj))
raise NotSupportedError("Pychoco does not support finding all optimal solutions currently.")
# Normally the following, but currently have a bug
# sols = self.chc_solver.find_all_optimal_solutions(maximize=self.maximize_obj,
# solution_limit=solution_limit,
# objective=self.solver_var(self.obj))
else:
sols = self.chc_solver.find_all_solutions(solution_limit=solution_limit)
end = time.time()
Expand Down

0 comments on commit c589e1b

Please sign in to comment.