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.5, const double velocityMin=-0.07, const double velocityMax=0.07)
 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...

 

Detailed Description

Implementation of Mountain Car task.

Definition at line 27 of file mountain_car.hpp.

Member Enumeration Documentation

◆ Action

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.

Constructor & Destructor Documentation

◆ MountainCar()

MountainCar ( const double  positionMin = -1.2,
const double  positionMax = 0.5,
const double  velocityMin = -0.07,
const double  velocityMax = 0.07 
)
inline

Construct a Mountain Car instance using the given constant.

Parameters
positionMinMinimum legal position.
positionMaxMaximum legal position.
velocityMinMinimum legal velocity.
velocityMaxMaximum legal velocity.

Definition at line 96 of file mountain_car.hpp.

Member Function Documentation

◆ InitialSample()

State InitialSample ( ) const
inline

Initial position is randomly generated within [-0.6, -0.4].

Initial velocity is 0.

Returns
Initial state for each episode.

Definition at line 159 of file mountain_car.hpp.

References MountainCar::State::Position(), and MountainCar::State::Velocity().

◆ IsTerminal()

bool IsTerminal ( const State state) const
inline

Whether given state is a terminal state.

Parameters
statedesired state.
Returns
true if state is a terminal state, otherwise false.

Definition at line 173 of file mountain_car.hpp.

References MountainCar::State::Position().

◆ Sample() [1/2]

double Sample ( const State state,
const Action action,
State nextState 
) const
inline

Dynamics of Mountain Car.

Get reward and next state based on current state and current action.

Parameters
stateThe current state.
actionThe current action.
nextStateThe next state.
Returns
reward, it's always -1.0.

Definition at line 115 of file mountain_car.hpp.

References MountainCar::State::Position(), and MountainCar::State::Velocity().

Referenced by MountainCar::Sample().

◆ Sample() [2/2]

double Sample ( const State state,
const Action action 
) const
inline

Dynamics of Mountain Car.

Get reward based on current state and current action.

Parameters
stateThe current state.
actionThe current action.
Returns
reward, it's always -1.0.

Definition at line 147 of file mountain_car.hpp.

References MountainCar::Sample().


The documentation for this class was generated from the following file: