Template Class Gridworld

Inheritance Relationships

Base Type

  • public bitrl::envs::EnvBase< TimeStep< detail::board_state_type >, detail::GridWorldEnv< side_size_ > > (Template Class EnvBase)

Class Documentation

template<uint_t side_size_>
class Gridworld : public bitrl::envs::EnvBase<TimeStep<detail::board_state_type>, detail::GridWorldEnv<side_size_>>

The Gridworld class models a square board. There are three ways to initialize the board.

  • static

  • random

  • player See the GridworldInitType enumeration. Static initialization means that the objects on the board are initialized at the same predetermined locations. Player initialization means that the player is initialized at a random position on the board. Random initialization means that all the objects are placed randomly

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 Functions

Gridworld()

Constructor.

explicit Gridworld(const uint_t cidx)

Gridworld. Constructor.

Gridworld(const Gridworld &other)

Gridworld. Constructor.

virtual void make(const std::string &version, const std::unordered_map<std::string, std::any> &options) final override

make. Builds the environment. Optionally we can choose if the environment will be slippery

virtual time_step_type reset(uint_t, const std::unordered_map<std::string, std::any>&) final override

Reset the environment.

Gridworld make_copy(uint_t cidx) const

Create a new copy of the environment with the given copy index.

time_step_type step(const action_type &action) final override

step

Parameters:

action

Returns:

virtual void close() final override

close

inline bool has_random_state() const noexcept

has_random_state

Returns:

inline uint_t n_states() const noexcept

n_states. Returns the number of states

inline uint_t n_actions() const noexcept

n_actions. Returns the number of actions

inline uint_t seed() const noexcept

seed

Returns:

inline real_t noise_factor() const noexcept

noise_factor

Returns:

bool is_game_lost() const

Returns true if the PLAYER position is the same as the PIT position.

inline GridWorldInitType init_type() const noexcept

init_type

Returns:

Public Static 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