Skip to content

Allow slightly asymmetric square Hessians, and revert to using HighsHashTable (mainly) In assessMatrix#2984

Merged
jajhall merged 6 commits intolatestfrom
fix-2979
Apr 21, 2026
Merged

Allow slightly asymmetric square Hessians, and revert to using HighsHashTable (mainly) In assessMatrix#2984
jajhall merged 6 commits intolatestfrom
fix-2979

Conversation

@jajhall
Copy link
Copy Markdown
Member

@jajhall jajhall commented Apr 20, 2026

Added a test on the difference between corresponding off-diagonal entries in a square Hessian, allowing them to differ by 1e-10. This should close #2979

Reverted to using HighsHashTable (mainly) In assessMatrix to identify duplicate entries in a matrix column/row, unless a Hessian is being assessed (so duplicate entries are summed) when an unordered_map is used. This closes #2977

@jajhall jajhall requested a review from odow April 20, 2026 23:47
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 95.89041% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.31%. Comparing base (0a9e7ca) to head (4816a03).
⚠️ Report is 12 commits behind head on latest.

Files with missing lines Patch % Lines
highs/model/HighsHessianUtils.cpp 86.95% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           latest    #2984   +/-   ##
=======================================
  Coverage   81.30%   81.31%           
=======================================
  Files         359      359           
  Lines       88792    88852   +60     
=======================================
+ Hits        72196    72253   +57     
- Misses      16596    16599    +3     

☔ View full report in Codecov by Sentry.
📢 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.

HighsInt num_summation = 0;
HighsInt num_upper_triangle = 0;
HighsInt num_hessian_el = 0;
const double kSquareHessianAsymmetryTolerance = 1e-10;
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.

Open question whether to hard-code this or make it an option.

The argument in favour of this hard-coding is that anyone wanting to change it needs a really good reason, and they should almost certainly just use the triangular input.

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'd rather hard code it, as you do in JuMP.

If the difference is larger than 1e-10 due to inexact arithmetic, then users should be aware and handling it themselves

Comment thread check/TestFilereader.cpp
}
if (dev_run) {
tt += getWallTime();
printf("Added %d rows individually in %.2gs\n", int(lp.num_row_), tt);
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.

Did you benchmark the before/after or should I do it with the Julia example?

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.

When loading the LP neos row-by-row, It's about 3x faster with the two current ways of tracking duplicates than with 1.14. Using HighsHashTable (as before 1.14) is slightly faster than unordered_map (unsurprisingly) so I left that as the default - unless duplicates need to be summed

@jajhall jajhall merged commit 052d6ab into latest Apr 21, 2026
391 of 392 checks passed
@jajhall jajhall deleted the fix-2979 branch April 21, 2026 08:55
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.

2 participants