Skip to content

Rewrite 1 - #3810

Closed
galabovaa wants to merge 1 commit into
cupdlp-csparsefrom
cupdlp-csparse-rewrite-1
Closed

galabovaa wants to merge 1 commit into
cupdlp-csparsefrom
cupdlp-csparse-rewrite-1

Conversation

@galabovaa

@galabovaa galabovaa commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Summary

This PR replaces the bodies of ipx::DepthFirstSearch and ipx::AugmentingPath with new implementations, so that IPX no longer contains code that follows cs_dfs.c and cs_augment.c from CSparse. The CSparse/Davis citations are removed. AugmentingPath now cites the original algorithm: Duff, "On algorithms for obtaining a maximum transversal", ACM TOMS 7 (1981).

Changes

DepthFirstSearch is an iterative depth-first search.

  • istack[0..depth] holds the current path and work[d] is where the scan of node istack[d] resumes.
  • Finished nodes are written below top, so the output is in reverse postorder.
  • The interface is unchanged.

AugmentingPath is a depth-first search for an alternating path, with a "cheap assignment" check whenever a column is first visited.

  • Interface change: the three workspace arrays work (size m), work2 and work3 (size m+1 each) are replaced by one work array of size 2*(m+1).

  • Each path level stores its column and resume position. The row the path leaves through is recovered as Ai[pos-1], so the rows don't need their own stack.

  • The callers in guess_basis.cc and symbolic_invert.cc are updated for the new signature.

Testing

Function-level: I compared the new code with the original on 30,000 random sparse matrices of up to 300×400, including excluded rows, columns with no entries and repeated markers. Every output matched exactly after every call:

  • DepthFirstSearch: 678,766 calls; return value, output order and marks.
  • AugmentingPath: 1,292,117 calls; return value, jmatch, cheap and marked.
  • This ran under the address and undefined-behaviour checkers with no reports.

End to end: IPX with crossover, single-threaded, gives identical logs to the original on all 93 deterministic instances under 3 MB in check/instances, once timings are removed. I left out issue-3166, a MIP that hits the time limit.

unit_tests: all 527 test cases pass.

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 Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.14815% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.14%. Comparing base (bb0e6f5) to head (0f82f69).

Files with missing lines Patch % Lines
highs/ipm/ipx/symbolic_invert.cc 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           cupdlp-csparse    #3810      +/-   ##
==================================================
- Coverage           76.15%   76.14%   -0.02%     
==================================================
  Files                 467      467              
  Lines              116789   116702      -87     
  Branches            18144    18136       -8     
==================================================
- Hits                88946    88867      -79     
+ Misses              27603    27595       -8     
  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.

@galabovaa galabovaa closed this Nov 26, 2026
@galabovaa
galabovaa deleted the cupdlp-csparse-rewrite-1 branch November 26, 2026 15:18
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.

1 participant