|
bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
|
#include <grid_world_env.h>


Public Types | |
| typedef EnvBase< TimeStep< detail::board_state_type >, detail::GridWorldEnv< side_size_ > > | 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< detail::board_state_type >, detail::GridWorldEnv< side_size_ > > | |
| typedef TimeStep< detail::board_state_type > | time_step_type |
| Alias for the type returned when stepping the environment. | |
| typedef SpaceType::state_space | state_space_type |
| Type describing the environment state space. | |
| typedef SpaceType::state_type | state_type |
| Type describing an individual state. | |
| typedef SpaceType::action_space | action_space_type |
| Type describing the environment action space. | |
| typedef SpaceType::action_type | action_type |
| Type representing an individual action. | |
Public Member Functions | |
| Gridworld () | |
| Constructor. | |
| 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. Optionally we can choose if the environment will be slippery | |
| time_step_type | reset () override final |
| Reset the environment. | |
| time_step_type | step (const action_type &action) override final |
| step | |
| void | close () override final |
| close | |
| bool | has_random_state () const noexcept |
| has_random_state | |
| uint_t | n_states () const noexcept |
| n_states. Returns the number of states | |
| uint_t | n_actions () const noexcept |
| n_actions. Returns the number of actions | |
| uint_t | seed () const noexcept |
| seed | |
| real_t | noise_factor () const noexcept |
| noise_factor | |
| bool | is_game_lost () const |
| Returns true if the PLAYER position is the same as the PIT position. | |
| GridWorldInitType | init_type () const noexcept |
| init_type | |
Public Member Functions inherited from bitrl::envs::EnvBase< TimeStep< detail::board_state_type >, detail::GridWorldEnv< side_size_ > > | |
| 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(). | |
Static Public Member Functions | |
| static uint_t | n_copies () |
Static Public Attributes | |
| static const std::string | name = "Gridworld" |
| name | |
| static const uint_t | n_components = 4 |
| n_components | |
| static const uint_t | side_size = side_size_ |
| side_size | |
Static Public Attributes inherited from bitrl::envs::EnvBase< TimeStep< detail::board_state_type >, detail::GridWorldEnv< side_size_ > > | |
| static const 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< detail::board_state_type >, detail::GridWorldEnv< side_size_ > > | |
| EnvBase (const std::string &idx=bitrl::consts::INVALID_STR, const std::string &name=bitrl::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. | |
| 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. | |
The Gridworld class models a square board. There are three ways to initialize the board.
| typedef base_type::action_space_type bitrl::envs::grid_world::Gridworld< side_size_ >::action_space_type |
The type of the action space for the environment.
| typedef base_type::action_type bitrl::envs::grid_world::Gridworld< side_size_ >::action_type |
The type of the action to be undertaken in the environment.
| typedef EnvBase<TimeStep<detail::board_state_type>, detail::GridWorldEnv<side_size_> > bitrl::envs::grid_world::Gridworld< side_size_ >::base_type |
The base_type.
| typedef base_type::state_space_type bitrl::envs::grid_world::Gridworld< side_size_ >::state_space_type |
The type describing the state space for the environment.
| typedef base_type::state_type bitrl::envs::grid_world::Gridworld< side_size_ >::state_type |
The type of the action to be undertaken in the environment.
| typedef base_type::time_step_type bitrl::envs::grid_world::Gridworld< side_size_ >::time_step_type |
The time step type we return every time a step in the environment is performed.
| bitrl::envs::grid_world::Gridworld< side_size_ >::Gridworld | ( | ) |
Constructor.
|
finaloverridevirtual |
|
inlinenoexcept |
has_random_state
|
inlinenoexcept |
init_type
| bool bitrl::envs::grid_world::Gridworld< side_size_ >::is_game_lost | ( | ) | const |
Returns true if the PLAYER position is the same as the PIT position.
|
finaloverridevirtual |
make. Builds the environment. Optionally we can choose if the environment will be slippery
Implements bitrl::envs::EnvBase< TimeStep< detail::board_state_type >, detail::GridWorldEnv< side_size_ > >.
|
inlinenoexcept |
n_actions. Returns the number of actions
|
inlinestatic |
Get the number of copies of this class
|
inlinenoexcept |
n_states. Returns the number of states
|
inlinenoexcept |
noise_factor
|
finaloverridevirtual |
Reset the environment.
Implements bitrl::envs::EnvBase< TimeStep< detail::board_state_type >, detail::GridWorldEnv< side_size_ > >.
|
inlinenoexcept |
seed
|
finaloverride |
step
| action |
|
static |
n_components
|
static |
name
|
static |
side_size