Skip to content

perf: rebuild presolve as an incremental delta-based bake#950

Merged
rasros merged 11 commits into
mainfrom
perf/incremental-bake
Jul 3, 2026
Merged

perf: rebuild presolve as an incremental delta-based bake#950
rasros merged 11 commits into
mainfrom
perf/incremental-bake

Conversation

@rasros

@rasros rasros commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Part of #937.

What changed

  • Presolve runs on a persistent PresolveSession: a stable-id factor set with tombstones and one persistent PropagationState, instead of rebuilding a Problem per firing pass.
  • Passes emit an explicit delta (drop-by-id, add factors, tighten domains); the session applies it and re-propagates incrementally via the dirty-var/watcher machinery, never a from-scratch computeBaked.
  • Bake-time probing moved out of the Problem kernel into presolve.RootBaker behind a seedDeductions seam; the six probe flags become a BakeConfig.
  • Problem gains a preFolded pass-view mode that defers propagators/occurrences/baked; the solver Problem is materialized once at the end.
  • Affine and dup-columns read the session's incrementally-maintained int occurrence index instead of rebuilding it every round.

Why

Presolve rebuilt a fresh Problem (occurrence invert + full bake) after every firing pass, so cost scaled with passes x factors; ma-path-finding took ~1.6s at budget=0.

Testing

  • Byte-identical presolve oracle over the 130 mzn-bench instances (dry-run-presolve, budget=0): factor counts, passes fired, folded domains and proven-infeasible are identical to the from-scratch path.
  • Bench-parity solve on the budget-truncated instances (cp-single): same optimum / status as presolve off.

Notes

  • 123/130 presolve under 0.5s at budget=0; prop_stress drops 7.5s to 0.2s. Seven large instances stay 0.5-1.5s, bounded by inherent per-pass work (subsume and affine eliminations, wide-domain re-propagation), not the bake.
  • The feat: bound the presolve phase with a configurable wall-clock budget #945 presolve budget is left in place as the backstop for those seven; removing it is a follow-up gated on making the passes themselves incremental across rounds.

@rasros rasros merged commit b63ad71 into main Jul 3, 2026
2 checks passed
@rasros rasros deleted the perf/incremental-bake branch July 3, 2026 15:12
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