1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#![crate_name = "bandit"]
#![crate_type = "lib"]
#[macro_use]
extern crate serde_derive;
extern crate serde;
use std::path::{PathBuf, Path};
use std::hash::{Hash};
use std::io;
pub mod softmax;
#[derive(Debug, PartialEq, Clone)]
pub struct BanditConfig {
pub log_file: Option<PathBuf>
}
pub static DEFAULT_BANDIT_CONFIG : BanditConfig = BanditConfig{log_file: Option::None};
pub trait MultiArmedBandit<A: Hash + Clone + Identifiable> {
fn select_arm(&self) -> A;
fn update(&mut self, arm: A, reward: f64);
fn save_bandit(&self, path: &Path) -> io::Result<()>;
}
pub trait Identifiable {
fn ident(&self) -> String;
}