Skip to main content

Environment

Trait Environment 

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§

const MAX_STEPS: usize

The maximum number of step for one episode.

Required Associated Types§

type State

The type of the state.

type Action

The type of actions.

Required Methods§

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

Returns the current state.

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

Take a step in the environment given an action.

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".

Implementors§