Repository navigation
Conversation
Collaborator
|
I'm not a huge fan of the solution here. It makes all solvers pay the complexity and runtime cost to benefit just one feature of two solvers. Could we discuss the feature design first ? |
Collaborator
|
reading #82 (comment) it sounds like the proper fix is to avoid early normalization on our side, so that HiGHS sees the constraint as I think it should be possible to fix the bug with a much smaller diff than you have here |
lovasoa
marked this pull request as draft
August 2, 2026 19:02
Collaborator
|
see #135 for my take on 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.
Fixes #82
Summary
Corrects the sign of dual values returned for constraints written with
>=while preserving the solver-specific objective-direction conventions already used by the dual integrations.Problem
good_lpnormalizes every inequality sent to a solver as an upper-bound constraint. For a user constraint written asa >= b, the normalized expression isb - a <= 0, so the normalized right-hand side is the negation of the right-hand side written by the user. A dual returned for that normalized right-hand side therefore has the opposite sign from the corresponding user-facing shadow price.The original constraint direction was discarded during normalization, and
ConstraintReferenceretained only the row index. As a result, the HiGHS and Clarabel integrations returned the raw normalized value for the case reported in #82.Implementation
<=,==, or>=) while retaining the existing normalized solver representation.ConstraintReferencewithout changing its existing index-based equality or debug representation.>=case is negated; existing<=and equality behavior is preserved.Regression coverage
Extends
tests/shadow_price.rswith a solver-independent>=case:The optimum is
x = 1, and increasing the lower bound by one decreases the maximized objective by two, so the expected dual value is-2. A minimization counterpart also verifies that the Clarabel and HiGHS objective-direction handling remains consistent. Both cases run for HiGHS and Clarabel alongside the existing<=dual tests.Validation
cargo fmt -- --checkgit diff --checkcargo clippy --all-targets --no-default-features --features "microlp,clarabel"cargo test --no-default-features --features clarabel --test shadow_pricecargo test --no-default-features --features highs --test shadow_pricecargo build --features all_default_solvers --testscargo test --quiet --features all_default_solvers -- --test-threads=1The local CPLEX-specific check could not be run because this environment does not have a CPLEX installation. The repository's CPLEX CI job passed for the original revision; the follow-up revision is being rechecked by CI.