Expand description
§Planning heuristics
Goal-distance estimates for classical planning tasks given as sas_plus::Task.
§Implemented
HMax,HAddandHFf: the delete-relaxation heuristicsh_max,h_addandh_FF(Bonet & Geffner 2001, Hoffmann & Nebel 2001), computed with a worklist (generalized Dijkstra) overRelaxation, which also extractsRelaxedPlans and their preferred operators.HSetAdd: the set-additive heuristich_sa(Keyder & Geffner 2008);AdditiveHMax:h_maxsummed over a partition of the operator costs;H2:h²(Haslum & Geffner 2000), which sees pairs of facts.RedBlack: the red-black heuristich_RB(Domshlak, Hoffmann & Katz 2015), with the black variables chosen by aPainting: greedy, or by the papers’ strategies (Strategy) for an arcless or acyclic black causal graph (Fragment), or a few black variables searched as a product (Painting::bounded); options (RedBlackOptions) for relaxed plan forwarding and red facts following.Relaxation::landmarks:h^1fact landmarks with natural orderings (LandmarkGraph), and the heuristicsLandmarkCount(inadmissible) andUniformLandmarkCost(admissible, uniform cost partitioning); with featurelp,OptimalLandmarkCost(admissible, optimal cost partitioning by linear programming).- With feature
lp,OperatorCounting: the state equation (Bonet 2013) and LM-cut landmarks as an operator-counting LP (Pommerening, Röger, Helmert & Bonet 2014). Relaxation::rhw_landmarks: back-chained landmarks (Richter, Helmert & Westphal 2008) with disjunctive and domain-transition-graph landmarks, asOrderedLandmarkswith natural, greedy-necessary and reasonable orderings (OrderingKind).PathHeuristic: path-dependent heuristics;LandmarkTrackertracks the accepted landmarks along the search path, as LAMA’s landmark count or admissibly with uniform cost partitioning; with featurelp,OptimalLandmarkTrackerwith optimal cost partitioning. The optimal cost partitioning over LM-cut’s action landmarks isOperatorCountingwith only the LM-cut constraints (its LP dual).LmCut: the landmark-cut heuristich_LM-cut(Helmert & Domshlak 2009), admissible, with its disjunctiveActionLandmarks.AbstractionHeuristic: goal distances of anysas_plus::Abstraction, such as a pattern database over asas_plus::Projection. Featuresmerge-and-shrinkandcost-partitionimplementGoalDistancefor those crates’ heuristics, whichAdapterturns into aHeuristic.RelevanceScore: the relevance scoreh_Ξ(Kim & Sridharan 2024), landmark-like and inadmissible, over a partially explored backtracking tree.GoalIntention: goal-intention ranking keysol_rp/op_rp(Rosa et al. 2026) from sampled relaxed plans, tracked along a path withIntentionTracker.
§Example
use planning_heuristics::{HAdd, HFf, HMax, Heuristic, Relaxation};
use sas_plus::{Effect, Fact, Operator, State, Task, Variable};
// One binary variable, one operator that sets it, goal `v0 = 1`.
let task = Task {
variables: vec![Variable::new("v0", 2)],
operators: vec![Operator {
name: "set".into(),
pre: vec![Fact::new(0, 0)],
eff: vec![Effect::new(Fact::new(0, 1))],
cost: 3,
}],
initial: State(vec![0]),
goal: vec![Fact::new(0, 1)],
axioms: vec![],
};
let state = task.initial_state();
// Each heuristic owns its relaxation ...
assert_eq!(HMax::new(&task).estimate(&state), Some(3));
// ... or borrows a shared one; one heuristic per thread, the relaxation is `Sync`.
let relaxation = Relaxation::new(&task);
let mut h_add = HAdd::with_relaxation(&relaxation);
let mut h_ff = HFf::with_relaxation(&relaxation);
assert_eq!(h_add.estimate(&state), Some(3));
assert_eq!(h_ff.value(&state), Some(3_u64));Repository: https://github.com/sunsided/planning-heuristics
Structs§
- Abstraction
Heuristic - The goal distances of an abstraction as a heuristic: admissible, since every transition of the task maps to a path of at most its cost in the abstraction.
- Accepted
Landmarks - The landmarks a search path has accepted: the per-node information of a
LandmarkTracker. One bit per landmark of the tracker’s graph. - Action
Landmark - A disjunctive action landmark found by
LmCut::landmarks: every plan from the state applies at least one ofActionLandmark::ops. - Adapter
- A
GoalDistanceused as aHeuristic: forwards toGoalDistance::valueand saturates atu32::MAX, like every heuristic of this crate. - AdditiveH
Max - Additive
h_maxover a partition of the operators: for each parti,h_maxunder the costs of the operators in parti(all others cost 0), summed over the parts. - Counting
Constraints - Which constraints an
OperatorCountingheuristic uses. - Exploration
- The result of
Relaxation::explore: the cost of every fact from one state. - Goal
Intention - Fact observation probabilities for the relaxed plan observation heuristics
ol^rp(likelihood) andop^rp(posterior) of Rosa et al. (2026). - H2
- The
h²heuristic (Haslum & Geffner 2000): the cost of the cheapest regression where every set of more than two facts costs as much as its most expensive pair. Admissible, at leasth_max, and it sees deletes: two facts that no plan makes true together cost more than either alone. - HAdd
h_add(Bonet & Geffner 2001): the sum of the goal fact costs when every rule costs its operator plus the sum of its conditions. Not admissible; counts shared subgoals twice.- HFf
h_FF(Hoffmann & Nebel 2001): the cost of a relaxed plan extracted fromh_addbest supporters (seeRelaxation::relaxed_plan). Not admissible;h_max <= h_FF <= h_add.- HMax
h_max(Bonet & Geffner 2001): the cost of the most expensive goal fact when every rule costs its operator plus its most expensive condition. Admissible.- HSetAdd
- The set-additive heuristic
h_sa(Keyder & Geffner 2008): likeh_add, but each fact carries a relaxed plan, a set of operators, instead of a cost, so an operator shared by two subgoals is counted once. - Heuristic
Fn - A closure used as a
Heuristic; created byheuristic_fn. - Intention
Params - Parameters of the fact probability estimation.
- Intention
Tracker - The relaxed plan observation heuristics as a path heuristic: the observation of a path is
the set of facts its operators added (the effects that fired), its estimate the cost of
that set under
IntentionKind. Withrestart(the paper’sol^rp_randop^rp_r), the observation restarts empty at every state that lowers the goal count below all earlier states on the path. Estimates aref64(lower is better) and neverNone. - Landmark
Count - The landmark-count heuristic: the number of fact landmarks of the state that do not hold in it yet. Not admissible (one operator can achieve several landmarks) and blind to costs.
- Landmark
Graph - The fact landmarks of one state and their natural orderings.
- Landmark
Ordering - An ordering between two landmarks of an
OrderedLandmarksgraph, by index. - Landmark
Tracker - Landmark heuristics that track, along the search path, which landmarks of the start state
have been achieved (LAMA; Richter & Westphal 2010), as a
PathHeuristic. - LmCut
- The landmark-cut heuristic
h_LM-cut(Helmert & Domshlak 2009). Admissible, and never belowh_max. - Observation
- The facts observed along a path and their cost, carried by
IntentionTracker. - Operator
Counting - An operator-counting heuristic (Pommerening, Röger, Helmert & Bonet 2014): minimize the
cost
Σ cost(o) · Y_oof operator countsY_o ≥ 0that satisfy constraints every plan’s counts satisfy. Admissible. Featurelp. - Optimal
Landmark Cost - An admissible landmark heuristic: the optimal cost partitioning over the fact landmarks
(Karpas & Domshlak 2009), solved as a linear program. Feature
lp. - Optimal
Landmark Tracker - The optimal cost partitioning over the landmarks a search path still has to achieve
(Karpas & Domshlak 2009), as a
PathHeuristic. Featurelp. - Ordered
Landmarks - A landmark graph whose landmarks may be disjunctions of facts, with typed orderings.
- Painting
- A choice of black variables for
crate::RedBlack; every other variable is red. - RedBlack
- The red-black heuristic
h_RB, by default by relaxed plan repair. - RedBlack
Options - Options of
RedBlack, set withRedBlack::with_options; the default is plain relaxed plan repair. Both are ignored with aPainting::boundedpainting, which uses product search. - RedBlack
Plan - A plan under red-black semantics, from
RedBlack::plan. - Relaxation
- The delete relaxation of a task, indexed for the worklist in
Relaxation::explore. - Relaxed
Plan - A relaxed plan: operators that reach the goal when deletes are ignored.
- Relevance
Params - Parameters of the exploration (their Algorithm 2).
- Relevance
Score - The relevance score heuristic
h_Ξ(Kim & Sridharan 2024): the sum over all facts of the probability that a randomly acting agent samples the fact while backchaining from the goal under the delete relaxation. - Stateless
- A stateless
Heuristicas aPathHeuristicwith no per-node information. - Uniform
Landmark Cost - An admissible landmark heuristic: uniform cost partitioning over the fact landmarks (Karpas & Domshlak 2009).
Enums§
- Causal
Level - Which end of the causal graph
Painting::causal_graph_levelkeeps black. - Combine
- How a rule combines the costs of its conditions.
- Fragment
- The tractable fragment a painting strategy targets: the shape of the causal graph induced on the black variables.
- H2Error
- Why
H2::newcannot handle a task. - Intention
Kind - Which of the two heuristics an
IntentionTrackercomputes. - Ordering
Kind - How two landmarks of an
OrderedLandmarksgraph are ordered. - Painting
Error - Why a set of variables cannot be painted black; see
Painting::new. - Strategy
- The choice point of the painting algorithm of Domshlak, Hoffmann & Katz (2015, Figure 8):
which black variable to paint red next. Every strategy stops at a maximal painting for its
Fragment; seesuper::Painting::with_strategy. - Tracking
Mode - What a
LandmarkTrackerestimates from the landmarks still to achieve.
Constants§
- MAX_
BOUNDED_ PRODUCT - The largest product of the domain sizes of the black variables of a
Painting::boundedpainting.
Traits§
- Goal
Distance - A heuristic of another crate with an inherent
value(&State) -> Option<u64>, whichAdapterturns into aHeuristic. - Heuristic
- An estimate of the cost from a state of type
Sto the nearest goal, in cost typeC. - Path
Heuristic - A heuristic whose estimate depends on the path to a state, through per-node information the search carries along (Karpas & Domshlak 2009; LAMA’s accepted landmarks).
Functions§
- heuristic_
fn - Turns a closure
FnMut(&S) -> Option<C>into aHeuristic.