Skip to main content

TMaze

Struct TMaze 

Source
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

Source

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.

Source

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.

Source

pub fn with_seed(seed: u64) -> Self

Create a T-maze with the default corridor length and a custom seed.

Source

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).

Source

pub fn corridor_length(&self) -> usize

The corridor length N (the junction is at position N).

Source

pub fn cue(&self) -> Cue

The cue for the current episode (primarily for diagnostics and tests).

Source

pub fn position(&self) -> usize

The current position along the corridor in 0..=N.

Source

pub fn at_junction(&self) -> bool

Whether the agent is currently at the junction (position == N).

Trait Implementations§

Source§

impl Debug for TMaze

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TMaze

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Environment for TMaze

Source§

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

Snapshot type capturing position, cue, and the cue RNG. See TMazeState.

Source§

fn reset(&mut self)

Reset the environment and return initial observation
Source§

fn get_observation(&self) -> Vec<f32>

Get the current observation
Source§

fn step(&mut self, action: i64) -> StepResult

Step the environment with an action
Source§

fn observation_space(&self) -> SpaceInfo

Get the observation space dimensions
Source§

fn action_space(&self) -> SpaceInfo

Get the action space dimensions
Source§

fn render(&self) -> Vec<u8>

Render the current environment state
Source§

fn close(&mut self)

Close the environment
Source§

fn clone_state(&self) -> TMazeState

Snapshot the current env state for later restoration. Read more
Source§

fn restore_state(&mut self, state: &TMazeState)

Restore the env to a previously-snapshotted state. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more