Skip to content

perf: fold wide-sparse domain reductions as compact survivor sets#958

Open
rasros wants to merge 1 commit into
mainfrom
perf/bitset-scattered-domains
Open

perf: fold wide-sparse domain reductions as compact survivor sets#958
rasros wants to merge 1 commit into
mainfrom
perf/bitset-scattered-domains

Conversation

@rasros

@rasros rasros commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Record a wide-but-sparse bake reduction as its surviving-value set instead of one interior hole per excluded value, in the bake diff, the domain fold, and the seed apply. All three are O(survivors), not O(span).
  • Add restrictIntToSurvivors and propagateAtomsForSetRestriction, which wake the affected order/eq atoms off the value-sorted atom index in O(survivors + eq-atoms).
  • Gate the survivor form on a span past bitsetThreshold; narrower reductions keep the plain hole path, whose holes are few and which carries the pre-existing-seed dedup.
  • Prefer a bitset over a survivor array when it is memory-neutral, for O(1) contains.
  • Move EmptyIntArray / EmptyLongArray from Factor to util.

Why

liner-sf-repositioning finishes presolve over 1s because the bake folds Element-GAC-reduced domains through SurvivorsDomain.forEachHole, which is O(span) over domains spanning millions for a handful of survivors (#938). Recording the survivors directly drops liner-sf presolve to ~0.76s and proteindesign/is/tdtsp by 5-11%.

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 and oocsp still prove their exact optimum with identical assignments; liner-sf's anytime incumbent differs only by search-path divergence.

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