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

This class represents an epsilon-greedy policy for Factored MDPs. More...

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

Inheritance diagram for AIToolbox::Factored::MDP::EpsilonPolicy:
AIToolbox::EpsilonPolicyInterface< State, State, Action > AIToolbox::PolicyInterface< State, State, Action >

Public Types

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

Public Member Functions

 EpsilonPolicy (const EpsilonBase::Base &p, double epsilon=0.1)
 Basic constructor. More...
 
- Public Member Functions inherited from AIToolbox::EpsilonPolicyInterface< State, State, Action >
 EpsilonPolicyInterface (const Base &p, double epsilon=0.1)
 Basic constructor. More...
 
virtual Action sampleAction (const State &s) const override
 This function chooses an action for state s, following the policy distribution and epsilon. More...
 
virtual double getActionProbability (const State &s, const Action &a) const override
 This function returns the probability of taking the specified action in the specified state. 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...
 
- Public Member Functions inherited from AIToolbox::PolicyInterface< State, State, Action >
 PolicyInterface (State s, Action a)
 Basic constructor. More...
 
virtual ~PolicyInterface ()
 Basic virtual destructor. More...
 
const State & getS () const
 This function returns the number of states of the world. More...
 
const Action & getA () const
 This function returns the number of available actions to the agent. More...
 

Protected Member Functions

virtual Action sampleRandomAction () const
 This function returns a random action in the Action space. More...
 
virtual double getRandomActionProbability () const
 This function returns the probability of picking a random action. More...
 
- Protected Member Functions inherited from AIToolbox::EpsilonPolicyInterface< State, State, Action >
virtual Action sampleRandomAction () const=0
 This function returns a random action in the Action space. More...
 
virtual double getRandomActionProbability () const=0
 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::EpsilonPolicyInterface< State, State, Action >
const Basepolicy_
 
double epsilon_
 
- Protected Attributes inherited from AIToolbox::PolicyInterface< State, State, Action >
State S
 
Action A
 
RandomEngine rand_
 

Detailed Description

This class represents an epsilon-greedy policy for Factored MDPs.

Member Typedef Documentation

◆ EpsilonBase

Constructor & Destructor Documentation

◆ EpsilonPolicy()

AIToolbox::Factored::MDP::EpsilonPolicy::EpsilonPolicy ( const EpsilonBase::Base 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::MDP::EpsilonPolicy::getRandomActionProbability ( ) const
protectedvirtual

This function returns the probability of picking a random action.

Returns
The probability of picking an an action at random.

◆ sampleRandomAction()

virtual Action AIToolbox::Factored::MDP::EpsilonPolicy::sampleRandomAction ( ) const
protectedvirtual

This function returns a random action in the Action space.

Returns
A valid random action.

Member Data Documentation

◆ randomDistribution_

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

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