Repository navigation
fix(io): raise when writing indicator constraints to MPS - #1187
Draft
FabianHofmann wants to merge 1 commit into
Draft
FabianHofmann wants to merge 1 commit into
FabianHofmann wants to merge 1 commit into
Conversation
linopy writes MPS through HiGHS, which has no indicator constraints, so they were dropped without warning and the solve returned a wrong optimum. Closes #1186.
Collaborator
Author
|
Note The following content was generated by AI. "Check types" fails with 6 mypy errors in Generated by Claude Code |
Merging this PR will not alter performance
Comparing Footnotes
|
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.
Closes #1186.
Changes proposed in this Pull Request
Note
The following content was generated by AI.
linopy writes MPS through HiGHS, which has no indicator constraints. They were dropped silently, so
io_api="mps"returned a wrong optimum (x = 10instead of5in the #1186 example, Gurobi and CPLEX).matrices_to_fileraisesNotImplementedErrorwhen the matrices hold indicator rows, and points toio_api="lp"or"direct". This coversModel.to_file("*.mps")andsolve(io_api="mps").to_fileto MPS raises;solve(io_api="mps")raises for every licensed solver with indicator support.Validation and reviewer notes
pyteston test_indicator_constraints, test_io, test_restrict_matrix, test_matrices, test_sos_constraints, test_windowing_integration: 336 passed, 5 skipped. Verified with Gurobi and CPLEX.ruff check/ruff formatclean.mypyreports the same 28 Xpress errors inlinopy/solvers.pyas master.INDICATORSsection (Gurobi and CPLEX read it) instead of raising.b = 1 -> 0 * x >= 5) is fixed fordirectby fix: a constraint row without a nonzero term reaches the solver #1183; this PR does not touch it.Checklist
AGENTS.md).doc.doc/release-notes.mdof the upcoming release is included.Generated by Claude Code