Skip to content

Add experimental A* and CABS search - #256

Open
zayenz wants to merge 5 commits into
mainfrom
feature/open-search
Open

zayenz wants to merge 5 commits into
mainfrom
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.

Guidance (an optimistic objective bound, an optional rank, and optional CABS dominance) is passed through Search::Options::guidance, so AStar<T>(s,o) and CABS<T>(s,o) have the same shape as BAB<T> and run directly with Script::run. The driver forwards Options::guidance(). CABS limits are Search::Options::max_width and frontier_limit. As with BAB, next() returns improving solutions.

Both engines support parallel search (Options::threads), dynamic worker control, and PBS portfolios with BAB. Open nodes, layers and beams use Gecode's Support containers; the shared pieces (node order, incumbent, A* queue, CABS beam) are in gecode/search/heuristic.hh, and parallel A* and CABS are small subclasses of Par::Frontier.

Commits:

  1. An option for experimental preview APIs (CMake, Autoconf, CI).
  2. Experimental changelog grouping.
  3. The A* and CABS engines, driver integration, and tests.
  4. Portfolio fix: a CABS asset that stops at its width or node limit no longer stops sequential or parallel portfolios. Search::Engine::limited() (experimental) reports such local limits; portfolios retire the asset and report an incomplete search once all assets are done. Other assets are handled as before. Sequential PBS also no longer takes a stop after a finished slice for the end of the slice.
  5. fifteen-puzzle gains -search astar|cabs; tsptw is a new driver-based example with two inline instances and a CABS dominance check.

Makefile.dep is regenerated in the stacked #269.

Enable with GECODE_ENABLE_EXPERIMENTAL=ON or --enable-experimental; the preview is disabled by default and its APIs may change.

Review: independent zdev reviews by two models; both found the parallel-portfolio issue fixed in commit 4, and two focused rechecks verified the fix.

Testing:

  • macOS arm64, CMake Release: -tag standard 6776/6777 passed; FlatZinc::on_restart::last_val_float also fails on main and is handled in feature/6.5.0-cleanups.
  • macOS, ASan+UBSan Debug: heuristic, worker-control and portfolio tests 283/283 over 10 iterations, no sanitizer reports; -tag check 536/536 with one test thread on the previous revision.
  • Experimental OFF: -tag check 533/533.
  • Linux (GCC 15, RelWithDebInfo): -tag check 539/539, no new warnings. Valgrind on the heuristic, worker-control and portfolio tests (previous revision): 14/14; the only report is the known 78-byte leak from static test registration.

🤖 Generated with Claude Code

@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
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
@zayenz
zayenz force-pushed the feature/open-search branch 2 times, most recently from 9690a92 to e3cdb68 Compare October 22, 2026 14:05
@zayenz
zayenz force-pushed the feature/open-search branch from e3cdb68 to 3c4cc55 Compare October 22, 2026 17:18
@zayenz
zayenz force-pushed the feature/open-search branch 5 times, most recently from bbf762e to 11e7c25 Compare October 26, 2026 18:40
Base automatically changed from feature/open-cp to main October 27, 2026 11:46
@zayenz
zayenz force-pushed the feature/open-search branch 3 times, most recently from 0bc31b6 to b31ea94 Compare October 28, 2026 05:57
zayenz and others added 5 commits October 28, 2026 09:57
GECODE_ENABLE_EXPERIMENTAL (CMake) and --enable-experimental
(Autoconf) define GECODE_HAS_EXPERIMENTAL. The option is off by
default; CI builds both settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entries marked Experimental: true appear under Experimental changes in
each release, and tidy validates the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AStar and CABS (complete anytime beam search) are best-solution
engines for ordinary Space subclasses. Their guidance, an optimistic
objective bound with an optional rank and optional CABS dominance, is
passed through Search::Options::guidance, so they have the same
constructor as BAB and run with Script::run; the driver forwards
Options::guidance. Search::Options::max_width and frontier_limit bound
CABS.

Both engines support parallel search, worker control, and portfolios.
Open nodes, layers and beams use the Support containers; node order,
incumbent, A* queue and CABS beam are shared in search/heuristic.hh,
and parallel A* and CABS are subclasses of Par::Frontier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A CABS asset that reaches its width or node limit cannot continue, but
both portfolio engines took its stop for a user stop: the sequential
one kept returning without running the other assets, and the parallel
one stopped the portfolio while keeping the asset. Search::Engine::limited
now tells that an engine stopped at a local limit; portfolios remove such
an asset and report that they stopped once all assets are done. Other
assets are handled as before. The sequential engine also no longer takes
a stop after a finished slice for the end of the slice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fifteen-puzzle gains -search astar|cabs using the moves so far plus
the Manhattan distance as bound. TSPTW is a driver-based travelling
salesperson model with time windows and two inline instances; it runs
with BAB, A* and CABS, and CABS uses a dominance check on partial
tours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zayenz
zayenz force-pushed the feature/open-search branch from b31ea94 to 52ad2b6 Compare October 28, 2026 10:33

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