bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
cliff_world_env.h
Go to the documentation of this file.
1#ifndef CLIFF_WORLD_H
2#define CLIFF_WORLD_H
3
39#include "bitrl/bitrl_types.h"
42#include "bitrl/extern/nlohmann/json/json.hpp"
44
45#include <any>
46#include <string>
47#include <tuple>
48#include <unordered_map>
49
50namespace bitrl
51{
52namespace envs::gymnasium
53{
54
58class CliffWorld final : public ToyTextEnvBase<TimeStep<uint_t>, 37, 4>
59{
60
61 public:
65 static const std::string name;
66
70 static const std::string URI;
71
75 typedef std::vector<std::tuple<real_t, uint_t, real_t, bool>> dynamics_type;
76
81
87
91 typedef typename base_type::state_space_type state_space_type;
92
96 typedef typename base_type::action_space_type action_space_type;
97
101 typedef typename base_type::action_type action_type;
102
106 typedef typename base_type::state_type state_type;
107
112
116 CliffWorld(const CliffWorld &other);
117
121 ~CliffWorld() = default;
122
127 virtual void
128 make(const std::string &version, const std::unordered_map<std::string, std::any> &options,
129 const std::unordered_map<std::string, std::any> &reset_options) override final;
130
136 virtual time_step_type step(const action_type &action) override final;
137
138 protected:
143
147 virtual time_step_type
148 create_time_step_from_response_(const nlohmann::json &response) const override final;
149};
150
151} // namespace envs::gymnasium
152} // namespace bitrl
153#endif // CLIFF_WORLD_H
const std::unordered_map< std::string, std::any > & reset_options() const noexcept
Access the configuration options provided to make().
Definition env_base.h:104
TimeStepType time_step_type
Alias for the type returned when stepping the environment.
Definition env_base.h:41
std::string version() const noexcept
Get the environment version set during make().
Definition env_base.h:142
The CliffWorld class.
Definition cliff_world_env.h:59
virtual time_step_type step(const action_type &action) override final
step
Definition cliff_world_env.cpp:75
ToyTextEnvBase< TimeStep< uint_t >, 37, 4 >::base_type base_type
The base type.
Definition cliff_world_env.h:80
~CliffWorld()=default
~CliffWorld. Destructor
std::vector< std::tuple< real_t, uint_t, real_t, bool > > dynamics_type
dynamics_t
Definition cliff_world_env.h:75
base_type::action_type action_type
The type of the action to be undertaken in the environment.
Definition cliff_world_env.h:101
base_type::action_space_type action_space_type
The type of the action space for the environment.
Definition cliff_world_env.h:96
static const std::string URI
The URI for accessing the environment.
Definition cliff_world_env.h:70
base_type::time_step_type time_step_type
The time step type we return every time a step in the environment is performed.
Definition cliff_world_env.h:86
static const std::string name
name
Definition cliff_world_env.h:65
virtual time_step_type create_time_step_from_response_(const nlohmann::json &response) const override final
Handle the reset response from the environment server.
Definition cliff_world_env.cpp:24
uint_t max_episode_steps_
Maximum episodes per step.
Definition cliff_world_env.h:142
base_type::state_space_type state_space_type
The type describing the state space for the environment.
Definition cliff_world_env.h:91
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. Optionally we can choose if the environment will be slippery
Definition cliff_world_env.cpp:50
base_type::state_type state_type
The type of the action to be undertaken in the environment.
Definition cliff_world_env.h:106
ToyTextEnvBase class. Base class for toy environments from Gymnasium. These environments have a discr...
Definition toy_text_base.h:34
Utility class to facilitate HTTP requests between the environments REST API and C++ drivers.
Definition rest_rl_env_client.h:29
Definition bitrl_consts.h:14
std::size_t uint_t
uint_t
Definition bitrl_types.h:43