pub struct ExperienceReplayBuffer { /* private fields */ }Expand description
Experience replay buffer
Implementations§
Source§impl ExperienceReplayBuffer
impl ExperienceReplayBuffer
pub fn new(config: ExperienceReplayConfig) -> Self
Sourcepub fn add(&mut self, experience: Experience)
pub fn add(&mut self, experience: Experience)
Add experience to buffer
Sourcepub fn sample(
&mut self,
batch_size: usize,
) -> Result<Vec<Experience>, Box<dyn Error>>
pub fn sample( &mut self, batch_size: usize, ) -> Result<Vec<Experience>, Box<dyn Error>>
Sample batch of experiences
Sourcepub fn replay_update(
&mut self,
optimizer: &mut dyn OptimizationLearner,
) -> Result<ReplayResult, Box<dyn Error>>
pub fn replay_update( &mut self, optimizer: &mut dyn OptimizationLearner, ) -> Result<ReplayResult, Box<dyn Error>>
Replay experiences to improve optimizer
Auto Trait Implementations§
impl Freeze for ExperienceReplayBuffer
impl RefUnwindSafe for ExperienceReplayBuffer
impl Send for ExperienceReplayBuffer
impl Sync for ExperienceReplayBuffer
impl Unpin for ExperienceReplayBuffer
impl UnwindSafe for ExperienceReplayBuffer
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