1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//! # Planning heuristics
//!
//! Goal-distance estimates for classical planning tasks given as [`sas_plus::Task`].
//!
//! ## Implemented
//!
//! - [`HMax`], [`HAdd`] and [`HFf`]: the delete-relaxation heuristics `h_max`, `h_add` and
//! `h_FF` (Bonet & Geffner 2001, Hoffmann & Nebel 2001), computed with a worklist
//! (generalized Dijkstra) over [`Relaxation`], which also extracts [`RelaxedPlan`]s and their preferred operators.
//! - [`HSetAdd`]: the set-additive heuristic `h_sa` (Keyder & Geffner 2008); [`AdditiveHMax`]:
//! `h_max` summed over a partition of the operator costs; [`H2`]: `h²` (Haslum & Geffner
//! 2000), which sees pairs of facts.
//! - [`RedBlack`]: the red-black heuristic `h_RB` (Domshlak, Hoffmann &
//! Katz 2015), with the black variables chosen by a [`Painting`]: 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^1` fact landmarks with natural orderings
//! ([`LandmarkGraph`]), and the heuristics [`LandmarkCount`] (inadmissible) and
//! [`UniformLandmarkCost`] (admissible, uniform cost partitioning); with feature `lp`,
//! `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, as [`OrderedLandmarks`] with
//! natural, greedy-necessary and reasonable orderings ([`OrderingKind`]).
//! - [`PathHeuristic`]: path-dependent heuristics; [`LandmarkTracker`] tracks the accepted
//! landmarks along the search path, as LAMA's landmark count or admissibly with uniform cost
//! partitioning; with feature `lp`, `OptimalLandmarkTracker` with optimal cost partitioning.
//! The optimal cost partitioning over LM-cut's action landmarks is `OperatorCounting` with
//! only the LM-cut constraints (its LP dual).
//! - [`LmCut`]: the landmark-cut heuristic `h_LM-cut` (Helmert & Domshlak 2009), admissible,
//! with its disjunctive [`ActionLandmark`]s.
//! - [`AbstractionHeuristic`]: goal distances of any [`sas_plus::Abstraction`], such as a
//! pattern database over a [`sas_plus::Projection`]. Features `merge-and-shrink` and
//! `cost-partition` implement [`GoalDistance`] for those crates' heuristics, which
//! [`Adapter`] turns into a [`Heuristic`].
//! - [`RelevanceScore`]: the relevance score `h_Ξ` (Kim & Sridharan 2024), landmark-like and
//! inadmissible, over a partially explored backtracking tree.
//! - [`GoalIntention`]: goal-intention ranking keys `ol_rp` / `op_rp` (Rosa et al. 2026) from
//! sampled relaxed plans, tracked along a path with [`IntentionTracker`].
//!
//! ## 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>
extern crate alloc;
pub use ;
pub use AdditiveHMax;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use HSetAdd;
// The shared trait of the planning crates: `planning_heuristics::Heuristic` and
// `search_core::Heuristic` are one trait. A doc comment here would be prepended to all three.
pub use ;
/// Compile-time check: the shared tables are `Sync`, the per-thread heuristics are `Send`.
const _: = ;
/// Doctests for the code examples in README.md (not part of the API).