pub struct SnapshotBase<const R: usize, ObservationType: Observation<R>, RewardType: Reward> {
pub observation: ObservationType,
pub reward: RewardType,
pub status: EpisodeStatus,
}Expand description
Default snapshot implementation for standard reinforcement learning observations.
SnapshotBase stores an observation, reward, and EpisodeStatus.
Construct via the named constructors running,
terminated, or truncated.
§Type Parameters
R- The observation tensor rankObservationType- The type of observation (must implementObservation<R>)RewardType- The type of reward (must implementReward)
Fields§
§observation: ObservationTypeThe observation derived from the state.
reward: RewardTypeThe reward received from the last action.
status: EpisodeStatusEpisode lifecycle status.
Implementations§
Source§impl<const R: usize, ObservationType: Observation<R>, RewardType: Reward> SnapshotBase<R, ObservationType, RewardType>
impl<const R: usize, ObservationType: Observation<R>, RewardType: Reward> SnapshotBase<R, ObservationType, RewardType>
Sourcepub fn running(observation: ObservationType, reward: RewardType) -> Self
pub fn running(observation: ObservationType, reward: RewardType) -> Self
Snapshot for a step where the episode is still running.
Sourcepub fn terminated(observation: ObservationType, reward: RewardType) -> Self
pub fn terminated(observation: ObservationType, reward: RewardType) -> Self
Snapshot for the step on which the MDP reached a terminal state.
Trait Implementations§
Source§impl<const R: usize, ObservationType: Clone + Observation<R>, RewardType: Clone + Reward> Clone for SnapshotBase<R, ObservationType, RewardType>
impl<const R: usize, ObservationType: Clone + Observation<R>, RewardType: Clone + Reward> Clone for SnapshotBase<R, ObservationType, RewardType>
Source§fn clone(&self) -> SnapshotBase<R, ObservationType, RewardType>
fn clone(&self) -> SnapshotBase<R, ObservationType, RewardType>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const R: usize, ObservationType: Debug + Observation<R>, RewardType: Debug + Reward> Debug for SnapshotBase<R, ObservationType, RewardType>
impl<const R: usize, ObservationType: Debug + Observation<R>, RewardType: Debug + Reward> Debug for SnapshotBase<R, ObservationType, RewardType>
Source§impl<const R: usize, ObservationType: Observation<R>, RewardType: Reward> Snapshot<R> for SnapshotBase<R, ObservationType, RewardType>
impl<const R: usize, ObservationType: Observation<R>, RewardType: Reward> Snapshot<R> for SnapshotBase<R, ObservationType, RewardType>
Source§type ObservationType = ObservationType
type ObservationType = ObservationType
The observation type exposed to the agent at each step.
Source§type RewardType = RewardType
type RewardType = RewardType
The type of reward contained in this snapshot.
Source§fn observation(&self) -> &Self::ObservationType
fn observation(&self) -> &Self::ObservationType
Access the observed state.
Source§fn reward(&self) -> &Self::RewardType
fn reward(&self) -> &Self::RewardType
Access the reward received.
Source§fn status(&self) -> EpisodeStatus
fn status(&self) -> EpisodeStatus
Episode lifecycle status for this step.
Source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true only for intrinsic MDP termination.Source§fn is_truncated(&self) -> bool
fn is_truncated(&self) -> bool
true only for extrinsic step-limit truncation.Source§fn metadata(&self) -> Option<&SnapshotMetadata>
fn metadata(&self) -> Option<&SnapshotMetadata>
Optional named reward components and position data.
Auto Trait Implementations§
impl<const R: usize, ObservationType, RewardType> Freeze for SnapshotBase<R, ObservationType, RewardType>
impl<const R: usize, ObservationType, RewardType> RefUnwindSafe for SnapshotBase<R, ObservationType, RewardType>where
ObservationType: RefUnwindSafe,
RewardType: RefUnwindSafe,
impl<const R: usize, ObservationType, RewardType> Send for SnapshotBase<R, ObservationType, RewardType>where
RewardType: Send,
impl<const R: usize, ObservationType, RewardType> Sync for SnapshotBase<R, ObservationType, RewardType>where
RewardType: Sync,
impl<const R: usize, ObservationType, RewardType> Unpin for SnapshotBase<R, ObservationType, RewardType>
impl<const R: usize, ObservationType, RewardType> UnsafeUnpin for SnapshotBase<R, ObservationType, RewardType>where
ObservationType: UnsafeUnpin,
RewardType: UnsafeUnpin,
impl<const R: usize, ObservationType, RewardType> UnwindSafe for SnapshotBase<R, ObservationType, RewardType>where
ObservationType: UnwindSafe,
RewardType: UnwindSafe,
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
Source§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
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>
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