Skip to content

Presolve/postsolve debug utilities - #3219

Merged
jajhall merged 12 commits into
latestfrom
presolve-postsolve-debug-utilities
Aug 18, 2026
Merged

Presolve/postsolve debug utilities#3219
jajhall merged 12 commits into
latestfrom
presolve-postsolve-debug-utilities

Conversation

@jajhall

@jajhall jajhall commented Aug 17, 2026

Copy link
Copy Markdown
Member

Introduces the struct MipViolation to gather data from HighsMipSolver::solutionFeasible rather than just bound_violation_, row_violation_, integrality_violation_. This allows more informative logging of "untransformed violations" when log_dev_level is positive.

Introduced reportOriginalPresolvedCol(report_col, sol); to log model data (in both the original and presolved problem) about a column report_col (when non-negative) before calling postSolveStack.undoPrimal in HighsMipSolverData::transformNewIntegerFeasibleSolution since model data is unknown in postSolveStack.undo.

Introduced getPresolvedColumnIndex and getPresolvedRowIndex in HighsPostSolveStack.h so that the index of a column/row in the presolved model can be determined, allowing the model data for the column/row in the presolved problem to be logged.

Introduced presolveTypeToString in HighsPostSolveStack.h so that presolve reductions can be logged more clearly.

Introduced last_reduction_ as a data member of HighsPresolve so that calls to HighsPresolve::checkLimits following a reduction can be identified, simplifying the task of stopping VScode before the last (error-causing) reduction has been performed.

@jajhall
jajhall requested a review from fwesselm August 17, 2026 20:07
@jajhall jajhall self-assigned this Aug 17, 2026
@jajhall jajhall added Enhancement New feature or request Postsolve Presolve labels Aug 17, 2026
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.87302% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.03%. Comparing base (2aefdbf) to head (5c69aec).
⚠️ Report is 4 commits behind head on latest.

Files with missing lines Patch % Lines
highs/mip/HighsMipSolver.cpp 74.35% 20 Missing ⚠️
highs/mip/HighsMipSolverData.cpp 50.00% 16 Missing ⚠️
highs/presolve/HighsPostsolveStack.h 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #3219      +/-   ##
==========================================
- Coverage   73.04%   73.03%   -0.02%     
==========================================
  Files         445      445              
  Lines      107591   107676      +85     
  Branches    17250    17259       +9     
==========================================
+ Hits        78591    78639      +48     
- Misses      28724    28761      +37     
  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.

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

@jajhall, thanks for this!

Comment thread highs/lp_data/Highs.cpp
Comment thread highs/mip/HighsMipSolver.cpp Outdated
Comment thread highs/mip/HighsMipSolver.cpp Outdated
Comment thread highs/presolve/HighsPostsolveStack.h Outdated
double report_col_value = kHighsInf;

// Lambda for logging the solution for a specific column whenever its value
changes auto reportColLogging = [&](const HighsInt reduction) {

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.

changes belongs to previous line?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Corrected now

Comment thread highs/presolve/HPresolve.cpp Outdated
Comment thread highs/presolve/HighsPostsolveStack.h Outdated
Comment thread highs/presolve/HighsPostsolveStack.h Outdated
if (lp->integrality_[i] == HighsVarType::kInteger)
updateViolation(fractionality(value), i, num_integrality_violations,
integrality_violation, col_of_max_integrality_violation);
updatePrimalViolation(value, i, is_column);

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.

Just pass true here?

}
bool is_column = false;
for (HighsInt i = 0; i != lp->num_row_; ++i)
updatePrimalViolation(row_value_p[i], i, is_column);

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.

And pass false here? (And remove is_column altogether.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I feel that it's clearer to pass a named identifier than just true/false

@jajhall
jajhall merged commit 7e32b8e into latest Aug 18, 2026
534 of 536 checks passed
@jajhall
jajhall deleted the presolve-postsolve-debug-utilities branch August 18, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants