AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::Factored::Bandit::EpsilonPolicy Class Reference

#include <AIToolbox/Factored/Bandit/Policies/EpsilonPolicy.hpp>

Inheritance diagram for AIToolbox::Factored::Bandit::EpsilonPolicy:
AIToolbox::Factored::Bandit::PolicyInterface AIToolbox::EpsilonPolicyInterface< void, void, Action > AIToolbox::PolicyInterface< void, void, Action > AIToolbox::PolicyInterface< void, void, Action >

Public Types

using EpsilonBase = EpsilonPolicyInterface< void, void, Action >
 
- Public Types inherited from AIToolbox::Factored::Bandit::PolicyInterface
using Base = AIToolbox::PolicyInterface< void, void, Action >
 
- Public Types inherited from AIToolbox::EpsilonPolicyInterface< void, void, Action >
using Base = PolicyInterface< void, void, Action >
 

Public Member Functions

 EpsilonPolicy (const PolicyInterface &p, double epsilon=0.1)
 Basic constructor. More...
 
- Public Member Functions inherited from AIToolbox::PolicyInterface< void, void, Action >
 PolicyInterface (Action a)
 Basic constructor. More...
 
virtual ~PolicyInterface ()
 Basic virtual destructor. More...
 
const Action & getA () const
 This function returns the number of available actions to the agent. More...
 
- Public Member Functions inherited from AIToolbox::EpsilonPolicyInterface< void, void, Action >
 EpsilonPolicyInterface (const Base &p, double epsilon=0.1)
 Basic constructor. More...
 
virtual Action sampleAction () const override
 This function chooses an action, following the policy distribution and epsilon. More...
 
virtual double getActionProbability (const Action &a) const override
 This function returns the probability of taking the specified action. More...
 
void setEpsilon (double e)
 This function sets the epsilon parameter. More...
 
double getEpsilon () const
 This function will return the currently set epsilon parameter. More...
 

Protected Member Functions

virtual Action sampleRandomAction () const override
 This function returns a random action in the Action space. More...
 
virtual double getRandomActionProbability () const override
 This function returns the probability of picking a random action. More...
 

Protected Attributes

std::vector< std::uniform_int_distribution< size_t > > randomDistribution_
 
- Protected Attributes inherited from AIToolbox::PolicyInterface< void, void, Action >
Action A
 
RandomEngine rand_
 
- Protected Attributes inherited from AIToolbox::EpsilonPolicyInterface< void, void, Action >
const Basepolicy_
 
double epsilon_
 

Member Typedef Documentation

◆ EpsilonBase

Constructor & Destructor Documentation

◆ EpsilonPolicy()

AIToolbox::Factored::Bandit::EpsilonPolicy::EpsilonPolicy ( const PolicyInterface p,
double  epsilon = 0.1 
)

Basic constructor.

This constructor saves the input policy and the epsilon parameter for later use.

The epsilon parameter must be >= 0.0 and <= 1.0, otherwise the constructor will throw an std::invalid_argument.

Parameters
pThe policy that is being extended.
epsilonThe parameter that controls the amount of exploration.

Member Function Documentation

◆ getRandomActionProbability()

virtual double AIToolbox::Factored::Bandit::EpsilonPolicy::getRandomActionProbability ( ) const
overrideprotectedvirtual

This function returns the probability of picking a random action.

Returns
The probability of picking an an action at random.

Implements AIToolbox::EpsilonPolicyInterface< void, void, Action >.

◆ sampleRandomAction()

virtual Action AIToolbox::Factored::Bandit::EpsilonPolicy::sampleRandomAction ( ) const
overrideprotectedvirtual

This function returns a random action in the Action space.

Returns
A valid random action.

Implements AIToolbox::EpsilonPolicyInterface< void, void, Action >.

Member Data Documentation

◆ randomDistribution_

std::vector<std::uniform_int_distribution<size_t> > AIToolbox::Factored::Bandit::EpsilonPolicy::randomDistribution_
mutableprotected

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