Skip to main content

Pruning

Enum Pruning 

Source
#[non_exhaustive]
pub enum Pruning { Basic, Frontier, EffectivePrices, Simulation, EffectiveSimulation, Adaptive, }
Expand description

The dominance criterion that prunes generated decoupled states.

A stored state t dominates a generated state n with the same center if every completion of n can be turned into a completion of t with the same remaining global actions and no higher total cost; n is then pruned. The criteria are those of Torralba, Gnad, Dubbert and Hoffmann (IJCAI 2016), generalised to this crate’s global actions, which may read and write leaves under any partition, and to partial leaf goals. Pruning::Frontier subsumes Pruning::Basic, Pruning::EffectivePrices subsumes Pruning::Frontier, Pruning::Simulation subsumes Pruning::Basic, and Pruning::EffectiveSimulation subsumes all; effective prices and simulation are incomparable (as in the paper). Stronger criteria prune more but cost more: simulation is computed once per search and leaf.

§Anchored leaf states

The paper has one goal leaf state, and only leaf actions move a leaf. Here, a leaf state is anchored if it satisfies the leaf goal or the leaf preconditions of some global action’s part on the leaf (every state is, if some part has no leaf precondition). An unanchored state can only be left by leaf actions; a completion’s leaf path ends in a goal leaf state and meets every global action that touches the leaf in an anchored state.

§The per-leaf property

Each criterion yields, per leaf L, a slack δ_L such that:

(★) for every center path π from n and every π-compliant leaf path ρ that a completion of n takes from a reached leaf state x, t has a π-compliant leaf path that ends in a goal leaf state and satisfies the same global preconditions, at total leaf cost at most price_n(x) + δ_L + cost(ρ).

All criteria but the frontier one give a bound D_t(x) with “t can do what ρ does from x at leaf cost at most D_t(x) + cost(ρ)”; then δ_L = max_x (D_t(x) - price_n(x)) over the reached states x of n satisfies (★).

  • Pruning::Basic: D_t(x) = price_t(x). t reaches x at that price and follows ρ.
  • Pruning::Simulation: D_t(x) = min_{x ⪯ y} price_t(y) over the reached y that simulate x (see the variant). t reaches y and mirrors ρ.
  • Pruning::EffectivePrices: D_t = p, the point-wise least function with p(x) = S(x) on anchored states and p(x) = min(S(x), max_{x -a-> y} p(y) - cost(a)) elsewhere, over leaf actions regardless of their center preconditions, where S = price_t. Proof: let ρ visit x = s_0, ..., s_m and take the first i with p(s_i) = S(s_i); it exists because ρ ends in a goal leaf state, which is anchored. Before i all states are unanchored, so every step is a leaf action and p(s_j) >= p(s_{j+1}) - cost(a_{j+1}); summing, S(s_i) = p(s_i) <= p(x) + cost(s_0 .. s_i). t reaches s_i at S(s_i) and follows the rest of ρ. States whose least value is -∞ reach no anchored state, so no completion uses them.
  • Pruning::EffectiveSimulation: the same with S the simulation bound; at s_i, t reaches a simulating y and mirrors the rest.
  • Pruning::Frontier: δ_L = max_x (price_t(x) - price_n(x)) over the reached states x on the frontier of n: anchored, or left by some leaf action x -a-> y with price_n(x) + cost(a) < price_n(y). Proof: if ρ starts outside the frontier, every leaf action out of a non-frontier state s_j reaches s_{j+1} with price_n(s_{j+1}) <= price_n(s_j) + cost(a_{j+1}), so the first frontier state s_k of ρ (it exists, the goal state is anchored) has price_n(s_k) <= price_n(x) + cost(s_0 .. s_k); t reaches s_k at price_t(s_k) <= price_n(s_k) + δ_L and follows the rest of ρ.

§The g budget

Leaf prices exclude g. A completion of n through leaf states x_L costs g(n) + Σ_L (price_n(x_L) + cost(ρ_L)) + c, with c the cost of the remaining global actions, and by (★) t has one costing at most g(t) + Σ_L (price_n(x_L) + δ_L + cost(ρ_L)) + c. So t dominates n for cost-optimal search if g(t) + Σ_L δ_L <= g(n), which Config::fold_g uses; without it, the classic condition g(t) <= g(n) and δ_L <= 0 for every leaf. Comparing g + price per leaf state instead is unsound with two or more leaves, because g is paid once but would be credited per leaf: with g(t) = 0 and both leaves at price 10, g(n) = 10 and both at 0, every leaf ties at 10, yet completing both costs 20 from t and 10 from n. Greedy search only needs reachability: t dominates n if every δ_L is finite.

§Optimality

Say a stored node covers cost C via global actions π if π leads it to a goal state with total cost at most C. While uniform-cost search or A* with an admissible heuristic has not recorded the optimal cost C*, take a node covering C* with the shortest π. If π is empty, the node is a goal and its cost was recorded when it was stored. If the node were closed, its successor along π[0] was either stored (covering via a shorter path), pruned by a stored node covering via the same shorter π[1..] (dominance keeps the remaining global actions, so the paper’s condition on the number of center actions is not needed), or a dead end of the heuristic, which is impossible for a state with a completion. So it is open with f <= C*, and the search cannot stop before recording C*. Termination follows from Dickson’s lemma for the basic criterion, which every other one subsumes.

Leaves whose transitions depend on the center (center-conditioned effects, derived variables attached to them) or that have more than Config::max_analysis_states states use the basic bound.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Basic

Same center and no higher price for any leaf state (Gnad and Hoffmann’s criterion).

§

Frontier

Prices compared only on the frontier of the generated state: leaf states that are goals, satisfy a global precondition, or could still lower another state’s price.

§

EffectivePrices

Prices of the stored state replaced by effective prices, which credit a leaf state with the cheapest way to get to where it leads.

§

Simulation

A leaf state may take the price of any reached leaf state that simulates it.

The leaf simulation ⪯ (Definition 5 of the paper, with global actions added) is the coarsest relation on leaf states where x ⪯ y implies: if x satisfies the leaf goal, so does y; for every global action’s part P on the leaf, if x satisfies P’s leaf preconditions, so does y, and P(x) ⪯ P(y); and for every leaf action x -a-> x', either x' ⪯ y (the leaf stays at y) or some leaf action b with cost(b) <= cost(a) and center preconditions contained in a’s leads y -b-> y' with x' ⪯ y'. By induction on a compliant leaf path from x, y has one that complies with the same center path (each b is applicable wherever a was, each global action’s leaf preconditions hold), ends in a goal leaf state whenever the original does, and costs no more.

§

EffectiveSimulation

Effective prices over simulation bounds; the strongest criterion.

§

Adaptive

Pruning::EffectivePrices until the search has spent about as much as computing the leaf simulations would cost, then Pruning::EffectiveSimulation (the default).

Computing a leaf simulation takes time quadratic in the leaf size, which dominates searches on small tasks. The switch follows the ski-rental rule: the work unit is one leaf state of a generated decoupled state (leaf closure touches every leaf state of every successor), and the simulation’s estimated cost is the sum of size^2 * (1 + leaf actions) over the analysed leaves. A search that ends earlier never pays for simulation; otherwise it pays at most about twice the better of the two choices. Both criteria are sound, so mixing them in one search is too; bounds cached under effective prices are recomputed after the switch. With Config::reduce_leaves, the simulation is needed up front, and this is Pruning::EffectiveSimulation from the start.

Trait Implementations§

Source§

impl Clone for Pruning

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Pruning

Source§

impl Debug for Pruning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Pruning

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Pruning

Source§

impl PartialEq for Pruning

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Pruning

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.