Skip to content

perf: resume the affine candidate scan from the fold's lowest rewritten factor#960

Open
rasros wants to merge 1 commit into
mainfrom
perf/affine-incremental-scan
Open

perf: resume the affine candidate scan from the fold's lowest rewritten factor#960
rasros wants to merge 1 commit into
mainfrom
perf/affine-incremental-scan

Conversation

@rasros

@rasros rasros commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Advances #937 (steelmillslab).

What changed

  • The affine-elimination candidate scan resumes from the lowest factor id a fold rewrote, instead of restarting at 0 on every elimination.

Why

findAffineCandidate walks the live factors in stable-id order and is called once per elimination, so the loop was O(eliminations · factors). A fold only changes the content of the factors it rewrites (the pivot's occurrences), so no factor below their minimum id can newly become a candidate — everything below is a confirmed non-candidate, unchanged since it was last examined. Resuming the scan from that minimum keeps the exact lowest-id selection order (so the eliminations are unchanged) while turning the loop into O(factors + Σ rewrites). steelmillslab presolve drops from ~490ms to ~410ms (under 0.5s at budget=0); the alias rename rewrites the whole set, so it still rescans from 0.

Testing

  • Byte-identical presolve oracle (dry-run-presolve, budget=0) across all 130 mzn-bench instances.
  • Bench-parity solve on the budget-truncated instances: ma-path-finding, oocsp, steelmillslab, bus_scheduling all produce an identical solution stream; no wrong-optimum.

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