Skip to content

Commit

Permalink
raise exception when the rcpsp model is multimode but the model in si…
Browse files Browse the repository at this point in the history
…ngle mode.
  • Loading branch information
g-poveda committed Oct 28, 2024
1 parent dbaf7f0 commit d576f1d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions discrete_optimization/rcpsp/solvers/toulbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ def retrieve_solution(
)

def init_model(self, **kwargs: Any) -> None:
try:
assert not self.problem.is_rcpsp_multimode()
except AssertionError as exc:
logging.exception(
f"Your problem is multimode, and this toulbar model can't tackle it. "
f"Please go with ToulbarMultimodeRcpspSolver instead."
)
raise exc
model = pytoulbar2.CFN(ubinit=self.problem.horizon)
n_jobs = self.problem.n_jobs
horizon = self.problem.horizon
Expand Down

0 comments on commit d576f1d

Please sign in to comment.