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

This class represents the base interface for policies. More...

#include <AIToolbox/PolicyInterface.hpp>

Inheritance diagram for AIToolbox::PolicyInterface< State, Sampling, Action >:
AIToolbox::EpsilonPolicyInterface< State, Sampling, Action >

Public Member Functions

 PolicyInterface (State s, Action a)
 Basic constructor. More...
 
virtual ~PolicyInterface ()
 Basic virtual destructor. More...
 
virtual Action sampleAction (const Sampling &s) const =0
 This function chooses a random action for state s, following the policy distribution. More...
 
virtual double getActionProbability (const Sampling &s, const Action &a) const =0
 This function returns the probability of taking the specified action in the specified state. 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 Attributes

State S
 
Action A
 
RandomEngine rand_
 

Detailed Description

template<typename State, typename Sampling, typename Action>
class AIToolbox::PolicyInterface< State, Sampling, Action >

This class represents the base interface for policies.

This class represents an interface that all policies must conform to. The interface is generic as different methods may have very different ways to store and compute policies, and this interface simply asks for a way to sample them.

This class is templatized in order to work with as many problem classes as possible. It doesn't really implement any specific functionality, but should be used as a guide in order to decide which methods a new policy should have.

The State and Sampling parameters are separate since in POMDPs we still have "integer" states, but we often want to sample from beliefs. Having two separate parameters allows for this. In the MDP case they are both the same.

Template Parameters
StateThis defines the type that is used to store the state space.
SamplingThis defines the type that is used to sample from the policy.
ActionThis defines the type that is used to handle actions.

Constructor & Destructor Documentation

◆ PolicyInterface()

template<typename State , typename Sampling , typename Action >
AIToolbox::PolicyInterface< State, Sampling, Action >::PolicyInterface ( State  s,
Action  a 
)

Basic constructor.

Parameters
sThe number of states of the world.
aThe number of actions available to the agent.

◆ ~PolicyInterface()

template<typename State , typename Sampling , typename Action >
AIToolbox::PolicyInterface< State, Sampling, Action >::~PolicyInterface
virtual

Basic virtual destructor.

Member Function Documentation

◆ getA()

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

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

Returns
The total number of actions.

◆ getActionProbability()

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

◆ getS()

template<typename State , typename Sampling , typename Action >
const State & AIToolbox::PolicyInterface< State, Sampling, Action >::getS

This function returns the number of states of the world.

Returns
The total number of states.

◆ sampleAction()

template<typename State , typename Sampling , typename Action >
virtual Action AIToolbox::PolicyInterface< State, Sampling, Action >::sampleAction ( const Sampling &  s) const
pure virtual

Member Data Documentation

◆ A

template<typename State , typename Sampling , typename Action >
Action AIToolbox::PolicyInterface< State, Sampling, Action >::A
protected

◆ rand_

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

◆ S

template<typename State , typename Sampling , typename Action >
State AIToolbox::PolicyInterface< State, Sampling, Action >::S
protected

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