|
bitsim
Model, simulate, estimate and control robots in C++
|
Typedefs | |
| template<typename T> | |
| using | DynMat |
| Dynamically sized matrix to use around the library. | |
| template<typename T> | |
| using | DynVec |
| Dynamically sized row vector. | |
| using | real_t |
| real_t | |
| using | uint_t |
| uint_t | |
| template<typename T> | |
| using | DynVec |
| Dynamically sized row vector. | |
| using | real_t |
| real_t | |
| using | uint_t |
| uint_t | |
Functions | |
| DynMat< real_t > | create_transition_matrix () |
| DynMat< real_t > | compute_matrix_power (const DynMat< real_t > &mat, uint_t power) |
| void | print_matrix (const DynMat< real_t > &mat) |
| real_t | get_reward (real_t prob, uint_t n=10) |
| void | update_record (std::vector< std::vector< real_t > > &records, uint_t action, real_t r) |
| uint_t | get_best_arm (const std::vector< std::vector< real_t > > &records) |
| std::vector< real_t > | get_probs (uint_t n) |
| DynVec< real_t > | extract_part (const std::vector< std::vector< real_t > > &values) |
Variables | |
| const uint_t | N = 10 |
| const auto | N_EXPERIMENTS = 500 |
| const real_t | MAX_REWARD = 11.0 |
| const auto | TAU = 0.7 |
| const uint | SEED = 42 |
Solve the multi-arm bandit problem using soft-max policy. When using a soft-max policy policy we get a distribution of probabilities over the actions. We select the action with the highest probability. For this example we will solve a 10-armed bandit problem, so N=10.
This example is taken from the book: Reinforcement Learning in Action by Manning Publications.
| using bitsim::DynMat |
Dynamically sized matrix to use around the library.
| using bitsim::DynVec |
Dynamically sized row vector.
| using bitsim::DynVec |
Dynamically sized row vector.
| using bitsim::real_t |
| using bitsim::real_t |
| using bitsim::uint_t |
| using bitsim::uint_t |
| const real_t exe::MAX_REWARD = 11.0 |
| const uint_t exe::N = 10 |
| const auto exe::N_EXPERIMENTS = 500 |
| const uint exe::SEED = 42 |
| const auto exe::TAU = 0.7 |