Template Class EnvBase¶
Defined in File env_base.h
Inheritance Relationships¶
Base Types¶
public SpaceTypepublic bitrl::envs::synchronized_env_mixin(Struct synchronized_env_mixin)
Derived Types¶
public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 6, 2, 0, real_t > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< VectorTimeStep< detail_::AcrobotVEnv::state_type >, detail_::AcrobotVEnv >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< uint_t >, ScalarDiscreteEnv< state_end, action_end, 0, 0 > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 4, 2, 0, real_t > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< VectorTimeStepType, SpaceType >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateContinuousVectorActionEnv< 8, 2, real_t, real_t > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 8, 4, 0, real_t > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 3, 2, 0, real_t > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateContinuousScalarBoundedActionEnv< 3, 1, RealRange<-2.0, 2.0 >, 0, real_t > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStepType, ScalarDiscreteEnv< state_end, action_end, 0, 0 > >(Template Class GymnasiumEnvBase)public bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStepType, SpaceType >(Template Class GymnasiumEnvBase)
Class Documentation¶
-
template<typename TimeStepType, typename SpaceType>
class EnvBase : public SpaceType, public bitrl::envs::synchronized_env_mixin¶ Base class for environments.
The EnvBase class establishes the minimum contract that an RL environment should expose.
Subclassed by bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 6, 2, 0, real_t > >, bitrl::envs::gymnasium::GymnasiumEnvBase< VectorTimeStep< detail_::AcrobotVEnv::state_type >, detail_::AcrobotVEnv >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< uint_t >, ScalarDiscreteEnv< state_end, action_end, 0, 0 > >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 4, 2, 0, real_t > >, bitrl::envs::gymnasium::GymnasiumEnvBase< VectorTimeStepType, SpaceType >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateContinuousVectorActionEnv< 8, 2, real_t, real_t > >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 8, 4, 0, real_t > >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateDiscreteActionEnv< 3, 2, 0, real_t > >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateContinuousScalarBoundedActionEnv< 3, 1, RealRange<-2.0, 2.0 >, 0, real_t > >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStepType, ScalarDiscreteEnv< state_end, action_end, 0, 0 > >, bitrl::envs::gymnasium::GymnasiumEnvBase< TimeStepType, SpaceType >
Public Types
-
typedef TimeStepType time_step_type¶
The time step type we return every time a step in the environment is performed.
-
typedef SpaceType::state_space state_space_type¶
The type describing the state space for the environment.
Public Functions
-
virtual ~EnvBase() = default¶
Destructor.
-
virtual void make(const std::string &version, const std::unordered_map<std::string, std::any> &options) = 0¶
make. Builds the environment.
- Parameters:
version. – the version of the environment to build
options. – Options to use for building the environment. Concrete classes may choose to hold a copy
-
virtual void close() = 0¶
close the environment
-
virtual time_step_type reset(uint_t seed, const std::unordered_map<std::string, std::any> &options) = 0¶
Reset the environment.
- Parameters:
seed. – The seed to use for resetting the environment
options. – Options to use for resetting the environment.
-
inline time_step_type reset()¶
Reset the environment always using the same seed.
-
inline time_step_type reset(uint_t seed)¶
Reset the environment always using the provided seed.
-
virtual time_step_type step(const action_type &action) = 0¶
step in the environment by performing the given action
- Parameters:
action. – The action to execute in the environment
- Returns:
An instance of time_step_type
-
inline bool is_created() const noexcept¶
is_created Returns true is make has been called successfully
-
inline std::string version() const noexcept¶
Returns the version of the environment.
-
inline std::string env_name() const noexcept¶
Returns the name of the environment.
-
inline const std::unordered_map<std::string, std::any> &make_options() const noexcept¶
Returns a read reference to the options passed when calling make.
Protected Functions
-
explicit EnvBase(const uint_t cidx = 0, const std::string &name = bitrl::consts::INVALID_STR)¶
Constructor.
-
inline void set_version_(const std::string &version) noexcept¶
Helper function to set the version. To be called only when the make is called.
-
inline void set_make_options_(const std::unordered_map<std::string, std::any> &options) noexcept¶
Set the make options.
-
inline void invalidate_is_created_flag_() noexcept¶
-
inline void make_created_() noexcept¶
mark the environment as created
-
inline time_step_type &get_current_time_step_() noexcept¶
-
inline const time_step_type &get_current_time_step_() const noexcept¶
-
typedef TimeStepType time_step_type¶