pub struct GridWorld { /* private fields */ }Expand description
Sparse-reward discrete navigation task on a fixed 4x4 grid.
See the module docs for the full layout / action / observation / reward / termination specification and the determinism contract.
Implementations§
Source§impl GridWorld
impl GridWorld
Sourcepub fn with_seed(seed: u64) -> Self
pub fn with_seed(seed: u64) -> Self
Create a new env with a custom seed (default layout / episode length).
On the default layout the seed has no observable effect; two envs constructed with any seeds produce identical episodes. The seed is reserved for a future slip/random-layout mode.
Sourcepub fn with_seed_and_max_steps(seed: u64, max_steps: usize) -> Self
pub fn with_seed_and_max_steps(seed: u64, max_steps: usize) -> Self
Create a new env with a custom seed and episode length.
Sourcepub fn agent_index(&self) -> usize
pub fn agent_index(&self) -> usize
Current agent flattened cell index (row * GRID_COLS + col).
Trait Implementations§
Source§impl Environment for GridWorld
impl Environment for GridWorld
Source§type Action = i64
type Action = i64
Discrete navigation action. One of 0=Up, 1=Right, 2=Down,
3=Left; any other value is a no-op (the agent stays put).
Source§type State = GridWorldState
type State = GridWorldState
Snapshot type. The default layout is deterministic (no RNG in
step), so restore + step reproduces subsequent results exactly.
The RNG is not captured; see GridWorldState.
Source§fn get_observation(&self) -> Vec<f32>
fn get_observation(&self) -> Vec<f32>
Source§fn step(&mut self, action: i64) -> StepResult
fn step(&mut self, action: i64) -> StepResult
Source§fn observation_space(&self) -> SpaceInfo
fn observation_space(&self) -> SpaceInfo
Source§fn action_space(&self) -> SpaceInfo
fn action_space(&self) -> SpaceInfo
Source§fn clone_state(&self) -> GridWorldState
fn clone_state(&self) -> GridWorldState
Source§fn restore_state(&mut self, state: &GridWorldState)
fn restore_state(&mut self, state: &GridWorldState)
Auto Trait Implementations§
impl Freeze for GridWorld
impl RefUnwindSafe for GridWorld
impl Send for GridWorld
impl Sync for GridWorld
impl Unpin for GridWorld
impl UnsafeUnpin for GridWorld
impl UnwindSafe for GridWorld
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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