Skip to content

Simplify HighsCutGeneration and HighsTransformedLp - #3473

Open
fwesselm wants to merge 56 commits into
ERGO-Code:latestfrom
fwesselm:simplifyCMIR
Open

fwesselm wants to merge 56 commits into
ERGO-Code:latestfrom
fwesselm:simplifyCMIR

Conversation

@fwesselm

@fwesselm fwesselm commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

@Opt-Mucca, these are the changes to simplify the code in HighsCutGeneration and HighsTransformedLp. This has not been tested on a large-scale set yet:

  1. New data structures Row, TransformedVar and TransformedRow in HighsTransformedLp.h.
  2. flipComplementation used to compute solval = upper - solval in double. For integer variables with huge bounds, flipping back lost the solution value.
  3. One cut computation instead of two in HighsCutGeneration.cpp. Before, the search for the best scaling factor (delta) was computed in double, while the cut was then built in HighsCDouble, and both version could disagree. Now, both use the same lambdas.

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)

fwesselm added 30 commits May 15, 2025 11:41
@fwesselm
fwesselm requested a review from Opt-Mucca October 27, 2026 14:45
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.48229% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.94%. Comparing base (dcf8061) to head (b4cd7d5).
⚠️ Report is 68 commits behind head on latest.

Files with missing lines Patch % Lines
highs/mip/HighsCutGeneration.cpp 98.65% 5 Missing ⚠️
highs/mip/HighsModkSeparator.cpp 89.28% 3 Missing ⚠️
highs/mip/HighsTransformedLp.cpp 98.80% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #3473      +/-   ##
==========================================
+ Coverage   75.85%   75.94%   +0.09%     
==========================================
  Files         461      467       +6     
  Lines      115588   116368     +780     
  Branches    18059    18147      +88     
==========================================
+ Hits        87677    88376     +699     
- Misses      27671    27752      +81     
  Partials      240      240              

☔ 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.

@Opt-Mucca Opt-Mucca 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.

I am a huge fan of these changes! The code is so much neater and my gut is telling that there's probably even a small performance improvement for cache efficiency. Great data structure additions.

I haven't approved yet because I'd like all the questions resolved first:

  • Does the violation need to be measured in HighsCDouble? I agree that we were occasionally getting cuts that disagreed with each other because of the different precision they were calculated in, but that's not really a correctness error?
  • Are we sure we want the "dummy cuts" to be calculated in HighsCDouble when we're trying to find bestdelta? I assume this has a decent performance hit, and like the point above, it doesn't really fix any "true" correctness issues.

Comment thread highs/mip/HighsCutGeneration.cpp Resolved
Comment thread highs/mip/HighsCutGeneration.cpp Resolved
Comment thread highs/mip/HighsTransformedLp.h Resolved
@fwesselm

Copy link
Copy Markdown
Collaborator Author

I am a huge fan of these changes! The code is so much neater and my gut is telling that there's probably even a small performance improvement for cache efficiency. Great data structure additions.

I haven't approved yet because I'd like all the questions resolved first:

  • Does the violation need to be measured in HighsCDouble? I agree that we were occasionally getting cuts that disagreed with each other because of the different precision they were calculated in, but that's not really a correctness error?
  • Are we sure we want the "dummy cuts" to be calculated in HighsCDouble when we're trying to find bestdelta? I assume this has a decent performance hit, and like the point above, it doesn't really fix any "true" correctness issues.

Thanks, @Opt-Mucca.

  • Regarding computation of violation in HighsCDouble, latest already summed the final violation in HighsCDouble, but these changes make the products exact.
  • cmirCutGenerationHeuristic selects delta, and then the complementation flips, using the efficacy of the "dummy" cuts. In latest these efficacies are computed in double, while the cut that is then built uses HighsCDouble. My changes fix this inconsistency.
  • I agree that performance needs to be evaluated.

@Opt-Mucca

Opt-Mucca commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

@fwesselm if upgrading to HighsCDouble has no negative performance impacts then I'm alright with it.

If it does: I always assumed that it was important to generate the dummy cuts using lower precision as well as the violation. As long as the final cut is computed using HighsCDouble then the worst-case scenario is that we generate a cut where there was another slightly better delta. I would've voted to remove the debug check that the dummy violation isn't different to the higher precision violation instead. Regardless, I'm in full support of the general refactor idea (and even if the change is performance neutral, then would still vote to return to the double precision for dummy cuts, because I suspect there's some performance improvements from your other changes. Edit: Won't die on this hill though, and can live with the change if you think it's for the better)

This branch has not been deployed

No deployments
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.

3 participants