Skip to content

Improve scaling of cover_transversal - #98

Merged
timholy merged 2 commits into
mainfrom
teh/bulk-finish
Oct 25, 2026
Merged

timholy merged 2 commits into
mainfrom
teh/bulk-finish

Conversation

@timholy

@timholy timholy commented Oct 25, 2026

Copy link
Copy Markdown
Member

On large sparse matrices, cover_transversal was many times slower than cover_min. This doesn't eliminate the gap, but it goes far in addressing it (TT = "transversal-tight"):

┌─────────────────────────┬──────────────────────┬───────────────────┐
│          case           │        before        │       after       │
├─────────────────────────┼──────────────────────┼───────────────────┤
│ TT n=31623, three seeds │ 12.5 / 11.3 / 11.2 s │ 5.6 / 5.6 / 6.1 s │
├─────────────────────────┼──────────────────────┼───────────────────┤
│ TT n=10000, two seeds   │ 1.55 / 1.45 s        │ 0.96 / 0.93 s     │
├─────────────────────────┼──────────────────────┼───────────────────┤
│ TT n=3162               │ 0.20 s               │ 0.17 s            │
├─────────────────────────┼──────────────────────┼───────────────────┤
│ cover_min n=31623       │ 2.69 s               │ 2.09 s            │
└─────────────────────────┴──────────────────────┴───────────────────┘

It also provides a modest speedup to cover_min.

The finish of `_polish_difference_qp` added one constraint per step, so
a seed far from the minimizer cost hundreds of Laplacian factorizations.
Bulk steps now add, in one step, the violated constraints (most violated
first) that extend the active forest. A primal-dual active-set step
(activate all of them, then drop the constraints whose multipliers turn
negative) is kept when it raises the dual function. Otherwise the
constraints are added by moving along the segment to the tight minimizer
of the enlarged forest, interpolating the multipliers linearly; this
keeps stationarity and raises the dual function, and the move stops
where a multiplier reaches zero. Bulk steps repeat while the number of
violated constraints falls, within a `maxbulk` budget, and resume after
a single-constraint step that leaves more than 8 violations.
Goldfarb–Idnani steps then certify the result as before.

On sparse lognormal transversal problems with poor seeds, finish steps
drop from 761 to 286 (n = 3162) and from 1149 to 487 (n = 10000); on
random difference problems in general position, from 970 to 23.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Fable 5.1 <noreply@anthropic.com>
Each stage of `_abslog2_auglag` runs LSQR with tolerance `LSQR_FORCING`
(1e-3) times the KKT residual of the previous update, capped at
`LSQR_ATOL_MAX` (1e-6) and floored at the full-accuracy tolerance
`_lsqr_atol`; the unweighted start solve uses the full-accuracy
tolerance. The Newton steps of the multiplier iteration need no more
accuracy than this: on sparse lognormal matrices (full diagonal plus
five lognormal entries per row) at n = 31623, LSQR iterations per solve
fall from about 35 to 8 while the number of solves rises from about 245
to 290.

When the active-set finish follows (`zeroslack=false`), two consecutive
updates at the penalty cap that contract the KKT residual by less than
a factor of `AL_CAP_CONTRACTION` (3) end the iteration; a stage that ran
out of inner iterations is skipped. The finish resolves the remaining
constraints in fewer solves than further updates would.

`cover_transversal` on three such matrices at n = 31623 drops from
12.5/11.3/11.2 s to 5.6/5.6/6.1 s, and at n = 10000 from 1.5 to 0.95 s;
`cover_min` at n = 31623 drops from 2.7 to 2.1 s. All runs converge and
certify.

Assisted-by: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.01325% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.34%. Comparing base (8d65af1) to head (8e7b6ba).

Files with missing lines Patch % Lines
src/active_set.jl 98.58% 2 Missing ⚠️
src/minimal_covers.jl 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #98      +/-   ##
==========================================
- Coverage   98.74%   98.34%   -0.41%     
==========================================
  Files          25       25              
  Lines        7406     7538     +132     
==========================================
+ Hits         7313     7413     +100     
- Misses         93      125      +32     

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

@timholy
timholy merged commit 87395a7 into main Oct 25, 2026
5 of 7 checks passed
@timholy
timholy deleted the teh/bulk-finish branch October 25, 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.

1 participant