Skip to main content

WidthProblem

Trait WidthProblem 

Source
pub trait WidthProblem {
    type State: Clone;
    type Action: Clone;

    // Required methods
    fn initial_state(&self) -> Self::State;
    fn successors(
        &self,
        state: &Self::State,
        out: &mut Vec<(Self::Action, Self::State)>,
    );
    fn features(&self, state: &Self::State, out: &mut Vec<u32>);
    fn num_features(&self) -> usize;
    fn is_goal(&self, state: &Self::State) -> bool;
}
Expand description

A search problem described by successors and integer features.

Width-based search never inspects states directly. It only needs the successors of a state, the goal test, and the features that are true in a state, numbered 0..num_features(). Novelty is computed over those features, so their choice decides what counts as “new”.

Required Associated Types§

Source

type State: Clone

A search state. Cloned when a node is stored.

Source

type Action: Clone

The label of a transition; plans are sequences of actions.

Required Methods§

Source

fn initial_state(&self) -> Self::State

The state the search starts from.

Source

fn successors( &self, state: &Self::State, out: &mut Vec<(Self::Action, Self::State)>, )

Push all (action, successor) pairs of state into out.

Source

fn features(&self, state: &Self::State, out: &mut Vec<u32>)

Push the feature ids (< num_features()) true in state into out.

Source

fn num_features(&self) -> usize

Number of distinct features; every id from WidthProblem::features must be below it.

Source

fn is_goal(&self, state: &Self::State) -> bool

Whether state satisfies the goal.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§