Trait ReplayBufferBase

Source
pub trait ReplayBufferBase {
    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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§