AIToolbox
A library that offers tools for AI problem solving.
|
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... | |
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.
Dist | The distribution to use for all arms. |
AIToolbox::Factored::Bandit::FlattenedModel< Dist >::FlattenedModel | ( | const Model< Dist > & | model | ) |
Basic constructor.
model | The factored multi-armed bandit to wrap. |
Action AIToolbox::Factored::Bandit::FlattenedModel< Dist >::convertA | ( | size_t | a | ) | const |
This function converts the input action to its equivalent joint-action.
a | The input action. |
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.
const Model< Dist > & AIToolbox::Factored::Bandit::FlattenedModel< Dist >::getModel |
This function returns a reference to the wrapped factored bandit.
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.
a | The arm to sample. |