Skip to content

Fix dual flip after postsolve - #3248

Merged
jajhall merged 4 commits into
latestfrom
fix-dual-flip-after-postsolve
Sep 1, 2026
Merged

Fix dual flip after postsolve#3248
jajhall merged 4 commits into
latestfrom
fix-dual-flip-after-postsolve

Conversation

@jajhall

@jajhall jajhall commented Aug 31, 2026

Copy link
Copy Markdown
Member

Description

When solving a maximization, the costs are flipped before presolve, so that presolve can assume minimization. However, after postsolve, the method to flip duals (PresolveComponent::negateReducedLpColDuals()) was incorrect, and didn't flip row duals. This is only exposed after primal-dual postsolve, since the dual (and primal) values are recomputed after primal-dual-basis postsolve.

There are other errors within primal-dual postsolve, but it's hard to work on them with this error!

Also corrected "successfull" to "successful" in highs/ipm/hipo/ipm/Solver.cpp @filikat

Checklist

  • I have read the contributing guidelines
  • This PR targets the latest branch
  • Tests are passing
  • Documentation was updated where relevant
  • This PR is not primarily AI-generated (per the AI contributions policy in CONTRIBUTING.md)

@jajhall
jajhall requested a review from fwesselm August 31, 2026 15:17
@jajhall jajhall self-assigned this Aug 31, 2026
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.48936% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.24%. Comparing base (f1de972) to head (cb317c0).
⚠️ Report is 923 commits behind head on latest.

Files with missing lines Patch % Lines
highs/ipm/hipo/ipm/Solver.cpp 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #3248      +/-   ##
==========================================
+ Coverage   73.16%   73.24%   +0.07%     
==========================================
  Files         430      445      +15     
  Lines      103967   108107    +4140     
  Branches    16719    17325     +606     
==========================================
+ Hits        76067    79182    +3115     
- Misses      27624    28649    +1025     
  Partials      276      276              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jajhall
jajhall requested a review from filikat August 31, 2026 16:48

@fwesselm fwesselm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, @jajhall!

Comment thread check/TestPresolve.cpp
REQUIRE(
doubleEqual(solution.row_dual[iRow], h.getSolution().row_dual[iRow]));

REQUIRE(h.getModelStatus() == HighsModelStatus::kOptimal);

@fwesselm fwesselm Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this duplicate check needed?

Comment thread highs/lp_data/Highs.cpp
return HighsPostsolveStatus::kNoPrimalSolutionError;
const bool have_dual_solution =
presolve_.data_.recovered_solution_.dual_valid;
const HighsInt report_3040_col = -578;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this branch, but should we keep this?

@jajhall
jajhall merged commit bb0ec81 into latest Sep 1, 2026
558 checks passed
@jajhall
jajhall deleted the fix-dual-flip-after-postsolve branch September 1, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants