bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
example_22::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.
output_type operator() (const torch_tensor_t &vec, torch_tensor_value_type< real_t >) const
output_type operator() (const torch_tensor_t &vec, torch_tensor_value_type< float_t >) const
output_type operator() (const torch_tensor_t &vec, torch_tensor_value_type< int_t >) const
output_type operator() (const torch_tensor_t &vec, torch_tensor_value_type< lint_t >) const
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]

Constructor. Creates an epsilon-greedy tabular policy.

◆ EpsilonGreedyPolicy() [2/3]

Constructor. Creates an epsilon-greedy tabular policy.

◆ EpsilonGreedyPolicy() [3/3]

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

Member Function Documentation

◆ decay_option()

Returns the decay option.

◆ eps_value()

Returns the value of the epsilon.

◆ get_action() [1/2]

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

get_action. Given a

◆ get_action() [2/2]

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()

any actions the policy should perform on the given episode index

◆ operator()() [1/6]

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

operator() Select action for the given state

◆ operator()() [2/6]

output_type bitrl::rl::policies::EpsilonGreedyPolicy::operator() ( const torch_tensor_t & vec,
torch_tensor_value_type< float_t >  ) const

◆ operator()() [3/6]

output_type bitrl::rl::policies::EpsilonGreedyPolicy::operator() ( const torch_tensor_t & vec,
torch_tensor_value_type< int_t >  ) const

◆ operator()() [4/6]

output_type bitrl::rl::policies::EpsilonGreedyPolicy::operator() ( const torch_tensor_t & vec,
torch_tensor_value_type< lint_t >  ) const

◆ operator()() [5/6]

output_type bitrl::rl::policies::EpsilonGreedyPolicy::operator() ( const torch_tensor_t & vec,
torch_tensor_value_type< real_t >  ) const

◆ operator()() [6/6]

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

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

◆ reset()

Reset the policy.

◆ set_eps_value()

Set the epsilon value.

Parameters
eps

Member Data Documentation

◆ EPSILON_DECAY_FACTOR

◆ MAX_EPS

◆ MIN_EPS


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