|
bitsim
Model, simulate, estimate and control robots in C++
|
#include <multi_armed_bandits.h>


Public Types | |
| typedef EnvBase< TimeStep< bool >, MultiArmedBanditsSpace > | base_type |
| The base type. | |
| typedef base_type::time_step_type | time_step_type |
| The time step type we return every time a step in the environment is performed. | |
| typedef base_type::state_space_type | state_space_type |
| The type describing the state space for the environment. | |
| typedef base_type::action_space_type | action_space_type |
| The type of the action space for the environment. | |
| typedef base_type::action_type | action_type |
| The type of the action to be undertaken in the environment. | |
| typedef base_type::state_type | state_type |
| The type of the action to be undertaken in the environment. | |
| Public Types inherited from bitrl::envs::EnvBase< TimeStep< bool >, MultiArmedBanditsSpace > | |
| typedef TimeStep< bool > | time_step_type |
| Alias for the type returned when stepping the environment. | |
| typedef MultiArmedBanditsSpace::state_space | state_space_type |
| Type describing the environment state space. | |
| typedef MultiArmedBanditsSpace::state_type | state_type |
| Type describing an individual state. | |
| typedef MultiArmedBanditsSpace::action_space | action_space_type |
| Type describing the environment action space. | |
| typedef MultiArmedBanditsSpace::action_type | action_type |
| Type representing an individual action. | |
Public Member Functions | |
| MultiArmedBandits () | |
| MultiArmedBandits Constructor. | |
| virtual void | make (const std::string &version, const std::unordered_map< std::string, std::any > &options, const std::unordered_map< std::string, std::any > &reset_options) override final |
| make. Builds the environment. | |
| virtual void | close () override final |
| close the environment | |
| virtual time_step_type | reset () override final |
| Reset the environment. | |
| virtual time_step_type | step (const action_type &action) override final |
| step in the environment by performing the given action | |
| uint_t | n_actions () const noexcept |
| Return the number of actions. | |
| real_t | success_reward () const noexcept |
| Returns the sucees reward. | |
| real_t | fail_reward () const noexcept |
| Returns the fail reward. | |
| Public Member Functions inherited from bitrl::envs::EnvBase< TimeStep< bool >, MultiArmedBanditsSpace > | |
| virtual | ~EnvBase ()=default |
| Virtual destructor. | |
| virtual time_step_type | step (const action_type &action)=0 |
| Perform one step in the environment using an action. | |
| const std::unordered_map< std::string, std::any > & | make_options () const noexcept |
| Access the configuration options provided to make(). | |
| const std::unordered_map< std::string, std::any > & | reset_options () const noexcept |
| Access the configuration options provided to make(). | |
| T | read_option (const std::string &op_name) const |
| Read a specific make() option and cast it to the requested type. | |
| std::string | idx () const noexcept |
| Get the id identifying this environment within a simulation batch. The id is valid only if make has been called. | |
| bool | is_created () const noexcept |
| Check if make() has successfully initialized the environment. | |
| std::string | env_name () const noexcept |
| Get the name of this environment instance. | |
| std::string | version () const noexcept |
| Get the environment version set during make(). | |
| uint_t | last_reset_seed () const noexcept |
| The seed of the latest reset(), for the environments that take one. The first reset after make() uses the "seed" reset option, or DEFAULT_ENV_SEED, and every reset after it the next seed, so that the episodes start differently and a run is the same every time. | |
Static Public Member Functions | |
| static uint_t | n_copies () |
Static Public Attributes | |
| static const std::string | name |
| name | |
| Static Public Attributes inherited from bitrl::envs::EnvBase< TimeStep< bool >, MultiArmedBanditsSpace > | |
| static constexpr uint_t | DEFAULT_ENV_SEED |
| Default seed used in reset() if none provided. | |
Additional Inherited Members | |
| Protected Member Functions inherited from bitrl::envs::EnvBase< TimeStep< bool >, MultiArmedBanditsSpace > | |
| EnvBase (const std::string &idx=bitsim::consts::INVALID_STR, const std::string &name=bitsim::consts::INVALID_STR) | |
| Constructor (protected — for subclassing only). | |
| EnvBase (const EnvBase &) | |
| Copy constructor. | |
| void | set_version_ (const std::string &version) noexcept |
| Set internal version string. | |
| void | set_idx_ (const std::string &idx) noexcept |
| Set the id of the environment. | |
| void | set_make_options_ (const std::unordered_map< std::string, std::any > &options) noexcept |
| Store options for future access. | |
| void | set_reset_options_ (const std::unordered_map< std::string, std::any > &options) noexcept |
| Store reset options for future access. | |
| uint_t | next_reset_seed_ () |
| The seed for the next reset: the "seed" reset option, or DEFAULT_ENV_SEED, plus the number of resets since make(). | |
| void | invalidate_is_created_flag_ () noexcept |
| Mark environment as not created. | |
| void | make_created_ () noexcept |
| Mark environment creation as successful. | |
| time_step_type & | get_current_time_step_ () noexcept |
| Mutable access to the current time step. | |
| const time_step_type & | get_current_time_step_ () const noexcept |
| Read-only access to the current time step. | |
class MultiArmedBandits. Environment for simulating armed-bandits The bandits are represented as Bernoulli distribution. At each step only one bandit can be executed
| typedef base_type::action_space_type bitrl::envs::bandits::MultiArmedBandits::action_space_type |
The type of the action space for the environment.
| typedef base_type::action_type bitrl::envs::bandits::MultiArmedBandits::action_type |
The type of the action to be undertaken in the environment.
| typedef EnvBase<TimeStep<bool>, MultiArmedBanditsSpace> bitrl::envs::bandits::MultiArmedBandits::base_type |
The base type.
| typedef base_type::state_space_type bitrl::envs::bandits::MultiArmedBandits::state_space_type |
The type describing the state space for the environment.
| typedef base_type::state_type bitrl::envs::bandits::MultiArmedBandits::state_type |
The type of the action to be undertaken in the environment.
| typedef base_type::time_step_type bitrl::envs::bandits::MultiArmedBandits::time_step_type |
The time step type we return every time a step in the environment is performed.
|
finaloverridevirtual |
close the environment
Implements bitrl::envs::EnvBase< TimeStep< bool >, MultiArmedBanditsSpace >.
|
inlinenoexcept |
Returns the fail reward.
|
finaloverridevirtual |
make. Builds the environment.
| version | The version of the environment to build |
| options | Options to use for building the environment. Concrete classes may choose to hold a copy |
| reset_options | The options to use when the environment is reset |
Implements bitrl::envs::EnvBase< TimeStep< bool >, MultiArmedBanditsSpace >.
|
inlinenoexcept |
Return the number of actions.
|
inlinestatic |
Get the number of copies of this class
|
finaloverridevirtual |
Reset the environment.
Implements bitrl::envs::EnvBase< TimeStep< bool >, MultiArmedBanditsSpace >.
|
finaloverridevirtual |
step in the environment by performing the given action
| action | The action to execute in the environment |
|
inlinenoexcept |
Returns the sucees reward.
|
static |
name