Skip to content

Add experimental A* and CABS search - #256

Open
zayenz wants to merge 63 commits into
feature/open-cpfrom
feature/open-search
Open

zayenz wants to merge 63 commits into
feature/open-cpfrom
feature/open-search

Conversation

@zayenz

@zayenz zayenz commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Add experimental A* and complete anytime beam search (CABS) for ordinary Gecode Space subclasses. Stacked on #248.

Both engines use a bound on the total objective to prune search. An optional ranking function guides exploration without affecting pruning. A* selects pending spaces by bound or rank; CABS keeps a beam at each depth and repeats with wider beams when discarded candidates could still improve the best solution. CABS also accepts model-defined dominance between candidates in the next layer.

Both engines support parallel search through Options::threads and dynamic worker control. Their builders can be combined with BAB in PBS portfolios. As with BAB, next() returns improving solutions; the astar(...) and cabs(...) helpers return the best solution found before exhaustion or a stop.

Fifteen-puzzle and TSPTW demonstrate the engines. TSPTW compares a closed CP model with a transition model that extends the route one city at a time, using BAB, A*, or CABS. It includes one small runnable input. Correctness tests use Gecode's native test suite.

Enable with GECODE_ENABLE_EXPERIMENTAL=ON or --enable-experimental; the preview is disabled by default. Preview APIs may change or be removed in future feature releases.

Validation: focused open-list, heuristic-search, preparation, and PBS tests passed under ASan/UBSan and with static mimalloc 3.5.3. Development checks also compared TSPTW readers, enumerated small optima, and checked published tours. Leak detection was disabled for existing test-registration and thread-pool lifetimes.

@zayenz zayenz changed the title Add experimental heuristic search for Gecode 6.5 [Experimental work in progress] Add experimental heuristic search for Gecode 6.5 Oct 13, 2026
@zayenz
zayenz force-pushed the feature/open-search branch 5 times, most recently from 10fad23 to 4b24088 Compare October 14, 2026 12:11
@zayenz
zayenz force-pushed the feature/open-search branch from 4b24088 to 489e4c2 Compare October 15, 2026 12:49
@zayenz
zayenz force-pushed the feature/open-search branch 5 times, most recently from b599534 to bfe3f2f Compare October 15, 2026 15:10
@zayenz zayenz changed the title [Experimental work in progress] Add experimental heuristic search for Gecode 6.5 Add experimental A* and CABS search for Gecode 6.5 Oct 18, 2026
@zayenz
zayenz marked this pull request as ready for review October 20, 2026 06:50
@zayenz
zayenz force-pushed the feature/open-search branch 2 times, most recently from 5c37b18 to 2e3068c Compare October 20, 2026 20:33
@zayenz
zayenz force-pushed the feature/open-cp branch 2 times, most recently from 0e679a7 to 5fb98a6 Compare October 21, 2026 08:11
@zayenz
zayenz force-pushed the feature/open-search branch 4 times, most recently from a03e61d to ace7c7f Compare October 21, 2026 12:02
@zayenz
zayenz force-pushed the feature/open-search branch 2 times, most recently from 7c04635 to 8d491da Compare October 21, 2026 19:25
zayenz added 28 commits October 21, 2026 22:42
Zdev-Change-Id: Z689ff9f06d20fe7b5f7f5068434756cd36e2bc5ab31f2f5a01f85d07df84c2f6
Allow models to group dominance comparisons with an optional cached key. Keep the predicate authoritative under collisions and enable the key in the TSPTW transition example.

Retain parallel worker leases through admission and cleanup so exceptions cannot expose unfinished work.
Reuse incumbent copies and process failed or bound-pruned alternatives locally to reduce coordinator traffic. Check ordinary stops after at most 32 such alternatives and worker-count requests after each alternative.

Preserve stop polling while rejecting queued nodes, with focused stop and resume coverage for both pruning paths.
Track candidate positions as the heap moves, so keyed dominance replacement no longer scans the beam. Share heap maintenance between sequential and parallel CABS while leaving ranking and dominance decisions in the engines.

Validated with the existing search checks in Release and ASan/UBSan builds, temporary heap mutation probes, independent review, and paired benchmarks.
Submit up to eight successful siblings per frontier lock while preserving original-choice continuation and active leases through disposal. Keep single-child admission for A* and quota-limited CABS.

Validated with Release and ASan/UBSan search checks, temporary stop/pause/exception probes, independent review, paired measurements, and separate contention profiles.
@zayenz
zayenz force-pushed the feature/open-search branch from fe151fe to 5c83ea5 Compare October 21, 2026 20:44
@zayenz zayenz changed the title Add experimental A* and CABS search for Gecode 6.5 Add experimental A* and CABS search Oct 21, 2026

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