Trait relearn::simulation::StepsIter
source · [−]pub trait StepsIter<O, A, F>: Iterator<Item = PartialStep<O, A, F>> {
fn summarize(self) -> StepsSummary<F>
where
Self: Sized,
F: Feedback,
{ ... }
fn take_episodes(self, n: usize) -> TakeEpisodes<Self>ⓘNotable traits for TakeEpisodes<I>impl<I, O, A, F> Iterator for TakeEpisodes<I> where
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
where
Self: Sized,
{ ... }
fn take_aligned_steps(
self,
min_steps: usize,
slack: usize
) -> TakeAlignedSteps<Self>ⓘNotable traits for TakeAlignedSteps<I>impl<I, O, A, F> Iterator for TakeAlignedSteps<I> where
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
where
Self: Sized,
{ ... }
fn fold_transient<B, G>(self, init: B, g: G) -> B
where
G: FnMut(B, TransientStep<'_, O, A, F>) -> B,
Self: Sized,
{ ... }
fn for_each_transient<G>(self, g: G)
where
G: FnMut(TransientStep<'_, O, A, F>),
Self: Sized,
{ ... }
fn map_transient<B, G>(self, g: G) -> MapTransient<Self, G>ⓘNotable traits for MapTransient<I, G>impl<I, G, O, A, F, B> Iterator for MapTransient<I, G> where
I: Iterator<Item = PartialStep<O, A, F>>,
G: FnMut(TransientStep<'_, O, A, F>) -> B, type Item = B;
where
G: FnMut(TransientStep<'_, O, A, G>) -> B,
Self: Sized,
{ ... }
}
Expand description
An iterator of simulation steps.
Provided Methods
fn summarize(self) -> StepsSummary<F> where
Self: Sized,
F: Feedback,
fn summarize(self) -> StepsSummary<F> where
Self: Sized,
F: Feedback,
Consume all steps and produce a summary of the step statistics.
fn take_episodes(self, n: usize) -> TakeEpisodes<Self>ⓘNotable traits for TakeEpisodes<I>impl<I, O, A, F> Iterator for TakeEpisodes<I> where
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
where
Self: Sized,
fn take_episodes(self, n: usize) -> TakeEpisodes<Self>ⓘNotable traits for TakeEpisodes<I>impl<I, O, A, F> Iterator for TakeEpisodes<I> where
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
where
Self: Sized,
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
Creates an iterator that yields steps from the first n
episodes.
fn take_aligned_steps(
self,
min_steps: usize,
slack: usize
) -> TakeAlignedSteps<Self>ⓘNotable traits for TakeAlignedSteps<I>impl<I, O, A, F> Iterator for TakeAlignedSteps<I> where
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
where
Self: Sized,
fn take_aligned_steps(
self,
min_steps: usize,
slack: usize
) -> TakeAlignedSteps<Self>ⓘNotable traits for TakeAlignedSteps<I>impl<I, O, A, F> Iterator for TakeAlignedSteps<I> where
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
where
Self: Sized,
I: Iterator<Item = PartialStep<O, A, F>>, type Item = PartialStep<O, A, F>;
Creates an iterator of at least min_steps
and at most min_steps + slack
steps.
Ends on the first episode boundary in this interval.
fn fold_transient<B, G>(self, init: B, g: G) -> B where
G: FnMut(B, TransientStep<'_, O, A, F>) -> B,
Self: Sized,
fn fold_transient<B, G>(self, init: B, g: G) -> B where
G: FnMut(B, TransientStep<'_, O, A, F>) -> B,
Self: Sized,
Fold each step viewed as a TransientStep
into an accumulator using a closure.
This is the equivalent of Iterator::fold
on an iterator of TransientStep
except that such an iterator cannot be created without generic associated types.
If the final step.next
is Successor::Continue
then that step is skipped since the
successor observation is missing. The code in this module avoids creating such an
abruptly-ending steps iterator but it is possible with the standard iterator methods like
take(n)
.
fn for_each_transient<G>(self, g: G) where
G: FnMut(TransientStep<'_, O, A, F>),
Self: Sized,
fn for_each_transient<G>(self, g: G) where
G: FnMut(TransientStep<'_, O, A, F>),
Self: Sized,
Call a closure on each step viewed as a TransientStep
.
This is the equivalent of Iterator::for_each
on an iterator of TransientStep
except that such an iterator cannot be created without generic associated types.
If the final step.next
is Successor::Continue
then that step is skipped since the
successor observation is missing. This situation should not arise if using take_episodes
or take_aligned_steps
.
fn map_transient<B, G>(self, g: G) -> MapTransient<Self, G>ⓘNotable traits for MapTransient<I, G>impl<I, G, O, A, F, B> Iterator for MapTransient<I, G> where
I: Iterator<Item = PartialStep<O, A, F>>,
G: FnMut(TransientStep<'_, O, A, F>) -> B, type Item = B;
where
G: FnMut(TransientStep<'_, O, A, G>) -> B,
Self: Sized,
fn map_transient<B, G>(self, g: G) -> MapTransient<Self, G>ⓘNotable traits for MapTransient<I, G>impl<I, G, O, A, F, B> Iterator for MapTransient<I, G> where
I: Iterator<Item = PartialStep<O, A, F>>,
G: FnMut(TransientStep<'_, O, A, F>) -> B, type Item = B;
where
G: FnMut(TransientStep<'_, O, A, G>) -> B,
Self: Sized,
I: Iterator<Item = PartialStep<O, A, F>>,
G: FnMut(TransientStep<'_, O, A, F>) -> B, type Item = B;
Map each step viewed as a TransientStep
.
This is the equivalent of Iterator::map
on an iterator of TransientStep
except that such an iterator cannot be created without generic associated types.
If the final step.next
is Successor::Continue
then that step is skipped since the
successor observation is missing. This situation should not arise if using take_episodes
or take_aligned_steps
.