Repository navigation
fix: LP objective without a live term writes a zero term instead of a phantom x - #1177
Draft
FabianHofmann wants to merge 2 commits into
Draft
FabianHofmann wants to merge 2 commits into
FabianHofmann wants to merge 2 commits into
Conversation
…live variable An objective whose variables are all masked is constant, so its polars frame holds one row with null vars. The LP writer formatted that row as a bare `x`, which the solver read as a new column and the solution parser could not map back to a label. Closes #1176
Merging this PR will not alter performance
Comparing Footnotes
|
GLPK rejects an LP file whose objective section holds no term, which an all-masked objective or 0 * x produces. Write a zero-coefficient term on the first live variable instead. The test now also pins x to a unique optimum, as a zero objective left SCIP free to return any x >= 1.
x
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 #1176.
Changes proposed in this Pull Request
Note
The following content was generated by AI.
When the objective has no live term,
objective_to_filewrites+0.0 x<first live label>.x, which the solution parser could not map back to a label (all LP solvers).obj:section is no option: GLPK rejects it ("missing variable name"). That already brokem.add_objective(0 * x)with GLPK on master. A constant (obj: +0.0) fails too: GLPK rejects it, and Gurobi reads0.0as a variable name.test_objective_without_live_termscovers an all-masked objective and0 * xover allparams. On master, 14 of 52 cases fail; with this PR, all pass.Local checks
ruff check,ruff format --check,mypy linopy: clean.pytest: 6294 passed, 4 failed. The 4 failures (test_quadratic_model_wo_constraint[*-mps-*]) also fail on master: the local env has highspy 1.16.0, which thesolversextra excludes (fix: exclude highspy 1.16.0 and harden the MIP-limit test #1149).Checklist
AGENTS.md).doc.doc/release-notes.mdof the upcoming release is included.