Add public Solver.from_file API for existing LP/MPS files - #996
Open
danielelerede-oet wants to merge 2 commits into
Open
danielelerede-oet wants to merge 2 commits into
danielelerede-oet wants to merge 2 commits into
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
danielelerede-oet
marked this pull request as ready for review
September 30, 2026 10:59
This branch has not been deployed
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.
Related to open-energy-transition/solver-benchmark#604 (cc @eantonini).
Note
The following technical summary and validation report were generated with AI assistance.
Changes proposed in this Pull Request
Adds
Solver.from_file(name, problem_fn, options=...)as a public, non-deprecated entry point for solving existing LP/MPS files without constructing a linopyModel.The constructor validates the solver's file-reading capability and input path, copies solver options, and prepares the existing file-based solve path. The backend reads the input during
solve().This PR also:
Existing backend restrictions and result semantics remain unchanged. Without a linopy Model, label-indexed primal and dual arrays may be empty; this limitation is documented.
Validation
Solver.from_file: LP and MPS passed, including objective, native variable values and input preservation.--forked: 212 passed, 20 skipped, 4 failed. The remaining failures occur in existing tests that open a second Gurobi environment while the first remains active, which the single-use license rejects.mypy linopy/solvers.py: passed.Checklist
AGENTS.md).doc.doc/release_notes.rstof the upcoming release is included.