Skip to main content

WorldModel

Struct WorldModel 

Source
pub struct WorldModel<B: Backend, D: ActionConditionedPredictor<B>, C: CostFunction<B>> {
    pub dynamics: D,
    pub cost: C,
    /* private fields */
}
Expand description

World model that can simulate trajectories and evaluate plans.

Combines a dynamics model and cost function for model-based planning. The encoder is external — state representations are passed in directly.

Fields§

§dynamics: D

Dynamics model: predicts next state given current state and action.

§cost: C

Cost function: evaluates how close a trajectory gets to the goal.

Implementations§

Source§

impl<B: Backend, D: ActionConditionedPredictor<B>, C: CostFunction<B>> WorldModel<B, D, C>

Source

pub fn new(dynamics: D, cost: C) -> Self

Create a new world model.

Source

pub fn rollout( &self, initial_state: &Representation<B>, actions: &[Action<B>], ) -> Vec<Representation<B>>

Simulate a sequence of actions starting from an initial state.

Returns the full trajectory including the initial state.

§Arguments
  • initial_state - Starting state representation
  • actions - Sequence of actions to simulate
§Returns

Trajectory of len(actions) + 1 states (initial + predicted)

Source

pub fn evaluate_plan( &self, initial_state: &Representation<B>, actions: &[Action<B>], goal: &Representation<B>, ) -> Energy<B>

Evaluate a plan by computing its total cost relative to a goal.

§Arguments
  • initial_state - Starting state
  • actions - Sequence of actions (the plan)
  • goal - Goal state to reach
§Returns

Cost of the plan (lower = better)

Auto Trait Implementations§

§

impl<B, D, C> Freeze for WorldModel<B, D, C>
where D: Freeze, C: Freeze,

§

impl<B, D, C> RefUnwindSafe for WorldModel<B, D, C>

§

impl<B, D, C> Send for WorldModel<B, D, C>
where D: Send, C: Send,

§

impl<B, D, C> Sync for WorldModel<B, D, C>
where D: Sync, C: Sync,

§

impl<B, D, C> Unpin for WorldModel<B, D, C>
where D: Unpin, C: Unpin, B: Unpin,

§

impl<B, D, C> UnsafeUnpin for WorldModel<B, D, C>
where D: UnsafeUnpin, C: UnsafeUnpin,

§

impl<B, D, C> UnwindSafe for WorldModel<B, D, C>
where D: UnwindSafe, C: UnwindSafe, B: 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoComptime for T

Source§

fn comptime(self) -> Self

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more