Struct PlanGraph

Source
pub struct PlanGraph<'a, ActionId: Eq + Hash + Ord + PartialOrd + Clone + Debug, PropositionId: Eq + Hash + Ord + PartialOrd + Clone + Debug + Display> {
    pub goals: HashSet<&'a Proposition<PropositionId>>,
    pub actions: HashSet<&'a Action<'a, ActionId, PropositionId>>,
    pub layers: Vec<Layer<'a, ActionId, PropositionId>>,
    pub mutex_props: HashMap<usize, HashSet<PairSet<&'a Proposition<PropositionId>>>>,
    pub mutex_actions: HashMap<usize, HashSet<PairSet<&'a Action<'a, ActionId, PropositionId>>>>,
}

Fields§

§goals: HashSet<&'a Proposition<PropositionId>>§actions: HashSet<&'a Action<'a, ActionId, PropositionId>>§layers: Vec<Layer<'a, ActionId, PropositionId>>§mutex_props: HashMap<usize, HashSet<PairSet<&'a Proposition<PropositionId>>>>§mutex_actions: HashMap<usize, HashSet<PairSet<&'a Action<'a, ActionId, PropositionId>>>>

Implementations§

Source§

impl<'a, ActionId: Eq + Hash + Ord + PartialOrd + Clone + Debug, PropositionId: Eq + Hash + Ord + PartialOrd + Clone + Debug + Display> PlanGraph<'a, ActionId, PropositionId>

Source

pub fn new( initial_props: HashSet<&'a Proposition<PropositionId>>, goals: HashSet<&'a Proposition<PropositionId>>, actions: HashSet<&'a Action<'_, ActionId, PropositionId>>, ) -> Self

Source

pub fn push(&mut self, layer: Layer<'a, ActionId, PropositionId>)

Source

pub fn extend(&mut self) -> &mut Self

Extends the plangraph to depth i+1 Inserts another action layer and proposition layer

Source

pub fn depth(&self) -> usize

Returns the depth of the planning graph

Source

pub fn has_possible_solution(&self) -> bool

A solution is possible if all goals exist in the last proposition layer and are not mutex

Source

pub fn has_leveled_off(&self) -> bool

The graph is considered to have “leveled off” when proposition layer P and an adjacent proposition layer Q are equal

Trait Implementations§

Source§

impl<'a, ActionId: Debug + Eq + Hash + Ord + PartialOrd + Clone + Debug, PropositionId: Debug + Eq + Hash + Ord + PartialOrd + Clone + Debug + Display> Debug for PlanGraph<'a, ActionId, PropositionId>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, ActionId, PropositionId> Freeze for PlanGraph<'a, ActionId, PropositionId>

§

impl<'a, ActionId, PropositionId> RefUnwindSafe for PlanGraph<'a, ActionId, PropositionId>
where PropositionId: RefUnwindSafe, ActionId: RefUnwindSafe,

§

impl<'a, ActionId, PropositionId> Send for PlanGraph<'a, ActionId, PropositionId>
where PropositionId: Sync, ActionId: Sync,

§

impl<'a, ActionId, PropositionId> Sync for PlanGraph<'a, ActionId, PropositionId>
where PropositionId: Sync, ActionId: Sync,

§

impl<'a, ActionId, PropositionId> Unpin for PlanGraph<'a, ActionId, PropositionId>

§

impl<'a, ActionId, PropositionId> UnwindSafe for PlanGraph<'a, ActionId, PropositionId>
where PropositionId: RefUnwindSafe, ActionId: RefUnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.