pub struct PrioritizedReplayBuffer { /* private fields */ }Expand description
Prioritized experience replay buffer backed by a sum-tree.
Implements proportional prioritization with importance-sampling weights.
Implementations§
Source§impl PrioritizedReplayBuffer
impl PrioritizedReplayBuffer
Sourcepub fn new(
capacity: usize,
obs_dim: usize,
act_dim: usize,
alpha: f64,
beta: f64,
) -> Self
pub fn new( capacity: usize, obs_dim: usize, act_dim: usize, alpha: f64, beta: f64, ) -> Self
Create a new prioritized replay buffer.
alpha— prioritization exponent (0 = uniform, 1 = full prioritization)beta— importance-sampling correction exponent (1 = full correction)
Sourcepub fn push_slices(
&mut self,
obs: &[f32],
next_obs: &[f32],
action: &[f32],
reward: f32,
terminated: bool,
truncated: bool,
priority: f64,
) -> Result<(), RloxError>
pub fn push_slices( &mut self, obs: &[f32], next_obs: &[f32], action: &[f32], reward: f32, terminated: bool, truncated: bool, priority: f64, ) -> Result<(), RloxError>
Push a transition with the given TD-error priority.
pub fn push( &mut self, record: ExperienceRecord, priority: f64, ) -> Result<(), RloxError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrioritizedReplayBuffer
impl RefUnwindSafe for PrioritizedReplayBuffer
impl Send for PrioritizedReplayBuffer
impl Sync for PrioritizedReplayBuffer
impl Unpin for PrioritizedReplayBuffer
impl UnwindSafe for PrioritizedReplayBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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