Skip to main content

HMax

Struct HMax 

Source
pub struct HMax(/* private fields */);
Expand description

The max heuristic h^max (Bonet and Geffner 2001) seeded with fact prices: admissible on decoupled states.

A completion through a member state pays the prices of its leaf states, at least the largest price of any fact it uses, and then at least h^max of that state; seeding every fact with its price can only lower the estimate. The relaxation runs over all operators of the original task, leaf actions included.

§Examples

use decoupled_search::{Factoring, HMax, astar};
use sas_plus::{Effect, Fact, Operator, State, Task, Variable};

let op = |pre: Vec<Fact>, eff: Fact| Operator {
    name: "op".into(),
    pre,
    eff: vec![Effect::new(eff)],
    cost: 2,
};
let task = Task {
    variables: vec![Variable::new("truck", 2), Variable::new("pkg", 3)],
    operators: vec![
        op(vec![Fact::new(0, 0)], Fact::new(0, 1)),
        op(vec![Fact::new(0, 0), Fact::new(1, 0)], Fact::new(1, 2)),
        op(vec![Fact::new(0, 1), Fact::new(1, 2)], Fact::new(1, 1)),
    ],
    initial: State(vec![0, 0]),
    goal: vec![Fact::new(1, 1)],
    axioms: vec![],
};

let plan = astar(&task, &Factoring::fork(&task), &HMax::new(&task))?.expect("solvable");
assert_eq!(plan.cost, 6);

Implementations§

Source§

impl HMax

Source

pub fn new(task: &Task) -> Self

Prepares h^max for task.

§Panics

Panics if task fails Task::validate.

Trait Implementations§

Source§

impl Clone for HMax

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 Debug for HMax

Source§

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

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

impl DecoupledHeuristic for HMax

Source§

fn estimate(&self, facts: &FactPrices<'_>) -> Option<u64>

An estimate of the cost still to pay from a decoupled state beyond the cost of its global actions: leaf prices plus all further operators. None declares that no goal is reachable from it; the search then prunes the state. Read more

Auto Trait Implementations§

§

impl Forget for HMax

§

impl Freeze for HMax

§

impl Move for HMax

§

impl RefUnwindSafe for HMax

§

impl Send for HMax

§

impl Sync for HMax

§

impl Unpin for HMax

§

impl UnsafeUnpin for HMax

§

impl UnwindSafe for HMax

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.