forked from airbus/discrete-optimization
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement callbacks integration for gurobi solvers
- replace method to implement (for all milp solvers) retrieve_ith_solution() by retrieve_current_solution() that take a callable get_var_value_for_current_solution(). Then - retrieve_ith_solution is retrieve_current_solution with get_var_value_for_ith_solution - during a gurobi callback, it will be called with model.cbGetSolution - update milp solvers to reflect that - create a GurobiCallback class that - populates on the fly a result_storage by using retrieve_current_solution() - calls user-defined d-o callbacks - terminate solve if user-defined callbacks decide to early stop - catch potential exceptions inside the callback as they are ignored by gurobi else (the solve continues even though the error is displayed to stderr) - re-raise in solve() exceptions found in callbacks (useful for debugging but also necessary for optuna pruning, based on raising a TrialPruned exception) - add tests using d-o callbacks with gurobi for coloring solver - the gurobi pickup-vrp solver still does not use callbacks as it is overriding GurobiMilpSolver.solve() to perform a loop.
- Loading branch information
Showing
10 changed files
with
341 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.