Skip to main content

VecEnvironment

Trait VecEnvironment 

Source
pub trait VecEnvironment {
    // Required methods
    fn num_envs(&self) -> usize;
    fn observation_size(&self) -> usize;
    fn num_actions(&self) -> Option<usize>;
    fn reset(&mut self, seed: u64);
    fn step(&mut self, actions: &[f32]);
    fn write_observations(&self, buffer: &mut [f32]);
    fn write_rewards(&self, buffer: &mut [f32]);
    fn write_terminals(&self, buffer: &mut [u8]);
    fn write_truncations(&self, buffer: &mut [u8]);
}
Expand description

Trait for vectorized environments with SoA memory layout.

Required Methods§

Source

fn num_envs(&self) -> usize

Returns the number of parallel environments.

Source

fn observation_size(&self) -> usize

Returns the observation size per environment.

Source

fn num_actions(&self) -> Option<usize>

Returns the number of discrete actions, or None for continuous.

Source

fn reset(&mut self, seed: u64)

Reset all environments with deterministic seeding.

Source

fn step(&mut self, actions: &[f32])

Step all environments (includes auto-reset for done envs).

Source

fn write_observations(&self, buffer: &mut [f32])

Write observations to buffer.

Source

fn write_rewards(&self, buffer: &mut [f32])

Write rewards to buffer.

Source

fn write_terminals(&self, buffer: &mut [u8])

Write terminal flags to buffer.

Source

fn write_truncations(&self, buffer: &mut [u8])

Write truncation flags to buffer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§