Skip to main content

DynVecEnv

Trait DynVecEnv 

Source
pub trait DynVecEnv: Send + Sync {
    // Required methods
    fn describe(&self) -> Value;
    fn num_envs(&self) -> usize;
    fn num_threads(&self) -> usize;
    fn set_num_threads(&mut self, threads: usize);
    fn reset(&mut self, seed: Option<i64>);
    fn obs_into(&self, out: &mut [f32]);
    fn step_into(&mut self, actions: Actions<'_>, out: StepBuffers<'_>);
    fn legal_action_masks(&self, out: &mut [bool]) -> bool;
    fn step_without_final(
        &mut self,
        actions: Actions<'_>,
        obs: &mut [f32],
        reward: &mut [f32],
        terminated: &mut [bool],
        truncated: &mut [bool],
    );
}
Expand description

A compiled vector environment behind a trait object, as the library side keeps it.

Required Methods§

Source

fn describe(&self) -> Value

The environment.

Source

fn num_envs(&self) -> usize

The number of environments.

Source

fn num_threads(&self) -> usize

The number of threads.

Source

fn set_num_threads(&mut self, threads: usize)

Changes the number of threads.

Source

fn reset(&mut self, seed: Option<i64>)

Starts new episodes.

Source

fn obs_into(&self, out: &mut [f32])

Writes the observations.

Source

fn step_into(&mut self, actions: Actions<'_>, out: StepBuffers<'_>)

Steps every environment.

Source

fn legal_action_masks(&self, out: &mut [bool]) -> bool

Writes the legal action masks, if any.

Source

fn step_without_final( &mut self, actions: Actions<'_>, obs: &mut [f32], reward: &mut [f32], terminated: &mut [bool], truncated: &mut [bool], )

Steps every environment without the final observations.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<C> DynVecEnv for CompiledVecEnv<C>
where C: CompiledEnv, C::State: Send, C::Obs: Send,