pub trait ReplayBufferBase: ExperienceBufferBase {
    type Config: Clone;
    type Batch;

    // Required methods
    fn build(config: &Self::Config) -> Self;
    fn batch(&mut self, size: usize) -> Result<Self::Batch>;
    fn update_priority(
        &mut self,
        ixs: &Option<Vec<usize>>,
        td_err: &Option<Vec<f32>>
    );
}
Expand description

Interface of replay buffers.

Ones implementing this trait generates a ReplayBufferBase::Batch, which is used to train agents.

Required Associated Types§

source

type Config: Clone

Configuration of the replay buffer.

source

type Batch

Batch generated from the buffer.

Required Methods§

source

fn build(config: &Self::Config) -> Self

Build a replay buffer from Self::Config.

source

fn batch(&mut self, size: usize) -> Result<Self::Batch>

Constructs a batch.

beta - The exponent for priority.

source

fn update_priority( &mut self, ixs: &Option<Vec<usize>>, td_err: &Option<Vec<f32>> )

Updates priority.

Priority is commonly based on TD error.

TODO: Consider to move this method to another trait. There are cases where prioritization is not required.

Implementors§