Skip to content

Add helper functions to compute centring ratio and num of bounds near… - #3463

Draft
filikat wants to merge 1 commit into
latestfrom
analytic-centre-check
Draft

filikat wants to merge 1 commit into
latestfrom
analytic-centre-check

Conversation

@filikat

@filikat filikat commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add two helper functions to assess the centrality of a point.
These can be used to assess whether the analytic centre solution is well centred, before using it in the heuristic.

  • primalDualCentringRatio mimics IPX's internal check during the centring phase. It doesn't have access to the IPX internal solution format though, so the computed ratio may differ from what IPX computed. It returns a ratio that should be small (say <100) for well centred points. However, this is a primal-dual metric, while the MIP heuristic only uses the primal solution (col_value), so using this ratio may be too conservative.
  • numNearlyActiveBounds computes the number of bounds that are almost active, based on a tolerance. This should be much larger than the tolerance of IPX, say 1e-4. If it returns a number larger than zero, then there are variables that are close to their bounds and the points should not be used for the heuristic.

I'm not sure which one is better to assess the solution of the analytic centre, but I think that either of them is better than just looking at the centring status. Running test issue-3451 on my mac, the centring calculation succeeds, but both helper functions reject the point (primalDualCentringRatio returns infinity, numNearlyActiveBounds returns 1).

@fwesselm @Opt-Mucca I'm not sure where to go from here. Maybe we need to do some tests.

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)

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.09%. Comparing base (63e0f00) to head (8a42e71).
⚠️ Report is 1 commits behind head on latest.

Files with missing lines Patch % Lines
highs/lp_data/HighsSolution.cpp 0.00% 55 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #3463      +/-   ##
==========================================
- Coverage   75.13%   75.09%   -0.04%     
==========================================
  Files         460      460              
  Lines      112194   112249      +55     
  Branches    17788    17800      +12     
==========================================
- Hits        84298    84296       -2     
- Misses      27614    27671      +57     
  Partials      282      282              

☔ 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

Copy link
Copy Markdown
Collaborator

Thanks, @filikat!

I would be fine with reverting the changes in #3456 and using the new functionality this PR provides instead.

Is there any benefit from reporting the CentringStatus (HighsInfoStruct) to users? If so, we could also keep the current code.

@filikat

filikat commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator Author

Centring is not documented, so it's probably better not to report its status.

@Opt-Mucca

Copy link
Copy Markdown
Collaborator

I've got no strong opinion here aside from preferring any additional guardrails. Wouldn't we need to keep the status regardless though, or would we trust a failed centering call that happens to pass our center-like checks?

@filikat

filikat commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

We can discuss this Thursday. I am not sure of what is actually important for the MIP heuristic, because it only seems to use the primal analytic centre, so having a good quality primal-dual centre (what IPX does) may be overkill.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants