Skip to content

Reduce connectivity separation and preprocessing overhead - #49

Merged
berendmarkhorst merged 4 commits into
mainfrom
perf/reduce-cut-separation-overhead
Sep 5, 2026
Merged

berendmarkhorst merged 4 commits into
mainfrom
perf/reduce-cut-separation-overhead

Conversation

@berendmarkhorst

Copy link
Copy Markdown
Owner

Summary

Repeated per-terminal maximum flows, sparse-matrix allocations, quadratic terminal bottleneck storage, and repeated dual ascent were dominating Python-side solver time. This PR reduces that work while keeping maximum-flow fallback and exact-solve certification.

  • Screen satisfied connectivity demands with one traversal; use capacity-checked, deduplicated connectivity cuts for integer candidates. Keep minimum cuts in LP separation, including main's nested cuts for remaining demands.
  • Skip residual construction for satisfied flows, extract cuts with NumPy, and default separation to one configurable worker. Correct the NetworkX fallback's source partition by completing the flow first.
  • Replace the quadratic terminal bottleneck table with a lazy O(T log T) tree-path index and reuse the final unchanged preprocessing ascent once after validating its inputs.
  • Use compiled bounded Dijkstra for long-edge reduction where graph size/density justify it and the existing node-search cap cannot bind. Preserve deterministic deletion order.

Integrated with main at 7b4142e, preserving enumeration-safe preprocessing, terminal contractions, the few-terminal DP, cut aging, primal portfolio options, and solve-status handling. No new runtime dependency.

Validation and performance

  • Full integrated suite: 1,140 passed, 26 skipped, 20 xpassed, 92% coverage. Independent graph oracles cover cut validity/completeness, indexed bottlenecks, and native long-edge deletions; mutation tests cover ascent reuse.
  • Sphinx HTML documentation builds with explicit version metadata overrides for the local environment.
  • Current-main measurements and reproduction details: PR_VALIDATION.md. Earlier profiling rounds and raw observations are also committed; their baselines predate recent main improvements.

Latest comparison: 108 solves, all at the known optimum with zero gap. Median total runtimes against main 7b4142e:

Configuration Main PR Speedup
c13, default 4.279 s 2.500 s 1.71×
d08, accelerated 9.079 s 2.700 s 3.36×
d13, accelerated 11.064 s 2.936 s 3.77×
d15, default 1.254 s 0.405 s 3.09×

Changing cut selection can change Gurobi's search tree. The report includes unchanged cases and regressions; local timings do not establish a general speed guarantee or parity with SCIPJack. Residual-flow reuse and further certificate-allocation reductions are left for separately benchmarked work.

AI assistance: Codex assisted with implementation, profiling, tests, documentation, and PR preparation.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 97.90576% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
steinerpy/graph_reducer.py 97.82% 2 Missing ⚠️
steinerpy/mathematical_model.py 96.72% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@berendmarkhorst
berendmarkhorst merged commit 5f49a67 into main Sep 5, 2026
6 checks passed
@berendmarkhorst
berendmarkhorst deleted the perf/reduce-cut-separation-overhead branch September 5, 2026 15:36
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