mlpack
Public Types | Public Member Functions | List of all members
mlpack::rl::RewardClipping< EnvironmentType > Class Template Reference

Interface for clipping the reward to some value between the specified maximum and minimum value (Clipping here is implemented as \( g_{\text{clipped}} = \max(g_{\text{min}}, \min(g_{\text{min}}, g))) \).) More...

#include <reward_clipping.hpp>

Public Types

using State = typename EnvironmentType::State
 Convenient typedef for state.
 
using Action = typename EnvironmentType::Action
 Convenient typedef for action.
 

Public Member Functions

 RewardClipping (EnvironmentType &environment, const double minReward=-1.0, const double maxReward=1.0)
 Constructor for creating a RewardClipping instance. More...
 
State InitialSample ()
 The InitialSample method is called by the environment to initialize the starting state. More...
 
bool IsTerminal (const State &state) const
 Checks whether given state is a terminal state. More...
 
double Sample (const State &state, const Action &action, State &nextState)
 Dynamics of Environment. More...
 
double Sample (const State &state, const Action &action)
 Dynamics of Environment. More...
 
EnvironmentType & Environment () const
 Get the environment.
 
EnvironmentType & Environment ()
 Modify the environment.
 
double MinReward () const
 Get the minimum reward value.
 
double & MinReward ()
 Modify the minimum reward value.
 
double MaxReward () const
 Get the maximum reward value.
 
double & MaxReward ()
 Modify the maximum reward value.
 

Detailed Description

template<typename EnvironmentType>
class mlpack::rl::RewardClipping< EnvironmentType >

Interface for clipping the reward to some value between the specified maximum and minimum value (Clipping here is implemented as \( g_{\text{clipped}} = \max(g_{\text{min}}, \min(g_{\text{min}}, g))) \).)

Template Parameters
EnvironmentTypeA type of Environment that is being wrapped.

Constructor & Destructor Documentation

◆ RewardClipping()

template<typename EnvironmentType >
mlpack::rl::RewardClipping< EnvironmentType >::RewardClipping ( EnvironmentType &  environment,
const double  minReward = -1.0,
const double  maxReward = 1.0 
)
inline

Constructor for creating a RewardClipping instance.

Parameters
minRewardMinimum possible value of clipped reward.
maxRewardMaximum possible value of clipped reward.
environmentAn instance of the environment used for actual simulations.

Member Function Documentation

◆ InitialSample()

template<typename EnvironmentType >
State mlpack::rl::RewardClipping< EnvironmentType >::InitialSample ( )
inline

The InitialSample method is called by the environment to initialize the starting state.

Returns whatever Initial Sample is returned by the environment.

◆ IsTerminal()

template<typename EnvironmentType >
bool mlpack::rl::RewardClipping< EnvironmentType >::IsTerminal ( const State state) const
inline

Checks whether given state is a terminal state.

Returns the value by calling the environment method.

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

◆ Sample() [1/2]

template<typename EnvironmentType >
double mlpack::rl::RewardClipping< EnvironmentType >::Sample ( const State state,
const Action action,
State nextState 
)
inline

Dynamics of Environment.

The rewards returned from the base environment are clipped according the maximum and minimum values specified.

Parameters
stateThe current state.
actionThe current action.
nextStateThe next state.
Returns
clippedReward, Reward clipped between [minReward, maxReward].

◆ Sample() [2/2]

template<typename EnvironmentType >
double mlpack::rl::RewardClipping< EnvironmentType >::Sample ( const State state,
const Action action 
)
inline

Dynamics of Environment.

The rewards returned from the base environment are clipped according the maximum and minimum values specified.

Parameters
stateThe current state.
actionThe current action.
Returns
clippedReward, Reward clipped between [minReward, maxReward].

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