AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::PolicyInterface< void, void, Action > Class Template Referenceabstract

This class represents the base interface for policies in games and bandits. More...

#include <AIToolbox/PolicyInterface.hpp>

Inheritance diagram for AIToolbox::PolicyInterface< void, void, Action >:
AIToolbox::EpsilonPolicyInterface< void, void, Action > AIToolbox::Factored::Bandit::PolicyInterface AIToolbox::Factored::Bandit::EpsilonPolicy AIToolbox::Factored::Bandit::EpsilonPolicy AIToolbox::Factored::Bandit::LLRPolicy AIToolbox::Factored::Bandit::MAUCEPolicy AIToolbox::Factored::Bandit::QGreedyPolicy< Maximizer > AIToolbox::Factored::Bandit::RandomPolicy AIToolbox::Factored::Bandit::SingleActionPolicy AIToolbox::Factored::Bandit::ThompsonSamplingPolicy

Public Member Functions

 PolicyInterface (Action a)
 Basic constructor. More...
 
virtual ~PolicyInterface ()
 Basic virtual destructor. More...
 
virtual Action sampleAction () const =0
 This function chooses a random action, following the policy distribution. More...
 
virtual double getActionProbability (const Action &a) const =0
 This function returns the probability of taking the specified action. More...
 
const Action & getA () const
 This function returns the number of available actions to the agent. More...
 

Protected Attributes

Action A
 
RandomEngine rand_
 

Detailed Description

template<typename Action>
class AIToolbox::PolicyInterface< void, void, Action >

This class represents the base interface for policies in games and bandits.

This specialization simply removes the states from the PolicyInterface, since in normal games and bandits there is no state, and we can simplify the interface. The rest is the same.

Template Parameters
ActionThis defines the type that is used to handle actions.

Constructor & Destructor Documentation

◆ PolicyInterface()

template<typename Action >
AIToolbox::PolicyInterface< void, void, Action >::PolicyInterface ( Action  a)

Basic constructor.

Parameters
aThe number of actions available to the agent.

◆ ~PolicyInterface()

template<typename Action >
AIToolbox::PolicyInterface< void, void, Action >::~PolicyInterface
virtual

Basic virtual destructor.

Member Function Documentation

◆ getA()

template<typename Action >
const Action & AIToolbox::PolicyInterface< void, void, Action >::getA

This function returns the number of available actions to the agent.

Returns
The total number of actions.

◆ getActionProbability()

template<typename Action >
virtual double AIToolbox::PolicyInterface< void, void, Action >::getActionProbability ( const Action &  a) const
pure virtual

This function returns the probability of taking the specified action.

Parameters
aThe selected action.
Returns
The probability of taking the selected action.

Implemented in AIToolbox::EpsilonPolicyInterface< void, void, Action >.

◆ sampleAction()

template<typename Action >
virtual Action AIToolbox::PolicyInterface< void, void, Action >::sampleAction ( ) const
pure virtual

Member Data Documentation

◆ A

template<typename Action >
Action AIToolbox::PolicyInterface< void, void, Action >::A
protected

◆ rand_

template<typename Action >
RandomEngine AIToolbox::PolicyInterface< void, void, Action >::rand_
mutableprotected

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