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

This class represents a random policy. More...

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

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

Public Member Functions

 RandomPolicy (Action a)
 Basic constructor. More...
 
virtual Action sampleAction () const override
 This function chooses a random action for state s, following the policy distribution. More...
 
const ActionsampleActionNoAlloc () const
 This function chooses a random action for state s, following the policy distribution. More...
 
virtual double getActionProbability (const Action &a) const override
 This function returns the probability of taking the specified action in the specified state. 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 random policy.

This class simply returns a random action every time it is polled.

Constructor & Destructor Documentation

◆ RandomPolicy()

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

Basic constructor.

Parameters
aThe number of actions available to the agent.

Member Function Documentation

◆ getActionProbability()

virtual double AIToolbox::Factored::Bandit::RandomPolicy::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
The probability of taking the selected action in the specified state.

◆ sampleAction()

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

This function chooses a random action for state s, following the policy distribution.

Returns
The chosen action.

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

◆ sampleActionNoAlloc()

const Action& AIToolbox::Factored::Bandit::RandomPolicy::sampleActionNoAlloc ( ) const

This function chooses a random action for state s, following the policy distribution.

This function does not allocate memory each call.

Returns
The chosen action.

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