Skip to content

Commit

Permalink
Update test with callback
Browse files Browse the repository at this point in the history
We
- shorten the timer of the callback
- lengthen the time_limit of the ortools solver itself

to avoid assert errors which happens if no solution found
- after the callback timer but
- before the solver own timer.
  • Loading branch information
nhuet committed Sep 19, 2024
1 parent 4000ccf commit 1f9a6e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/rcpsp/solver/test_rcpsp_cp.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ def on_step_end(self, step: int, res: ResultStorage, solver: CPSatRCPSPSolver):
logging.debug(sol.rcpsp_schedule)
logging.debug(sol.rcpsp_modes)

callbacks = [VariablePrinterCallback(), TimerStopper(2)]
callbacks = [VariablePrinterCallback(), TimerStopper(1)]

with caplog.at_level(logging.DEBUG):
result_storage = solver.solve(callbacks=callbacks, time_limit=10)
result_storage = solver.solve(callbacks=callbacks, time_limit=20)

assert "Solution #1" in caplog.text
assert (
Expand Down

0 comments on commit 1f9a6e7

Please sign in to comment.