AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::Factored::Bandit::FlattenedModel< Dist > Class Template Reference

This class flattens a factored bandit model. More...

#include <AIToolbox/Factored/Bandit/FlattenedModel.hpp>

Public Member Functions

 FlattenedModel (const Model< Dist > &model)
 Basic constructor. More...
 
double sampleR (size_t a) const
 This function samples the specified bandit arm. More...
 
Action convertA (size_t a) const
 This function converts the input action to its equivalent joint-action. More...
 
size_t getA () const
 This function returns the number of arms of the bandit. More...
 
const Model< Dist > & getModel () const
 This function returns a reference to the wrapped factored bandit. More...
 

Detailed Description

template<typename Dist>
class AIToolbox::Factored::Bandit::FlattenedModel< Dist >

This class flattens a factored bandit model.

This class allows to flatten a factored bandit model back into its equivalent single-agent multi-armed bandit. This class is simply a wrapper, and does not copy nor store the original model. Instead, all conversions between joint-actions and flattened actions are done on-the-fly as needed.

Note that flattening the problem makes it harder, as the new bandit has an effective action space equal to the full product of all the agents' actions in the original problem, and does not get access to the structure of the factorization.

Template Parameters
DistThe distribution to use for all arms.

Constructor & Destructor Documentation

◆ FlattenedModel()

template<typename Dist >
AIToolbox::Factored::Bandit::FlattenedModel< Dist >::FlattenedModel ( const Model< Dist > &  model)

Basic constructor.

Parameters
modelThe factored multi-armed bandit to wrap.

Member Function Documentation

◆ convertA()

template<typename Dist >
Action AIToolbox::Factored::Bandit::FlattenedModel< Dist >::convertA ( size_t  a) const

This function converts the input action to its equivalent joint-action.

Parameters
aThe input action.
Returns
The equivalent joint-action for the wrapped bandit.

◆ getA()

template<typename Dist >
size_t AIToolbox::Factored::Bandit::FlattenedModel< Dist >::getA

This function returns the number of arms of the bandit.

This value is pre-computed, not computed on the fly, to keep this function fast.

Returns
The number of arms of the bandit.

◆ getModel()

template<typename Dist >
const Model< Dist > & AIToolbox::Factored::Bandit::FlattenedModel< Dist >::getModel

This function returns a reference to the wrapped factored bandit.

Returns
The wrapped factored bandit.

◆ sampleR()

template<typename Dist >
double AIToolbox::Factored::Bandit::FlattenedModel< Dist >::sampleR ( size_t  a) const

This function samples the specified bandit arm.

This function converts the input action into its equivalent joint-action for the wrapped model. It then returns the sum of the obtained reward vector.

Parameters
aThe arm to sample.
Returns
The sampled reward for the selected arm.

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