Implementation of Cart Pole task. More...
Classes | |
| class | State |
| Implementation of the state of Cart Pole. More... | |
Public Types | |
| enum | Action { backward , forward , size } |
| Implementation of action of Cart Pole. More... | |
Public Member Functions | |
| CartPole (const double gravity=9.8, const double massCart=1.0, const double massPole=0.1, const double length=0.5, const double forceMag=10.0, const double tau=0.02, const double thetaThresholdRadians=12 *2 *3.1416/360, const double xThreshold=2.4) | |
| Construct a Cart Pole instance using the given constants. More... | |
| State | InitialSample () const |
| Initial state representation is randomly generated within [-0.05, 0.05]. More... | |
| bool | IsTerminal (const State &state) const |
| Whether given state is a terminal state. More... | |
| double | Sample (const State &state, const Action &action, State &nextState) const |
| Dynamics of Cart Pole instance. More... | |
| double | Sample (const State &state, const Action &action) const |
| Dynamics of Cart Pole. More... | |
Implementation of Cart Pole task.
Definition at line 26 of file cart_pole.hpp.
| enum Action |
Implementation of action of Cart Pole.
| Enumerator | |
|---|---|
| backward | |
| forward | |
| size | |
Definition at line 87 of file cart_pole.hpp.
|
inline |
Construct a Cart Pole instance using the given constants.
| gravity | The gravity constant. |
| massCart | The mass of the cart. |
| massPole | The mass of the pole. |
| length | The length of the pole. |
| forceMag | The magnitude of the applied force. |
| tau | The time interval. |
| thetaThresholdRadians | The maximum angle. |
| xThreshold | The maximum position. |
Definition at line 108 of file cart_pole.hpp.
|
inline |
Initial state representation is randomly generated within [-0.05, 0.05].
Definition at line 179 of file cart_pole.hpp.
References CartPole::State::State().
|
inline |
Whether given state is a terminal state.
| state | The desired state. |
Definition at line 190 of file cart_pole.hpp.
References CartPole::State::Angle(), and CartPole::State::Position().
Dynamics of Cart Pole instance.
Get reward and next state based on current state and current action.
| state | The current state. |
| action | The current action. |
| nextState | The next state. |
Definition at line 137 of file cart_pole.hpp.
References CartPole::State::Angle(), CartPole::State::AngularVelocity(), CartPole::State::Position(), and CartPole::State::Velocity().
Referenced by CartPole::Sample().
Dynamics of Cart Pole.
Get reward based on current state and current action.
| state | The current state. |
| action | The current action. |
Definition at line 168 of file cart_pole.hpp.
References CartPole::Sample().