Implementation of Mountain Car task.
More...
#include <mountain_car.hpp>
|
| MountainCar (const size_t maxSteps=200, 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...
|
|
double | Sample (const State &state, const Action &action, State &nextState) |
| Dynamics of Mountain Car. More...
|
|
double | Sample (const State &state, const Action &action) |
| Dynamics of Mountain Car. More...
|
|
State | InitialSample () |
| Initial position is randomly generated within [-0.6, -0.4]. More...
|
|
bool | IsTerminal (const State &state) const |
| This function checks if the car has reached the terminal state. More...
|
|
size_t | StepsPerformed () const |
| Get the number of steps performed.
|
|
size_t | MaxSteps () const |
| Get the maximum number of steps allowed.
|
|
size_t & | MaxSteps () |
| Set the maximum number of steps allowed.
|
|
Implementation of Mountain Car task.
◆ MountainCar()
mlpack::rl::MountainCar::MountainCar |
( |
const size_t |
maxSteps = 200 , |
|
|
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 |
|
) |
| |
|
inline |
Construct a Mountain Car instance using the given constant.
- Parameters
-
maxSteps | The number of steps after which the episode terminates. If the value is 0, there is no limit. |
positionMin | Minimum legal position. |
positionMax | Maximum legal position. |
positionGoal | Final target position. |
velocityMin | Minimum legal velocity. |
velocityMax | Maximum legal velocity. |
doneReward | The reward recieved by the agent on success. |
◆ InitialSample()
State mlpack::rl::MountainCar::InitialSample |
( |
| ) |
|
|
inline |
Initial position is randomly generated within [-0.6, -0.4].
Initial velocity is 0.
- Returns
- Initial state for each episode.
◆ IsTerminal()
bool mlpack::rl::MountainCar::IsTerminal |
( |
const State & |
state | ) |
const |
|
inline |
This function checks if the car has reached the terminal state.
- Parameters
-
- Returns
- true if state is a terminal state, otherwise false.
◆ Sample() [1/2]
double mlpack::rl::MountainCar::Sample |
( |
const State & |
state, |
|
|
const Action & |
action, |
|
|
State & |
nextState |
|
) |
| |
|
inline |
Dynamics of Mountain Car.
Get reward and next state based on current state and current action.
- Parameters
-
state | The current state. |
action | The current action. |
nextState | The next state. |
- Returns
- reward, it's always -1.0.
◆ Sample() [2/2]
double mlpack::rl::MountainCar::Sample |
( |
const State & |
state, |
|
|
const Action & |
action |
|
) |
| |
|
inline |
Dynamics of Mountain Car.
Get reward based on current state and current action.
- Parameters
-
state | The current state. |
action | The current action. |
- Returns
- reward, it's always -1.0.
The documentation for this class was generated from the following file: