1#ifndef TOY_TEXT_BASE_ENV_H
2#define TOY_TEXT_BASE_ENV_H
4#include "bitrl/base/bitrl_config.h"
9#include "bitsim/extern/nlohmann/json/json.hpp"
14#include <unordered_map>
31template <
typename TimeStepType, u
int_t state_end, u
int_t action_end>
33 :
public GymnasiumEnvBase<TimeStepType, ScalarDiscreteEnv<state_end, action_end, 0, 0>>
71 typedef std::vector<std::tuple<real_t, uint_t, real_t, bool>>
dynamics_t;
112template <
typename TimeStepType, u
int_t state_end, u
int_t action_end>
119template <
typename TimeStepType, u
int_t state_end, u
int_t action_end>
126template <
typename TimeStepType, u
int_t state_end, u
int_t action_end>
132 assert(this->
is_created() &&
"Environment has not been created");
139template <
typename TimeStepType, u
int_t state_end, u
int_t action_end>
142 const nlohmann::json &response)
const
144 auto dynamics = response[
"dynamics"];
SpaceType::state_space state_space_type
Type describing the environment state space.
Definition env_base.h:45
SpaceType::state_type state_type
Type describing an individual state.
Definition env_base.h:48
SpaceType::action_space action_space_type
Type describing the environment action space.
Definition env_base.h:51
TimeStepType time_step_type
Alias for the type returned when stepping the environment.
Definition env_base.h:42
SpaceType::action_type action_type
Type representing an individual action.
Definition env_base.h:54
std::string idx() const noexcept
Definition env_base.h:125
bool is_created() const noexcept
Definition env_base.h:131
std::string env_name() const noexcept
Definition env_base.h:137
GymnasiumEnvBase(network::RESTRLEnvClient &api_server, const std::string &name)
Definition gymnasium_env_base.h:139
network::RESTRLEnvClient & get_api_server() const
Definition gymnasium_env_base.h:98
base_type::time_step_type time_step_type
Definition toy_text_base.h:46
virtual ~ToyTextEnvBase()=default
~FrozenLake. Destructor.
std::vector< std::tuple< real_t, uint_t, real_t, bool > > dynamics_t
Definition toy_text_base.h:71
base_type::action_type action_type
Definition toy_text_base.h:61
base_type::action_space_type action_space_type
Definition toy_text_base.h:56
base_type::state_type state_type
Definition toy_text_base.h:66
ToyTextEnvBase(network::RESTRLEnvClient &api_server, const std::string &name)
Constructor.
Definition toy_text_base.h:113
virtual dynamics_t build_dynamics_from_response_(const nlohmann::json &response) const
build the dynamics from response
Definition toy_text_base.h:141
GymnasiumEnvBase< TimeStep< std::vector< uint_t > >, ScalarDiscreteEnv< state_end, action_end, 0, 0 > >::base_type base_type
Definition toy_text_base.h:40
base_type::state_space_type state_space_type
Definition toy_text_base.h:51
uint_t n_states() const noexcept
Number of states.
Definition toy_text_base.h:93
uint_t n_actions() const noexcept
n_actions. Returns the number of actions
Definition toy_text_base.h:88
ToyTextEnvBase(const ToyTextEnvBase &other)
Copy constructor.
Definition toy_text_base.h:120
dynamics_t p(uint_t sidx, uint_t aidx) const
P.
Definition toy_text_base.h:128
Utility class to facilitate HTTP requests between the environments REST API and C++ drivers.
Definition rest_rl_env_client.h:28
Definition lunar_lander_env.h:18
Various utilities used when working with RL problems.
Definition bitrl_log.h:25
Models of how things move: wheeled robots, a bicycle, a quadrotor and a fixed wing aircraft,...
Definition bicycle_vehicle_model_dynamics.cpp:10
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
Definition env_types.h:13