planning-heuristics
Goal-distance heuristics for classical planning tasks in sas-plus's
finite-domain representation: the delete-relaxation family (h_max, h_add, h_FF, h_sa, h²), red-black
planning, landmarks with count, uniform and optimal cost partitioning, LM-cut, operator counting and adapters for
abstraction heuristics. The crate is no_std with alloc (only the LP-based heuristics behind the lp feature need
std), and every state heuristic implements search-core's Heuristic
trait, so it plugs into any search crate built on it.
The red-black implementation follows Katz, Hoffmann & Domshlak (2013) and Domshlak, Hoffmann & Katz (2015) closely
and was checked against both papers rule by rule, including every painting strategy they describe. The admissible
heuristics (h_max, LM-cut, landmark cost partitioning, h², operator counting, abstractions) are tested against
exact goal distances computed by brute force. One shared Relaxation is Sync, so a parallel search can build it
once and hand each thread its own heuristic.
Part of the planning and search crates; see also this crate's overview page.
Who this is for
- Planning researchers who want to compare heuristics on the same task representation without porting Fast Downward's C++, or who need a reference implementation of red-black planning or RHW landmarks to check their own against.
- Anyone building a classical planner in Rust: pick
h_FFor red-black for satisficing greedy search, LM-cut or landmark cost partitioning for optimal A*, and LAMA-style landmark tracking for path-dependent search. - Embedded and robotics teams that plan onboard: the crate runs on
no_stdtargets with an allocator. - If the problem is a plain graph rather than a factored planning task, an explicit-state search with a domain-specific heuristic in heuristic-search is the better fit.
- For merge-and-shrink abstractions or saturated cost partitioning themselves, use
merge-and-shrink and
cost-partition; this crate only adapts them to the
Heuristictrait.
Installation
[]
= "0.1"
Usage
use ;
use ;
// One binary variable, one operator that sets it, goal `v0 = 1`.
let task = Task ;
let state = task.initial_state;
// Each heuristic owns its relaxation ...
assert_eq!;
// ... or borrows a shared one; one heuristic per thread, the relaxation is `Sync`.
let relaxation = new;
let mut h_add = with_relaxation;
let mut h_ff = with_relaxation;
assert_eq!;
assert_eq!;
Scope
h_max,h_addandh_FFwith relaxed plan extraction and preferred operators (delete relaxation); the set-additiveh_sa; additiveh_maxover an operator partition;h²- Red-black heuristic
h_RB(Katz, Hoffmann & Domshlak 2013; Domshlak, Hoffmann & Katz 2015), checked against the papers: relaxed plan repair (optionally forwarded) or red facts following, every painting strategy of the papers (L, A, C, their inverses, C[N], CA[p], RND) for an arcless or acyclic black causal graph over RSE-invertible variables (where it succeeds, up to an operator budget for DAGs), greedy and explicit paintings, product search for a few black variables with any causal graph, a stop-search check;h_FFfallback outside the fragments h^1fact landmarks with natural orderings, and RHW back-chained landmarks with disjunctive and DTG landmarks, greedy-necessary and reasonable orderings; landmark count (inadmissible) and uniform landmark cost partitioning (admissible); optimal landmark cost partitioning by LP (featurelp)- LAMA-style landmark tracking along the search path (
PathHeuristic,LandmarkTracker), inadmissible count, admissible uniform cost partitioning, or optimal cost partitioning (OptimalLandmarkTracker, featurelp) - LM-cut (
h_LM-cut), admissible, with axioms, and conditional effects by context splitting; also from seeded start costs per fact and per-call operator costs (LmCut::value_seeded) - The relevance score
h_Ξ(Kim & Sridharan 2024), landmark-like and inadmissible, over a partially explored backtracking tree - Goal-intention ranking keys
ol_rp/op_rp(Rosa et al. 2026) from sampled relaxed plans, with a path tracker (IntentionTracker) - Abstraction heuristics: any
sas_plus::Abstraction, pattern databases oversas_plus::Projection, and (optional features) merge-and-shrink and saturated cost partitioning
Deliberate omissions (succinct macro plans and black derived variables in red-black, among others) and open points are listed in docs/design.md.
The Heuristic trait, heuristic_fn and HeuristicFn are
search-core's, re-exported from the crate root, so
these heuristics plug into every search crate built on it.
Features
merge-and-shrink:GoalDistanceformerge_and_shrink::MergeAndShrinkHeuristic; wrap it inAdapterto get aHeuristic.cost-partition: the same forcost_partition::CostPartitionedHeuristicandMaxOverOrders.lp:OptimalLandmarkCostandOptimalLandmarkTracker, the optimal landmark cost partitioning per state and along the search path, andOperatorCounting, the state equation with LM-cut constraints, solved with the pure-Rustmicrolp. It needsstd.
MSRV
Rust 1.86 for the library, with every feature. Tests and benches may need a newer Rust.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Contributing
See CONTRIBUTING.md.