bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
cuberl::rl::policies::EpsilonGreedyPolicy Class Reference

The EpsilonGreedyPolicy class. More...

#include <epsilon_greedy_policy.h>

Public Types

typedef uint_t output_type
 The type returned when calling this->operator()
 

Public Member Functions

 EpsilonGreedyPolicy (real_t eps)
 Constructor. Creates an epsilon-greedy tabular policy.
 
 EpsilonGreedyPolicy (real_t eps, uint_t seed)
 Constructor. Creates an epsilon-greedy tabular policy.
 
 EpsilonGreedyPolicy (real_t eps, uint_t seed, EpsilonDecayOption decay_op, real_t min_eps=MIN_EPS, real_t max_eps=MAX_EPS, real_t epsilon_decay=EPSILON_DECAY_FACTOR)
 Constructor Creates an epsilon greedy policy with an epsilon decay strategy.
 
template<typename MapType >
output_type operator() (const MapType &q_map, uint_t state) const
 operator() Select action for the given state
 
template<typename VecType >
output_type operator() (const VecType &vec) const
 Get an action i.e. index from the given values.
 
template<typename MatType >
output_type get_action (const MatType &q_map, uint_t state_idx)
 get_action. Given a
 
template<typename VecTp >
output_type get_action (const VecTp &q_map)
 get_action. Given a vector always returns the position of the maximum occuring element. If the given vector is empty returns CubeAIConsts::invalid_size_type
 
void on_episode (uint_t episode_idx) noexcept
 any actions the policy should perform on the given episode index
 
void reset () noexcept
 Reset the policy.
 
real_t eps_value () const noexcept
 Returns the value of the epsilon.
 
void set_eps_value (real_t eps)
 Set the epsilon value.
 
EpsilonDecayOption decay_option () const noexcept
 Returns the decay option.
 

Static Public Attributes

static constexpr real_t MIN_EPS = 0.01
 
static constexpr real_t MAX_EPS = 1.0
 
static constexpr real_t EPSILON_DECAY_FACTOR = 0.01
 

Detailed Description

Member Typedef Documentation

◆ output_type

The type returned when calling this->operator()

Constructor & Destructor Documentation

◆ EpsilonGreedyPolicy() [1/3]

cuberl::rl::policies::EpsilonGreedyPolicy::EpsilonGreedyPolicy ( real_t  eps)
inline

Constructor. Creates an epsilon-greedy tabular policy.

◆ EpsilonGreedyPolicy() [2/3]

cuberl::rl::policies::EpsilonGreedyPolicy::EpsilonGreedyPolicy ( real_t  eps,
uint_t  seed 
)
inlineexplicit

Constructor. Creates an epsilon-greedy tabular policy.

◆ EpsilonGreedyPolicy() [3/3]

cuberl::rl::policies::EpsilonGreedyPolicy::EpsilonGreedyPolicy ( real_t  eps,
uint_t  seed,
EpsilonDecayOption  decay_op,
real_t  min_eps = MIN_EPS,
real_t  max_eps = MAX_EPS,
real_t  epsilon_decay = EPSILON_DECAY_FACTOR 
)
inlineexplicit

Constructor Creates an epsilon greedy policy with an epsilon decay strategy.

Member Function Documentation

◆ decay_option()

EpsilonDecayOption cuberl::rl::policies::EpsilonGreedyPolicy::decay_option ( ) const
inlinenoexcept

Returns the decay option.

◆ eps_value()

real_t cuberl::rl::policies::EpsilonGreedyPolicy::eps_value ( ) const
inlinenoexcept

Returns the value of the epsilon.

◆ get_action() [1/2]

template<typename MatType >
output_type cuberl::rl::policies::EpsilonGreedyPolicy::get_action ( const MatType &  q_map,
uint_t  state_idx 
)

get_action. Given a

◆ get_action() [2/2]

template<typename VecTp >
EpsilonGreedyPolicy::output_type cuberl::rl::policies::EpsilonGreedyPolicy::get_action ( const VecTp &  q_map)

get_action. Given a vector always returns the position of the maximum occuring element. If the given vector is empty returns CubeAIConsts::invalid_size_type

◆ on_episode()

void cuberl::rl::policies::EpsilonGreedyPolicy::on_episode ( uint_t  episode_idx)
noexcept

any actions the policy should perform on the given episode index

◆ operator()() [1/2]

template<typename MapType >
output_type cuberl::rl::policies::EpsilonGreedyPolicy::operator() ( const MapType &  q_map,
uint_t  state 
) const

operator() Select action for the given state

◆ operator()() [2/2]

template<typename VecType >
EpsilonGreedyPolicy::output_type cuberl::rl::policies::EpsilonGreedyPolicy::operator() ( const VecType &  vec) const

Get an action i.e. index from the given values.

◆ reset()

void cuberl::rl::policies::EpsilonGreedyPolicy::reset ( )
inlinenoexcept

Reset the policy.

◆ set_eps_value()

void cuberl::rl::policies::EpsilonGreedyPolicy::set_eps_value ( real_t  eps)

Set the epsilon value.

Parameters
eps

Member Data Documentation

◆ EPSILON_DECAY_FACTOR

constexpr real_t cuberl::rl::policies::EpsilonGreedyPolicy::EPSILON_DECAY_FACTOR = 0.01
staticconstexpr

◆ MAX_EPS

constexpr real_t cuberl::rl::policies::EpsilonGreedyPolicy::MAX_EPS = 1.0
staticconstexpr

◆ MIN_EPS

constexpr real_t cuberl::rl::policies::EpsilonGreedyPolicy::MIN_EPS = 0.01
staticconstexpr

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