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

This class represents a policy always picking the same action. More...

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

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

Public Member Functions

 SingleActionPolicy (Action a)
 Basic constructor. More...
 
virtual Action sampleAction () const override
 This function always return the current action. More...
 
virtual double getActionProbability (const Action &a) const override
 This function returns the probability of taking the specified action in the specified state. More...
 
void updateAction (Action a)
 This function updates the currently hold action. More...
 
- Public Member Functions inherited from AIToolbox::PolicyInterface< void, void, Action >
 PolicyInterface (Action a)
 Basic constructor. More...
 
virtual ~PolicyInterface ()
 Basic virtual destructor. 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...
 

Additional Inherited Members

- Public Types inherited from AIToolbox::Factored::Bandit::PolicyInterface
using Base = AIToolbox::PolicyInterface< void, void, Action >
 
- Protected Attributes inherited from AIToolbox::PolicyInterface< void, void, Action >
Action A
 
RandomEngine rand_
 

Detailed Description

This class represents a policy always picking the same action.

Since there are methods which in order to learn automatically compute a best action for the next time step, it is useful to be able to wrap those actions into a policy in order to be joined to other policies (like epsilon-greedy, for example).

This class is a simple wrapper that always return the last action that has been set.

Constructor & Destructor Documentation

◆ SingleActionPolicy()

AIToolbox::Factored::Bandit::SingleActionPolicy::SingleActionPolicy ( Action  a)

Basic constructor.

Parameters
aThe number of actions available to the agent.

Member Function Documentation

◆ getActionProbability()

virtual double AIToolbox::Factored::Bandit::SingleActionPolicy::getActionProbability ( const Action a) const
overridevirtual

This function returns the probability of taking the specified action in the specified state.

Parameters
aThe selected action.
Returns
One if the action matches the currently saved one, zero otherwise.

◆ sampleAction()

virtual Action AIToolbox::Factored::Bandit::SingleActionPolicy::sampleAction ( ) const
overridevirtual

This function always return the current action.

Returns
The currently saved action.

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

◆ updateAction()

void AIToolbox::Factored::Bandit::SingleActionPolicy::updateAction ( Action  a)

This function updates the currently hold action.

Parameters
aThe new action we must return.

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