[][src]Trait ratel_bandit::Agent

pub trait Agent<T: ToPrimitive> {
    fn action(&self) -> usize;
fn q_star(&self) -> &Vec<f64>;
fn reset(&mut self, q_init: Vec<f64>);
fn step(&mut self, arm: usize, reward: T);
fn stepper(&mut self) -> &mut dyn Stepper; fn arms(&self) -> usize { ... }
fn current_estimate(&self, arm: usize) -> f64 { ... }
fn update(&mut self, arm: usize, reward: T) -> f64 { ... } }

A trait for common members of the Agents.

Required methods

fn action(&self) -> usize

The action chosen by the Agent.

fn q_star(&self) -> &Vec<f64>

The Agent's current estimate of all the Bandit's arms.

fn reset(&mut self, q_init: Vec<f64>)

Reset the Agent's history and give it a new initial guess of the Bandit's arm values.

fn step(&mut self, arm: usize, reward: T)

Update the Agent's estimate of a Bandit arm based on a given reward.

fn stepper(&mut self) -> &mut dyn Stepper

Returns a reference to the Agent's step size update rule.

Loading content...

Provided methods

fn arms(&self) -> usize

The number of arms in the Bandit the Agent is playing.

fn current_estimate(&self, arm: usize) -> f64

The Agent's current estimate of the value of a Bandit's arm.

fn update(&mut self, arm: usize, reward: T) -> f64

Calculate the update of the Agent's guess of a Bandit arm based on a given reward.

Loading content...

Implementors

impl<'a, T: ToPrimitive> Agent<T> for EpsilonGreedyAgent<'a, T>[src]

fn action(&self) -> usize[src]

The action chosen by the Agent. A random action with probability epsilon and the greedy action otherwise.

fn q_star(&self) -> &Vec<f64>[src]

The Agent's current estimate of all the Bandit's arms.

fn reset(&mut self, q_init: Vec<f64>)[src]

Reset the Agent's history and give it a new initial guess of the Bandit's arm values.

fn step(&mut self, arm: usize, reward: T)[src]

Update the Agent's estimate of a Bandit arm based on a given reward.

fn stepper(&mut self) -> &mut dyn Stepper[src]

Returns a reference to the Agent's step size update rule.

impl<'a, T: ToPrimitive> Agent<T> for GreedyAgent<'a, T>[src]

fn action(&self) -> usize[src]

The action chosen by the Agent. Picks the arm with the highest estimated return.

fn q_star(&self) -> &Vec<f64>[src]

The Agent's current estimate of all the Bandit's arms.

fn reset(&mut self, q_init: Vec<f64>)[src]

Reset the Agent's history and give it a new initial guess of the Bandit's arm values.

fn step(&mut self, arm: usize, reward: T)[src]

Update the Agent's estimate of a Bandit arm based on a given reward.

fn stepper(&mut self) -> &mut dyn Stepper[src]

Returns a reference to the Agent's step size update rule.

impl<'a, T: ToPrimitive> Agent<T> for OptimisticAgent<'a, T>[src]

fn action(&self) -> usize[src]

The action chosen by the Agent. The agent chooses the action with the highest confidence bound.

fn q_star(&self) -> &Vec<f64>[src]

The Agent's current estimate of all the Bandit's arms.

fn reset(&mut self, q_init: Vec<f64>)[src]

Reset the Agent's history and give it a new initial guess of the Bandit's arm values.

fn step(&mut self, arm: usize, reward: T)[src]

Update the Agent's totals and estimate of a Bandit arm based on a given reward.

fn stepper(&mut self) -> &mut dyn Stepper[src]

Returns a reference to the Agent's step size update rule.

Loading content...