pub struct TMaze { /* private fields */ }Expand description
T-maze — the provably memory-hard POMDP benchmark (Bakker 2001).
See the module docs for the full task, observation, reward, and determinism specification.
Implementations§
Source§impl TMaze
impl TMaze
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a T-maze with the default corridor length
(DEFAULT_CORRIDOR_LENGTH = 10) and a seeded cue RNG for a
reproducible cue sequence.
Sourcepub fn with_corridor_length(corridor_length: usize) -> Self
pub fn with_corridor_length(corridor_length: usize) -> Self
Create a T-maze with a custom corridor length and the default seed.
§Panics
Panics if corridor_length is zero. A zero-length corridor would place
the cue and the junction at the same step, leaking the cue into the
junction observation and destroying the memory task.
Sourcepub fn with_seed(seed: u64) -> Self
pub fn with_seed(seed: u64) -> Self
Create a T-maze with the default corridor length and a custom seed.
Sourcepub fn with_seed_and_corridor_length(seed: u64, corridor_length: usize) -> Self
pub fn with_seed_and_corridor_length(seed: u64, corridor_length: usize) -> Self
Create a T-maze with a custom seed and corridor length.
Two instances built with the same seed and corridor_length draw the
same cue on every reset, independent of the actions taken.
§Panics
Panics if corridor_length is zero (see
TMaze::with_corridor_length).
Sourcepub fn corridor_length(&self) -> usize
pub fn corridor_length(&self) -> usize
The corridor length N (the junction is at position N).
Sourcepub fn cue(&self) -> Cue
pub fn cue(&self) -> Cue
The cue for the current episode (primarily for diagnostics and tests).
Sourcepub fn at_junction(&self) -> bool
pub fn at_junction(&self) -> bool
Whether the agent is currently at the junction (position == N).
Trait Implementations§
Source§impl Environment for TMaze
impl Environment for TMaze
Source§type Action = i64
type Action = i64
Discrete junction action. 0 = up, 1 = down; only consequential at
the junction (ignored, as a no-op, while in the corridor).
Source§type State = TMazeState
type State = TMazeState
Snapshot type capturing position, cue, and the cue RNG. See
TMazeState.
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) -> TMazeState
fn clone_state(&self) -> TMazeState
Source§fn restore_state(&mut self, state: &TMazeState)
fn restore_state(&mut self, state: &TMazeState)
Auto Trait Implementations§
impl Freeze for TMaze
impl RefUnwindSafe for TMaze
impl Send for TMaze
impl Sync for TMaze
impl Unpin for TMaze
impl UnsafeUnpin for TMaze
impl UnwindSafe for TMaze
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> 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