pub struct VecEnv { /* private fields */ }Expand description
Vectorized market-making environment.
Manages N independent engine instances. On each step():
- Read actions
(N, 2)as (bid_distance, ask_distance) - For each env: set orders, advance engine, compute reward
- Return
(states, rewards, dones)as contiguous f32 arrays - Auto-reset finished environments
Implementations§
Source§impl VecEnv
impl VecEnv
pub fn new(config: VecEnvConfig, num_envs: usize) -> Self
Sourcepub fn step(&mut self, actions: &[f32]) -> (&[f32], &[f32], &[f32])
pub fn step(&mut self, actions: &[f32]) -> (&[f32], &[f32], &[f32])
Step all environments with the given actions.
actions must have length num_envs * 2, laid out as
[bid_dist_0, ask_dist_0, bid_dist_1, ask_dist_1, ...].
Returns (&states, &rewards, &dones) where:
- states:
[f32; N*6]flattened row-major - rewards:
[f32; N] - dones:
[f32; N](1.0 if episode ended, 0.0 otherwise)
Sourcepub fn get_states(&self) -> &[f32]
pub fn get_states(&self) -> &[f32]
Current states buffer (read-only).
Sourcepub fn get_equities(&self) -> &[f32]
pub fn get_equities(&self) -> &[f32]
Per-env equity after the last step (captured before auto-reset).
Sourcepub fn get_positions(&self) -> &[f32]
pub fn get_positions(&self) -> &[f32]
Per-env inventory after the last step (captured before auto-reset).
Sourcepub fn get_step_fills(&self) -> &[f32]
pub fn get_step_fills(&self) -> &[f32]
Per-env fill count from the last step (captured before auto-reset).
Auto Trait Implementations§
impl !RefUnwindSafe for VecEnv
impl !Sync for VecEnv
impl !UnwindSafe for VecEnv
impl Freeze for VecEnv
impl Send for VecEnv
impl Unpin for VecEnv
impl UnsafeUnpin for VecEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more