pub struct Random<A> { /* private fields */ }Expand description
Random selection policy - selects arms uniformly at random
While the selection is random, this policy still tracks reward statistics to provide meaningful expected rewards in the expectations() method.
Trait Implementations§
Source§impl<A> Policy<A> for Random<A>
impl<A> Policy<A> for Random<A>
Source§fn update(&mut self, decision: &A, _context: (), reward: f64)
fn update(&mut self, decision: &A, _context: (), reward: f64)
Update the policy with an observed reward for a single decision Read more
Source§fn select(
&self,
arms: &IndexSet<A>,
_context: (),
rng: &mut dyn RngCore,
) -> Option<A>
fn select( &self, arms: &IndexSet<A>, _context: (), rng: &mut dyn RngCore, ) -> Option<A>
Select an arm from the available arms given a context Read more
Source§fn expectations(
&self,
arms: &IndexSet<A>,
_context: (),
_rng: &mut dyn RngCore,
) -> HashMap<A, f64>
fn expectations( &self, arms: &IndexSet<A>, _context: (), _rng: &mut dyn RngCore, ) -> HashMap<A, f64>
Get the expected reward for each arm given a context Read more
Auto Trait Implementations§
impl<A> Forget for Random<A>
impl<A> Freeze for Random<A>
impl<A> RefUnwindSafe for Random<A>where
HashMap<A, ArmStats>: RefUnwindSafe,
impl<A> Send for Random<A>
impl<A> Sync for Random<A>
impl<A> Unpin for Random<A>
impl<A> UnsafeUnpin for Random<A>where
HashMap<A, ArmStats>: UnsafeUnpin,
impl<A> UnwindSafe for Random<A>where
HashMap<A, ArmStats>: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.