# hub.domain.pddl.heuristics
Domain specification
# atom_to_str
atom_to_str(
atom,
task
)
Format a FlatAtomKey as a human-readable string using task metadata.
Args: atom: A PDDL_FlatAtomKey object with predicate_id and args. task: The PDDL Task providing predicate_name() and object_name().
Returns: A string like "on(block1, block2)".
# HMax
h_max delete-relaxation heuristic (admissible).
Takes the MAX over goal atom costs. Lower bound on optimal plan cost. Pre-grounds all reachable actions at construction time via clingo, then computes heuristic values via fast array-based forward chaining.
For deterministic domains (PDDL): computes h_max as defined in "Planning as Heuristic Search" (Bonet & Geffner, Artificial Intelligence, 2001).
For probabilistic domains (PPDDL):
- discount_factor=1.0 (SSP): applies Proposition 1 from "Extending Classical Planning Heuristics to Probabilistic Planning with Dead-Ends" (Teichteil-Königsbuch, Vidal & Infantes, AAAI 2011) — h⁺_max on the implicit all-outcome determinization.
- discount_factor<1.0 (DSSP): applies Theorem 2 — discounted formula h^γ_max(s) = c_m(s) · (1 − γ^{h^{1,+}_max(s)}) / (1 − γ).
# Constructor HMax
HMax(
task,
discount_factor = 1.0,
dead_end_cost = 1000000000.0,
verbose = False
)
Initialize self. See help(type(self)) for accurate signature.
# compute_detailed HMax
compute_detailed(
self,
state
)
Return detailed heuristic information for the given state.
Returns a dict with:
- heuristic_value: the h_max value
- atom_costs: list of (FlatAtomKey, cost) for reachable atoms
- goal_atom_costs: list of (FlatAtomKey, cost) for goal atoms
# HAdd
h_add delete-relaxation heuristic (non-admissible, informative).
SUM over goal atom costs. Assumes subgoals are independent. Pre-grounds all reachable actions at construction time via clingo, then computes heuristic values via fast array-based forward chaining.
For deterministic domains (PDDL): computes h_add as defined in "Planning as Heuristic Search" (Bonet & Geffner, Artificial Intelligence, 2001).
For probabilistic domains (PPDDL):
- discount_factor=1.0 (SSP): applies Proposition 1 from "Extending Classical Planning Heuristics to Probabilistic Planning with Dead-Ends" (Teichteil-Königsbuch, Vidal & Infantes, AAAI 2011) — h⁺_add on the implicit all-outcome determinization.
- discount_factor<1.0 (DSSP): applies Theorem 2 — discounted formula h^γ_add(s) = c_m(s) · (1 − γ^{h^{1,+}_add(s)}) / (1 − γ).
# Constructor HAdd
HAdd(
task,
discount_factor = 1.0,
dead_end_cost = 1000000000.0,
verbose = False
)
Initialize self. See help(type(self)) for accurate signature.
# compute_detailed HAdd
compute_detailed(
self,
state
)
Return detailed heuristic information for the given state.
Returns a dict with:
- heuristic_value: the h_add value
- atom_costs: list of (FlatAtomKey, cost) for reachable atoms
- goal_atom_costs: list of (FlatAtomKey, cost) for goal atoms
# HFF
h_FF delete-relaxation heuristic.
Builds a relaxed planning graph via h_add forward chaining, then extracts a relaxed plan backwards from the goal as described in:
Hoffmann, J. and Nebel, B. (2001). The FF Planning System:
Fast Plan Generation Through Heuristic Search.
Journal of Artificial Intelligence Research, 14, 253-302.
h_FF = total cost of unique actions in the relaxed plan. Also identifies helpful actions (relaxed-plan actions whose preconditions are all satisfied in the current state).
For probabilistic domains (PPDDL):
- discount_factor=1.0 (SSP): h⁺_FF on all-outcome determinization.
- discount_factor<1.0 (DSSP): h^γ_FF via Theorem 2 from "Extending Classical Planning Heuristics to Probabilistic Planning with Dead-Ends" (Teichteil-Königsbuch, Vidal & Infantes, AAAI 2011).
# Constructor HFF
HFF(
task,
discount_factor = 1.0,
dead_end_cost = 1000000000.0,
verbose = False
)
Initialize self. See help(type(self)) for accurate signature.
# compute_detailed HFF
compute_detailed(
self,
state
)
Return detailed heuristic information for the given state.
Returns a dict with:
- heuristic_value: the h_FF value
- atom_costs: list of (FlatAtomKey, cost) for reachable atoms
- goal_atom_costs: list of (FlatAtomKey, cost) for goal atoms
- relaxed_plan_actions: list of GroundAction in the relaxed plan
- helpful_actions: list of GroundAction (relaxed-plan actions whose preconditions are all satisfied in the current state)
- marked_atoms: list of FlatAtomKey extracted during backward pass
# compute_with_helpful HFF
compute_with_helpful(
self,
state
)
Return (h_value, [GroundAction]) for the given state.
# helpful_actions HFF
helpful_actions(
self,
state
)
Return helpful actions (list of GroundAction) for the given state.