Skip to main content

Solution

Struct Solution 

Source
pub struct Solution<S, A> { /* private fields */ }
Expand description

A value function and a greedy policy over the states a run touched.

See docs/design.md, section “Convergence criterion”, for what a converged solution guarantees.

Implementations§

Source§

impl<S, A> Solution<S, A>

Source

pub fn status(&self) -> Status

How the run ended.

Source

pub fn is_converged(&self) -> bool

Returns true if the run met its convergence criterion with a finite initial value.

Source

pub fn stats(&self) -> &Stats

Counters of the run.

Source

pub fn initial_state(&self) -> &S

The initial state.

Source

pub fn initial_value(&self) -> f64

The value of the initial state: the expected cost to reach a goal.

Infinite exactly when the status is Status::Unsolvable (which relies on the heuristic returning None only for real dead ends).

Source

pub fn initial_upper_bound(&self) -> Option<f64>

The upper bound on the initial state’s optimal value, for brtdp; None for the other algorithms, which keep no upper bound.

Source

pub fn initial_action(&self) -> Option<&A>

The policy’s action in the initial state; see Solution::action.

Source§

impl<S: Hash + Eq, A> Solution<S, A>

Source

pub fn value(&self, state: &S) -> Option<f64>

The value of state, or None if the run never touched it.

For LRTDP, RTDP, LAO* and iLAO*, values outside the policy’s reachable states are only bounds (lower bounds with an admissible heuristic), not converged values. For the bounded algorithms this is the lower bound; see Solution::upper_bound.

Source

pub fn upper_bound(&self, state: &S) -> Option<f64>

The upper bound on the optimal value of state, for brtdp.

None if the run never touched state, and always for the other algorithms. With Solution::value as the lower bound, the bounded algorithms bracket the optimal value of every stored state; see brtdp, section “Guarantee”.

Source

pub fn action(&self, state: &S) -> Option<&A>

The policy’s action in state.

None at goals, dead ends, states where giving up is cheaper (under DeadEnds::Penalty) and states the run never backed up. Every state reachable from the initial state under the policy of a converged run has an action unless it is one of the first three. The policy of BRTDP, FRTDP and VPI-RTDP is greedy on the upper bound; their fill pass gives a converged run the same coverage (see brtdp).

Trait Implementations§

Source§

impl<S: Debug, A> Debug for Solution<S, A>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S, A> Forget for Solution<S, A>

§

impl<S, A> Freeze for Solution<S, A>
where Space<S, A>: Freeze,

§

impl<S, A> Move for Solution<S, A>

§

impl<S, A> RefUnwindSafe for Solution<S, A>
where Space<S, A>: RefUnwindSafe,

§

impl<S, A> Send for Solution<S, A>
where Space<S, A>: Send,

§

impl<S, A> Sync for Solution<S, A>
where Space<S, A>: Sync,

§

impl<S, A> Unpin for Solution<S, A>
where Space<S, A>: Unpin,

§

impl<S, A> UnsafeUnpin for Solution<S, A>
where Space<S, A>: UnsafeUnpin,

§

impl<S, A> UnwindSafe for Solution<S, A>
where Space<S, A>: UnwindSafe,

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 = !

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.