Struct relearn::simulation::Step
source · [−]pub struct Step<O, A, F = Reward, U = O> {
pub observation: O,
pub action: A,
pub feedback: F,
pub next: Successor<O, U>,
}
Expand description
Description of an environment step.
There are a few different forms that this structure can take in terms of describing the
next observation when next
is Successor::Continue
.
These are determined by the value of the fourth generic parameter U
:
Step<O, A, F>
-U = O
- The continuing successor observation is owned.TransientStep<O, A, F>
-U = &O
- The continuing successor observation is borrowed.PartialStep<O, A, F>
-U = ()
- The continuing successor observation is omitted.
If next
is Successor::Interrupt
then the observation is owned in all cases.
Fields
observation: O
The initial observation.
action: A
The action taken from the initial state given the initial observation.
feedback: F
The resulting feedback.
next: Successor<O, U>
The next observation or outcome; how the episode progresses.
Implementations
sourceimpl<O, A, F, U> Step<O, A, F, U>
impl<O, A, F, U> Step<O, A, F, U>
pub const fn new(
observation: O,
action: A,
feedback: F,
next: Successor<O, U>
) -> Self
sourcepub const fn episode_done(&self) -> bool
pub const fn episode_done(&self) -> bool
Whether this step is the last of an episode.
pub fn into_partial(self) -> PartialStep<O, A, F>
sourceimpl<O: Clone, A, F> Step<O, A, F, &'a O>
impl<O: Clone, A, F> Step<O, A, F, &'a O>
sourcepub fn into_owned(self) -> Step<O, A, F>
pub fn into_owned(self) -> Step<O, A, F>
Convert a transient step into an owned step by cloning any borrowed successor observation.
sourceimpl<O, A, F> Step<O, A, F, ()>
impl<O, A, F> Step<O, A, F, ()>
sourcepub fn into_transient_with(self, next: &Self) -> TransientStep<'_, O, A, F>
pub fn into_transient_with(self, next: &Self) -> TransientStep<'_, O, A, F>
Convert a partial step into a transient step using the given reference to the next step.
sourcepub fn try_into_transient<'a>(self) -> Option<TransientStep<'a, O, A, F>>
pub fn try_into_transient<'a>(self) -> Option<TransientStep<'a, O, A, F>>
Try to convert into a transient step with no successor.
Succeeds so long as self.next
is not Successor::Continue
.
Trait Implementations
sourceimpl<'a, O, A, F> Extend<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F> where
O: 'a,
A: 'a,
F: Feedback + 'a,
impl<'a, O, A, F> Extend<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F> where
O: 'a,
A: 'a,
F: Feedback + 'a,
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<O, A, F: Feedback> Extend<Step<O, A, F, ()>> for OnlineStepsSummary<F>
impl<O, A, F: Feedback> Extend<Step<O, A, F, ()>> for OnlineStepsSummary<F>
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = PartialStep<O, A, F>>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F> where
O: 'a,
A: 'a,
F: Feedback + 'a,
impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F> where
O: 'a,
A: 'a,
F: Feedback + 'a,
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
Creates a value from an iterator. Read more
sourceimpl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for StepsSummary<F> where
O: 'a,
A: 'a,
F: Feedback + 'a,
impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for StepsSummary<F> where
O: 'a,
A: 'a,
F: Feedback + 'a,
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
Creates a value from an iterator. Read more
sourceimpl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for OnlineStepsSummary<F>
impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for OnlineStepsSummary<F>
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = PartialStep<O, A, F>>,
Creates a value from an iterator. Read more
sourceimpl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for StepsSummary<F>
impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for StepsSummary<F>
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = PartialStep<O, A, F>>,
Creates a value from an iterator. Read more
sourceimpl<O, A, F> FromIterator<Step<O, A, F, ()>> for VecBuffer<O, A, F>
impl<O, A, F> FromIterator<Step<O, A, F, ()>> for VecBuffer<O, A, F>
sourcefn from_iter<I>(steps: I) -> Self where
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn from_iter<I>(steps: I) -> Self where
I: IntoIterator<Item = PartialStep<O, A, F>>,
Creates a value from an iterator. Read more
sourceimpl<O: PartialEq, A: PartialEq, F: PartialEq, U: PartialEq> PartialEq<Step<O, A, F, U>> for Step<O, A, F, U>
impl<O: PartialEq, A: PartialEq, F: PartialEq, U: PartialEq> PartialEq<Step<O, A, F, U>> for Step<O, A, F, U>
impl<O: Copy, A: Copy, F: Copy, U: Copy> Copy for Step<O, A, F, U>
impl<O, A, F, U> StructuralPartialEq for Step<O, A, F, U>
Auto Trait Implementations
impl<O, A, F, U> RefUnwindSafe for Step<O, A, F, U> where
A: RefUnwindSafe,
F: RefUnwindSafe,
O: RefUnwindSafe,
U: RefUnwindSafe,
impl<O, A, F, U> Send for Step<O, A, F, U> where
A: Send,
F: Send,
O: Send,
U: Send,
impl<O, A, F, U> Sync for Step<O, A, F, U> where
A: Sync,
F: Sync,
O: Sync,
U: Sync,
impl<O, A, F, U> Unpin for Step<O, A, F, U> where
A: Unpin,
F: Unpin,
O: Unpin,
U: Unpin,
impl<O, A, F, U> UnwindSafe for Step<O, A, F, U> where
A: UnwindSafe,
F: UnwindSafe,
O: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more