pub struct Bandit<D> { /* private fields */ }
Expand description
A multi-armed bandit
The distribution of each arm has type D
.
Implementations
sourceimpl<D: FromMean<f64>> Bandit<D>
impl<D: FromMean<f64>> Bandit<D>
sourcepub fn from_means<I: IntoIterator<Item = T>, T: Borrow<f64>>(
means: I
) -> Result<Self, D::Error>
pub fn from_means<I: IntoIterator<Item = T>, T: Borrow<f64>>(
means: I
) -> Result<Self, D::Error>
Create a new Bandit from a list of means.
sourceimpl Bandit<Deterministic<f64>>
impl Bandit<Deterministic<f64>>
sourcepub fn from_values<I: IntoIterator<Item = T>, T: Borrow<f64>>(values: I) -> Self
pub fn from_values<I: IntoIterator<Item = T>, T: Borrow<f64>>(values: I) -> Self
Create a new DeterministicBandit
from a list of arm rewards
Trait Implementations
sourceimpl<'de, D> Deserialize<'de> for Bandit<D> where
D: Deserialize<'de>,
impl<'de, D> Deserialize<'de> for Bandit<D> where
D: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<D: Bounded<f64>> EnvStructure for Bandit<D>
impl<D: Bounded<f64>> EnvStructure for Bandit<D>
type ObservationSpace = SingletonSpace
type ActionSpace = IndexSpace
type FeedbackSpace = IntervalSpace<Reward>
sourcefn observation_space(&self) -> Self::ObservationSpace
fn observation_space(&self) -> Self::ObservationSpace
Space containing all possible observations. Read more
sourcefn action_space(&self) -> Self::ActionSpace
fn action_space(&self) -> Self::ActionSpace
The space of all possible actions. Read more
sourcefn feedback_space(&self) -> Self::FeedbackSpace
fn feedback_space(&self) -> Self::FeedbackSpace
The space of all possible feedback. Read more
sourcefn discount_factor(&self) -> f64
fn discount_factor(&self) -> f64
A discount factor applied to future feedback. Read more
sourceimpl<D: Distribution<f64> + Bounded<f64>> Environment for Bandit<D>
impl<D: Distribution<f64> + Bounded<f64>> Environment for Bandit<D>
type Observation = ()
type Observation = ()
Observation of the state provided to the agent.
sourcefn initial_state(&self, _: &mut Prng) -> Self::State
fn initial_state(&self, _: &mut Prng) -> Self::State
Sample a state for the start of a new episode. Read more
sourcefn observe(&self, _: &Self::State, _: &mut Prng) -> Self::State
fn observe(&self, _: &Self::State, _: &mut Prng) -> Self::State
Generate an observation for a given state.
sourcefn step(
&self,
_state: Self::State,
action: &Self::Action,
rng: &mut Prng,
_logger: &mut dyn StatsLogger
) -> (Successor<Self::State>, Self::Feedback)
fn step(
&self,
_state: Self::State,
action: &Self::Action,
rng: &mut Prng,
_logger: &mut dyn StatsLogger
) -> (Successor<Self::State>, Self::Feedback)
Perform a state transition in reponse to an action. Read more
sourcefn run<T, L>(self, actor: T, seed: SimSeed, logger: L) -> Steps<Self, T, Prng, L>ⓘNotable traits for Steps<E, T, R, L>impl<E, T, R, L> Iterator for Steps<E, T, R, L> where
E: Environment,
T: Actor<E::Observation, E::Action>,
R: BorrowMut<Prng>,
L: StatsLogger, type Item = PartialStep<E::Observation, E::Action, E::Feedback>;
where
T: Actor<Self::Observation, Self::Action>,
L: StatsLogger,
Self: Sized,
fn run<T, L>(self, actor: T, seed: SimSeed, logger: L) -> Steps<Self, T, Prng, L>ⓘNotable traits for Steps<E, T, R, L>impl<E, T, R, L> Iterator for Steps<E, T, R, L> where
E: Environment,
T: Actor<E::Observation, E::Action>,
R: BorrowMut<Prng>,
L: StatsLogger, type Item = PartialStep<E::Observation, E::Action, E::Feedback>;
where
T: Actor<Self::Observation, Self::Action>,
L: StatsLogger,
Self: Sized,
E: Environment,
T: Actor<E::Observation, E::Action>,
R: BorrowMut<Prng>,
L: StatsLogger, type Item = PartialStep<E::Observation, E::Action, E::Feedback>;
Run this environment with the given actor.
impl<D: Clone> CloneBuild for Bandit<D>
impl<D: Eq> Eq for Bandit<D>
impl<D> StructuralEq for Bandit<D>
impl<D> StructuralPartialEq for Bandit<D>
Auto Trait Implementations
impl<D> RefUnwindSafe for Bandit<D> where
D: RefUnwindSafe,
impl<D> Send for Bandit<D> where
D: Send,
impl<D> Sync for Bandit<D> where
D: Sync,
impl<D> Unpin for Bandit<D> where
D: Unpin,
impl<D> UnwindSafe for Bandit<D> where
D: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.