Repository navigation
fix(io): raise when writing indicator constraints to MPS - #1187
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.
|
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
|
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