mlpack
Classes | Public Member Functions | List of all members
mlpack::rl::ContinuousMountainCar Class Reference

Implementation of Continuous Mountain Car task. More...

#include <continuous_mountain_car.hpp>

Classes

struct  Action
 Implementation of action of Continuous Mountain Car. More...
 
class  State
 Implementation of state of Continuous Mountain Car. More...
 

Public Member Functions

 ContinuousMountainCar (const double positionMin=-1.2, const double positionMax=0.6, const double positionGoal=0.45, const double velocityMin=-0.07, const double velocityMax=0.07, const double duration=0.0015, const double doneReward=100, const size_t maxSteps=0)
 Construct a Continuous Mountain Car instance using the given constant. More...
 
double Sample (const State &state, const Action &action, State &nextState)
 Dynamics of Continuous Mountain Car. More...
 
double Sample (const State &state, const Action &action)
 Dynamics of Continuous Mountain Car. More...
 
State InitialSample ()
 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...
 
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.
 

Detailed Description

Implementation of Continuous Mountain Car task.

Constructor & Destructor Documentation

◆ ContinuousMountainCar()

mlpack::rl::ContinuousMountainCar::ContinuousMountainCar ( const double  positionMin = -1.2,
const double  positionMax = 0.6,
const double  positionGoal = 0.45,
const double  velocityMin = -0.07,
const double  velocityMax = 0.07,
const double  duration = 0.0015,
const double  doneReward = 100,
const size_t  maxSteps = 0 
)
inline

Construct a Continuous Mountain Car instance using the given constant.

Parameters
positionMinMinimum legal position.
positionMaxMaximum legal position.
positionGoalFinal target position.
velocityMinMinimum legal velocity.
velocityMaxMaximum legal velocity.
durationTime Duration for which force is applied on the car.
doneRewardReward recieved by the agent on success.
maxStepsThe number of steps after which the episode terminates. If the value is 0, there is no limit.

Member Function Documentation

◆ InitialSample()

State mlpack::rl::ContinuousMountainCar::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::ContinuousMountainCar::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.

◆ Sample() [1/2]

double mlpack::rl::ContinuousMountainCar::Sample ( const State state,
const Action action,
State nextState 
)
inline

Dynamics of Continuous Mountain Car.

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

Parameters
stateThe current state.
actionThe current action.
nextStateThe next state.

◆ Sample() [2/2]

double mlpack::rl::ContinuousMountainCar::Sample ( const State state,
const Action action 
)
inline

Dynamics of Continuous 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.

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