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

This class is an interface to specify a policy through a QFunction. More...

#include <AIToolbox/MDP/Policies/QPolicyInterface.hpp>

Inheritance diagram for AIToolbox::MDP::QPolicyInterface:
AIToolbox::MDP::PolicyInterface AIToolbox::PolicyInterface< size_t, size_t, size_t > AIToolbox::MDP::PGAAPPPolicy AIToolbox::MDP::QGreedyPolicy AIToolbox::MDP::QSoftmaxPolicy AIToolbox::MDP::WoLFPolicy

Public Member Functions

 QPolicyInterface (const QFunction &q)
 Basic constructor. More...
 
const QFunctiongetQFunction () const
 This function returns the underlying QFunction reference. More...
 
- Public Member Functions inherited from AIToolbox::MDP::PolicyInterface
virtual Matrix2D getPolicy () const =0
 This function returns a matrix containing all probabilities of the policy. More...
 
- Public Member Functions inherited from AIToolbox::PolicyInterface< size_t, size_t, size_t >
 PolicyInterface (size_t s, size_t a)
 Basic constructor. More...
 
virtual ~PolicyInterface ()
 Basic virtual destructor. More...
 
virtual size_t sampleAction (const size_t &s) const=0
 This function chooses a random action for state s, following the policy distribution. More...
 
virtual double getActionProbability (const size_t &s, const size_t &a) const=0
 This function returns the probability of taking the specified action in the specified state. More...
 
const size_t & getS () const
 This function returns the number of states of the world. More...
 
const size_t & getA () const
 This function returns the number of available actions to the agent. More...
 

Protected Attributes

const QFunctionq_
 
- Protected Attributes inherited from AIToolbox::PolicyInterface< size_t, size_t, size_t >
size_t S
 
size_t A
 
RandomEngine rand_
 

Additional Inherited Members

- Public Types inherited from AIToolbox::MDP::PolicyInterface
using Base = AIToolbox::PolicyInterface< size_t, size_t, size_t >
 

Detailed Description

This class is an interface to specify a policy through a QFunction.

This class provides a way to sample actions without the need to compute a full Policy from a QFunction. This is useful because often many methods need to modify small parts of a Qfunction for progressive improvement, and computing a full Policy at each step can become too expensive to do.

The type of policy obtained from such sampling is left to the implementation, since there are many ways in which such a policy may be formed.

Constructor & Destructor Documentation

◆ QPolicyInterface()

AIToolbox::MDP::QPolicyInterface::QPolicyInterface ( const QFunction q)

Basic constructor.

Parameters
qThe QFunction this policy is linked with.

Member Function Documentation

◆ getQFunction()

const QFunction& AIToolbox::MDP::QPolicyInterface::getQFunction ( ) const

This function returns the underlying QFunction reference.

Returns
The underlying QFunction reference.

Member Data Documentation

◆ q_

const QFunction& AIToolbox::MDP::QPolicyInterface::q_
protected

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