|
| typedef EnvBase< TimeStep< std::vector< real_t > >, ContinuousVectorStateContinuousVectorActionEnv< 5, 1, real_t, real_t > > | base_type |
| typedef base_type::time_step_type | time_step_type |
| typedef base_type::state_type | state_type |
| typedef base_type::action_type | action_type |
| typedef TimeStep< std::vector< real_t > > | time_step_type |
| | Alias for the type returned when stepping the environment.
|
| typedef ContinuousVectorStateContinuousVectorActionEnv< 5, 1, real_t, real_t >::state_space | state_space_type |
| | Type describing the environment state space.
|
| typedef ContinuousVectorStateContinuousVectorActionEnv< 5, 1, real_t, real_t >::state_type | state_type |
| | Type describing an individual state.
|
| typedef ContinuousVectorStateContinuousVectorActionEnv< 5, 1, real_t, real_t >::action_space | action_space_type |
| | Type describing the environment action space.
|
| typedef ContinuousVectorStateContinuousVectorActionEnv< 5, 1, real_t, real_t >::action_type | action_type |
| | Type representing an individual action.
|
| typedef ContinuousVectorSpace< StateSpaceSize, StateSpaceItemType > | state_space |
| | The type of the state space.
|
| typedef state_space::space_item_type | state_type |
| | The type of state.
|
| typedef ContinuousVectorSpace< ActionSpaceSize, ActionSpaceItemType > | action_space |
| | The type of the action space.
|
| typedef action_space::space_item_type | action_type |
| | The type of action.
|
|
| | CartPoleSwingUp () |
| void | make (const std::string &version, const std::unordered_map< std::string, std::any > &make_options, const std::unordered_map< std::string, std::any > &reset_options) override |
| | Construct the environment instance.
|
| void | close () override |
| | Close and release any acquired environment resources.
|
| time_step_type | reset () override |
| | Start an episode with the next seed.
|
| time_step_type | reset (uint_t seed) |
| | Start an episode with the given seed.
|
| time_step_type | step (const action_type &action) override |
| | Push the cart with action[0] newtons, positive towards +x.
|
| uint_t | n_steps () const noexcept |
| uint_t | max_steps () const noexcept |
| real_t | dt () const noexcept |
| real_t | angle () const |
| | The angle of the pole from upright, in (-pi, pi].
|
| const bitsim::dynamics::CartPoleDynamics & | dynamics () const noexcept |
| virtual | ~EnvBase ()=default |
| | Virtual destructor.
|
| 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().
|
| uint_t | last_reset_seed () const noexcept |
| | The seed of the latest reset(), for the environments that take one. The first reset after make() uses the "seed" reset option, or DEFAULT_ENV_SEED, and every reset after it the next seed, so that the episodes start differently and a run is the same every time.
|
Swing the pole of a cart-pole up from hanging down, and keep it up, with a force that can take any value, simulated with bitsim::dynamics::CartPoleDynamics.
The cart and the pole are those of CartPole, but the pole starts hanging down, and no push of max_force lifts it at once: the cart has to pump energy into the swing, back and forth, and then catch the pole at the top and balance it, all within the track. The action is the force on the cart [N], a vector of one value, limited to [-max_force, max_force].
The observation is [x, x_dot, sin(theta), cos(theta), theta_dot], theta from upright. Every step is worth (1 + cos(theta)) / 2, from 0 hanging down to 1 upright, minus 0.02 x^2 to keep the cart near the centre. An episode starts with the pole within 0.05 rad of hanging down and every other value uniform in [-0.05, 0.05], drawn with the seed of the reset. It ends when the cart leaves the track, which costs off_track_penalty, or after max_steps steps; then the time step's extra "truncated" is true. The extra "upright" says whether the pole is within 12 degrees of upright.
Make options, all optional: "max_steps" (uint_t, 500), "dt" (real_t, 0.02), "max_force" (real_t, 10.0), "off_track_penalty" (real_t, 100.0). Reset option: "seed" (uint_t), the seed of the first reset; every reset after it takes the next seed.