Skip to content

Add open variable lists - #248

Draft
zayenz wants to merge 25 commits into
mainfrom
feature/open-cp
Draft

zayenz wants to merge 25 commits into
mainfrom
feature/open-cp

Conversation

@zayenz

@zayenz zayenz commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Add open variable lists whose final length is decided during propagation and search. length() controls that extent, known_length() counts constructed positions, and get() materializes requested positions. Includes OpenIntVarList, OpenBoolVarList, and a generic OpenVarList<Var> with a variable factory.

Constraints follow the growing prefix, including distinct, relations, sliding windows, min/max, precedence, and regular-language constraints. Regular constraints accept extendable prefixes while the list is open and require acceptance on closure. Distinct is value consistent; min/max enforce attainment when the list closes.

Branching uses standard variable and value selectors to assign the current prefix, then tries closing before extending. Length-first search uses an ordinary brancher on length() posted before the list brancher. Action and CHB selectors require full materialization when posted. Factories and transition callbacks run in the current space and must support concurrent calls across clones.

Open-list materialization and transition callbacks, including direct append(), use Space::NoGPI by default. Propagator information is stored in the space and released with it; these propagators have zero AFC. Callbacks can use Space::UseGPI for selected postings that need ordinary AFC. Nested list construction enters its own NoGPI scope, and each scope restores the previous setting on exit. The kernel support comes from #257.

The main example, common-pattern, mines frequent ordered subsequences subject to minimum length, required items and a regular language. Default DFS enumerates qualifying patterns; BAB finds a maximum-length qualifying pattern. It accepts support percentages and letter, positive integer, or singleton-itemset SPMF databases. Each record contributes at most one support unit. Open lists represent actual pattern positions without an end marker or padded suffix variables. A private prefix-projection propagator handles support and returns its exact count for completed patterns; ordinary CP constraints express the pattern restrictions. Supporting suffixes are compacted, immutable last-occurrence indexes avoid scanning repeated items, and unchanged prefixes reuse filtering results. The smaller open-route introduction demonstrates routes of varying lengths, cloning, printing, and incremental or length-first search.

The comparison under misc/common-pattern/ covers open and padded projection, a paper-style CP2015 PREFIX-PROJECTION reimplementation, and all-input DFA baselines. It uses equivalent mining queries, the paper's worked database and regular expressions, independent solution-set validation where bounded, and resumable measurements. Its documentation traces earlier and later sequential-mining approaches and distinguishes representation, support computation, embedding constraints and output queries. The example does not implement multi-item itemsets, gap/time constraints, closed-pattern mining or top-k by support. The comparison models share initial pruning and suffix operations. The paper-style variant implements the CP2015 filtering rules rather than reproducing the authors' original executable. Public Bible and Leviathan copies match the paper's reported database statistics; byte identity with its inputs and equivalence of historical timing boundaries are not established.

Serial Release measurements on the public Bible database enumerate all 23,340 patterns at 1% support, with exact agreement against independent SPMF PrefixSpan output. Median open-model time falls from 8.36 to 4.12 seconds; padded-model time falls from 8.27 to 4.41 seconds. A controlled repeated-item database shows the open model about 2.4 times faster even with the tighter valid length bound. A required-item query favours padding (7.15 seconds versus 17.13 seconds open); the documentation explains the filtering difference. These results support the example while documenting where open construction does and does not help.

Validation on macOS:

  • Debug build and all 7 CTest entries passed during the library review.
  • All 42 focused open-list/open-regular tests passed with 10 iterations in debug and ASan/UBSan builds. LeakSanitizer is unavailable on this macOS platform.
  • Existing-harness regression coverage includes value-choice replay, ordinary length-brancher composition, cloning, callbacks, no-goods, propagator groups, projection enumeration, growth and input/support arithmetic. No CMake test changes.
  • Both open-route branching modes enumerate the five documented simple routes.
  • The revised example passed 60 independent DFS/BAB query checks. The paper's Table 1 query enumerates the nine expected patterns.
  • Independently compiled comparison models passed 165 variant/oracle checks across 43 bounded cases, plus nine positive named-language checks. Real SPMF collection, resume, configuration mismatch, error, timeout and invalid-result handling passed.
  • The final performance changes passed 54 independent exhaustive smoke checks and 54 timed invocations across 100%, 50% and 25% support. Earlier comparison records remain readable and are labelled as historical measurements.
  • All final Bible comparison queries match independent PrefixSpan pattern sets. The example executable also matches all 23,340 patterns and their support counts at 1%. The existing Gecode test harness checks the returned support variable against an independent scan.
  • Reference input validation and unchanged-run resume passed; an unchanged resume adds no measurements.
  • Independent Astra high reviews, repository tidy and whitespace checks passed.
  • The latest API naming/style update passed an independent review and focused recheck, all 42 focused tests in debug and ASan/UBSan, and 54 benchmark oracle checks plus 54 timed smoke invocations. Ruff formatting/lint and ty checks pass. The broader sanitizer CTest run aborted in FlatZincErrorTest::run() during standard brancher construction; a complete sanitizer-suite pass is not established.

The NoGPI integration passed 45 focused AFC, open-list and regular-language checks and 10 independently checked puzzle cases. The stacked search branch also passed 54 checks with CBS and fully instrumented ASan/UBSan, plus 12 puzzle cases with clean sanitizer output. Independent review found no required corrections.

Includes a 6.5.0 changelog entry. Linux and Windows release validation remains to be run.

@zayenz
zayenz changed the base branch from main to feature/improved-regular-construction October 4, 2026 18:18
@zayenz zayenz changed the title Add open integer variable sequences and constraints Add open variable sequences Oct 5, 2026
@zayenz
zayenz added this pull request to stack #250 October 5, 2026 13:21
@zayenz zayenz changed the title Add open variable sequences Add open variable lists Oct 6, 2026
Base automatically changed from feature/improved-regular-construction to main October 8, 2026 17:43
Construct boards through an OpenIntVarList path transition and compare
with a bounded array model using the same slide and goal rules. Minimize
moves with BAB, and expose independent scramble, seed, and move-limit
options. Keep the default move limit at twelve for a short demonstration.

Register the example in CMake and Autoconf, including its generated
include dependencies, and document state-versus-move length accounting.

Validated both models in Debug and ASan/UBSan builds with the defaults,
an explicit scramble/limit/seed case, a solved start, and an insufficient
move bound. Replayed every printed path to verify legal slides and the
goal board. Independent Astra review passed.
Wait for the current board to become assigned before closing or extending
the path. Keep callback captures limited to the state index and retrieve
the model from the supplied space. Remove the initial Manhattan lower
bound on length to avoid constructing future boards at the root.

Both models pass small explicit, solved-start, and insufficient-limit
cases in Debug and ASan/UBSan builds. Printed paths were replayed, and a
root diagnostic confirms two constructed boards for scramble20/limit32,
seed3. Independent focused review passes.

The open default now exceeds a 30-second Debug cutoff because delayed
goal detection removes early backward goal propagation. Its usability
needs a separate coordinated follow-up; no extra pruning rule is included
in this model correction.
Reject assigned boards whose Manhattan distance cannot fit the current
path upper bound. Recheck this condition after incumbent cuts, taking
care not to read a board before propagation assigns it. Force the goal
when a constructed board reaches the final permitted state.

Keep path growth lazy: these checks do not increase its minimum length
or construct future boards. The fixed model and shared slide rules stay
unchanged.

Focused Debug and ASan/UBSan runs pass for defaults, explicit options,
a solved start and an insufficient move limit. Printed paths were
replayed. The default open model completes in 39 nodes, and the root
probe still constructs two boards for scramble20/limit32/seed3.
Independent Astra recheck passes.

This branch has not been deployed

No deployments
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