Implementation of Mountain Car task. More...
Classes | |
| class | State |
| Implementation of state of Mountain Car. More... | |
Public Types | |
| enum | Action { backward , stop , forward , size } |
| Implementation of action of Mountain Car. More... | |
Public Member Functions | |
| MountainCar (const double positionMin=-1.2, const double positionMax=0.6, const double positionGoal=0.5, const double velocityMin=-0.07, const double velocityMax=0.07, const double doneReward=0) | |
| Construct a Mountain Car instance using the given constant. More... | |
| State | InitialSample () const |
| Initial position is randomly generated within [-0.6, -0.4]. 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 Mountain Car. More... | |
| double | Sample (const State &state, const Action &action) const |
| Dynamics of Mountain Car. More... | |
Implementation of Mountain Car task.
Definition at line 27 of file mountain_car.hpp.
| enum Action |
Implementation of action of Mountain Car.
| Enumerator | |
|---|---|
| backward | |
| stop | |
| forward | |
| size | Track the size of the action space. |
Definition at line 78 of file mountain_car.hpp.
|
inline |
Construct a Mountain Car instance using the given constant.
| positionMin | Minimum legal position. |
| positionMax | Maximum legal position. |
| positionGoal | Final target position. |
| velocityMin | Minimum legal velocity. |
| velocityMax | Maximum legal velocity. |
Definition at line 97 of file mountain_car.hpp.
|
inline |
Initial position is randomly generated within [-0.6, -0.4].
Initial velocity is 0.
Definition at line 172 of file mountain_car.hpp.
References MountainCar::State::Position(), and MountainCar::State::Velocity().
|
inline |
Whether given state is a terminal state.
| state | desired state. |
Definition at line 186 of file mountain_car.hpp.
References MountainCar::State::Position().
Referenced by MountainCar::Sample().
Dynamics of Mountain Car.
Get reward and next state based on current state and current action.
| state | The current state. |
| action | The current action. |
| nextState | The next state. |
If done is true , it means that car has reached its goal. To make sure that the agent learns this, we will give some positive reward to the agent. If the agent doesn't reach the terminal state, then we will give a -1.0 reward to penalize the agent to take that step.
Definition at line 120 of file mountain_car.hpp.
References MountainCar::IsTerminal(), MountainCar::State::Position(), and MountainCar::State::Velocity().
Referenced by MountainCar::Sample().
Dynamics of Mountain Car.
Get reward based on current state and current action.
| state | The current state. |
| action | The current action. |
Definition at line 160 of file mountain_car.hpp.
References MountainCar::Sample().