bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
multi_armed_bandits.cpp File Reference
#include "bitrl/envs/multi_armed_bandits/multi_armed_bandits.h"
#include "bitrl/base/bitrl_types.h"
#include "bitrl/maths/vector_math.h"
#include "bitrl/rl/policies/epsilon_greedy_policy.h"
#include "bitsim/maths/statistics/distributions/bernoulli_dist.h"
#include "bitsim/maths/statistics/distributions/beta_dist.h"
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <numeric>
#include <random>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
Include dependency graph for multi_armed_bandits.cpp:

Classes

struct  rl_example_2::SamplingResult
class  rl_example_2::MultiArmedBandits
class  rl_example_2::EpsilonGreedyPolicy
 The EpsilonGreedyPolicy class. More...
class  rl_example_2::BernoulliDist
 class BernoulliDist. Wrapper to std::bernoulli_distribution More...
class  rl_example_2::BetaDist< RealType >
 The beta distribution is a real-valued distribution which produces values in the range [0, 1]. It has two parameters, alpha and beta. More...

Namespaces

namespace  rl_example_2

Typedefs

template<typename T>
using rl_example_2::DynMat
 Dynamically sized matrix to use around the library.
template<typename T>
using rl_example_2::DynVec
 Dynamically sized row vector.
using rl_example_2::int_t
 integer type
using rl_example_2::real_t
 real_t
using rl_example_2::uint_t
 uint_t

Functions

void rl_example_2::write_pulls (const std::string &filename, const std::vector< real_t > &p, const std::vector< std::pair< std::string, SamplingResult > > &results)
SamplingResult rl_example_2::run_epsilon_greedy (MultiArmedBandits &env, real_t eps)
SamplingResult rl_example_2::run_thompson_sampling (MultiArmedBandits &env)
int main ()

Variables

uint_t rl_example_2::N_EPISODES = 1000
real_t rl_example_2::EPS = 0.2

Function Documentation

◆ main()

int main ( )

all levers have the same probability of success