Repository navigation
Make the ILP solver backend configurable - #343
Merged
JoOkuma merged 2 commits intoOct 14, 2026
Merged
Conversation
ILPSolver._solve() used a fixed list [Preference.Gurobi, Preference.Scip]. Add a solver_preference parameter that sets the backend order. It accepts a Preference, a backend-name string, or a sequence of either. None keeps the Gurobi-then-SCIP default, so the change is backward compatible. This lets a caller add Preference.CuOpt (ilpy >= 0.6.0) between Gurobi and SCIP, so a large model completes without a Gurobi license. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
@aliddell , LGTM, I'll merge once the CIs pass. |
Contributor
Author
|
@JoOkuma are we happy with CI? |
Member
|
@aliddell , yes, thank you for the ping. I forgot about this. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ILPSolverchooses its solver backend with a fixed list. The method_solve()triesPreference.Gurobi, thenPreference.Scip. A caller cannot change this order. This pull request adds asolver_preferenceparameter. The caller can now set the backend order. The default does not change.Why
Some users have no Gurobi license. Gurobi then fails on a large model. The solver falls back to SCIP. SCIP is too slow for large graphs.
ilpy >= 0.6.0addsPreference.CuOpt. cuOpt has a native MILP solver under the Apache-2.0 license. It needs no license file. A configurable backend order lets a user put cuOpt between Gurobi and SCIP. A large model then completes without a Gurobi license.What changed
ILPSolver.__init__gains a keywordsolver_preference. It accepts an ilpyPreference, a backend name as a string, or a sequence of either. A string matches aPreferenceby name, without case. Valid names are "gurobi", "scip", and "cuopt".Nonekeeps the current order: Gurobi, then SCIP. The change is backward compatible._solve()iterates the configured list instead of the fixed list.Notes
ilpyversion pin. It stays>= 0.5.1. The name "cuopt" needsilpy >= 0.6.0. The code raises a clear error if the installedilpyhas noPreference.CuOpt.Test
pytest src/tracksdata/solverspasses. 35 tests pass with ilpy 0.6.0.🤖 Generated with Claude Code