Step

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

Source§

impl<O, A, F, U> Step<O, A, F, U>

Source

pub const fn new( observation: O, action: A, feedback: F, next: Successor<O, U>, ) -> Self

Source

pub const fn episode_done(&self) -> bool

Whether this step is the last of an episode.

Source

pub fn into_partial(self) -> PartialStep<O, A, F>

Source§

impl<O: Clone, A, F> Step<O, A, F, &O>

Source

pub fn into_owned(self) -> Step<O, A, F>

Convert a transient step into an owned step by cloning any borrowed successor observation.

Source§

impl<O, A, F> Step<O, A, F, ()>

Source

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.

Source

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§

Source§

impl<O: Clone, A: Clone, F: Clone, U: Clone> Clone for Step<O, A, F, U>

Source§

fn clone(&self) -> Step<O, A, F, U>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<O: Debug, A: Debug, F: Debug, U: Debug> Debug for Step<O, A, F, U>

Source§

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

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

impl<'a, O, A, F> Extend<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F>
where O: 'a, A: 'a, F: Feedback + 'a,

Source§

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

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<O, A, F: Feedback> Extend<Step<O, A, F, ()>> for OnlineStepsSummary<F>

Source§

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

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F>
where O: 'a, A: 'a, F: Feedback + 'a,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = &'a PartialStep<O, A, F>>,

Creates a value from an iterator. Read more
Source§

impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for StepsSummary<F>
where O: 'a, A: 'a, F: Feedback + 'a,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = &'a PartialStep<O, A, F>>,

Creates a value from an iterator. Read more
Source§

impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for OnlineStepsSummary<F>

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = PartialStep<O, A, F>>,

Creates a value from an iterator. Read more
Source§

impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for StepsSummary<F>

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = PartialStep<O, A, F>>,

Creates a value from an iterator. Read more
Source§

impl<O, A, F> FromIterator<Step<O, A, F, ()>> for VecBuffer<O, A, F>

Source§

fn from_iter<I>(steps: I) -> Self
where I: IntoIterator<Item = PartialStep<O, A, F>>,

Creates a value from an iterator. Read more
Source§

impl<O: PartialEq, A: PartialEq, F: PartialEq, U: PartialEq> PartialEq for Step<O, A, F, U>

Source§

fn eq(&self, other: &Step<O, A, F, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<O: Copy, A: Copy, F: Copy, U: Copy> Copy for Step<O, A, F, U>

Source§

impl<O, A, F, U> StructuralPartialEq for Step<O, A, F, U>

Auto Trait Implementations§

§

impl<O, A, F, U> Freeze for Step<O, A, F, U>
where O: Freeze, A: Freeze, F: Freeze, U: Freeze,

§

impl<O, A, F, U> RefUnwindSafe for Step<O, A, F, U>

§

impl<O, A, F, U> Send for Step<O, A, F, U>
where O: Send, A: Send, F: Send, U: Send,

§

impl<O, A, F, U> Sync for Step<O, A, F, U>
where O: Sync, A: Sync, F: Sync, U: Sync,

§

impl<O, A, F, U> Unpin for Step<O, A, F, U>
where O: Unpin, A: Unpin, F: Unpin, U: Unpin,

§

impl<O, A, F, U> UnwindSafe for Step<O, A, F, U>

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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert into an Any trait reference.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> Wrap for T

Source§

fn wrap<W>(self, wrapper: W) -> Wrapped<Self, W>

Wrap in the given wrapper.