Trait TransitionBatch

Source
pub trait TransitionBatch {
    type ObsBatch;
    type ActBatch;

    // Required methods
    fn unpack(
        self,
    ) -> (Self::ObsBatch, Self::ActBatch, Self::ObsBatch, Vec<f32>, Vec<i8>, Vec<i8>, Option<Vec<usize>>, Option<Vec<f32>>);
    fn len(&self) -> usize;
    fn obs(&self) -> &Self::ObsBatch;
}
Expand description

A batch of transitions for training agents.

This trait represents a standard transition (o, a, o', r, is_done), where o is an observation, a is an action, o' is an observation after some time steps. Typically, o' is for the next step and used as single-step backup. o' can also be for the multiple steps after o and in this case it is sometimes called n-step backup.

The type of o and o' is the associated type ObsBatch. The type of a is the associated type ActBatch.

Required Associated Types§

Source

type ObsBatch

A set of observation in a batch.

Source

type ActBatch

A set of observation in a batch.

Required Methods§

Source

fn unpack( self, ) -> (Self::ObsBatch, Self::ActBatch, Self::ObsBatch, Vec<f32>, Vec<i8>, Vec<i8>, Option<Vec<usize>>, Option<Vec<f32>>)

Unpack the data (o_t, a_t, o_t+n, r_t, is_terminated_t, is_truncated_t).

Optionally, the return value has sample indices in the replay buffer and thier weights. Those are used for prioritized experience replay (PER).

Source

fn len(&self) -> usize

Returns the number of samples in the batch.

Source

fn obs(&self) -> &Self::ObsBatch

Returns o_t.

Implementors§