Skip to main content

Environment

Trait Environment 

Source
pub trait Environment {
    type State;
    type Action;

    const MAX_STEPS: usize;

    // Required methods
    fn state(&self) -> Self::State;
    fn step(&mut self, action: Self::Action) -> StepResult<Self::State>;
    fn reset(&mut self);
}
Expand description

Trait to be implemented for a RL environment.

Required Associated Constants§

Source

const MAX_STEPS: usize

The maximum number of step for one episode.

Required Associated Types§

Source

type State

The type of the state.

Source

type Action

The type of actions.

Required Methods§

Source

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

Returns the current state.

Source

fn step(&mut self, action: Self::Action) -> StepResult<Self::State>

Take a step in the environment given an action.

Source

fn reset(&mut self)

Reset the environment to an initial state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§