AIToolbox
A library that offers tools for AI problem solving.
Experience.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_FACTORED_BANDIT_EXPERIENCE_HEADER_FILE
2 #define AI_TOOLBOX_FACTORED_BANDIT_EXPERIENCE_HEADER_FILE
3 
5 
14  class Experience {
15  public:
16  using VisitsTable = std::vector<std::vector<unsigned long>>;
17  using Indeces = std::vector<size_t>;
18 
25  Experience(Action A, const std::vector<PartialKeys> & dependencies);
26 
40  const Indeces & record(const Action & a, const Rewards & rews);
41 
45  void reset();
46 
50  const std::vector<PartialKeys> & getDependencies() const;
51 
57  unsigned long getTimesteps() const;
58 
66  const QFunction & getRewardMatrix() const;
67 
73  const VisitsTable & getVisitsTable() const;
74 
84  const std::vector<Vector> & getM2Matrix() const;
85 
91  const Action & getA() const;
92 
93  private:
94  Action A;
95  const std::vector<PartialKeys> & deps_;
96 
97  QFunction qfun_;
98  std::vector<Vector> M2s_;
99  VisitsTable counts_;
100  Indeces indeces_;
101 
102  unsigned long timesteps_;
103 
104  };
105 }
106 
107 #endif
AIToolbox::Factored::Bandit::Experience::getVisitsTable
const VisitsTable & getVisitsTable() const
This function returns a reference for the counts for the actions.
AIToolbox::Factored::Bandit::Experience::Indeces
std::vector< size_t > Indeces
Definition: Experience.hpp:17
AIToolbox::Factored::FactoredVector
This class represents a factored vector.
Definition: FactoredMatrix.hpp:60
Types.hpp
AIToolbox::Factored::Rewards
Vector Rewards
Definition: Types.hpp:71
AIToolbox::Factored::Bandit::Experience::getRewardMatrix
const QFunction & getRewardMatrix() const
This function returns a reference to the internal QFunction.
AIToolbox::Factored::Bandit::Experience::getM2Matrix
const std::vector< Vector > & getM2Matrix() const
This function returns the estimated squared distance of the samples from the mean.
AIToolbox::Factored::Bandit::Experience::VisitsTable
std::vector< std::vector< unsigned long > > VisitsTable
Definition: Experience.hpp:16
AIToolbox::Factored::Bandit::Experience
This class computes averages and counts for a multi-agent cooperative Bandit problem.
Definition: Experience.hpp:14
AIToolbox::Factored::Bandit::Experience::Experience
Experience(Action A, const std::vector< PartialKeys > &dependencies)
Basic constructor.
AIToolbox::Factored::Bandit::Experience::getA
const Action & getA() const
This function returns the size of the action space.
AIToolbox::Factored::Bandit::Experience::getTimesteps
unsigned long getTimesteps() const
This function returns the number of times the record function has been called.
AIToolbox::Factored::Bandit::Experience::record
const Indeces & record(const Action &a, const Rewards &rews)
This function updates the QFunction and counts.
AIToolbox::Factored::Action
Factors Action
Definition: Types.hpp:69
AIToolbox::Factored::Bandit::Experience::getDependencies
const std::vector< PartialKeys > & getDependencies() const
This function returns the local groups of agents.
AIToolbox::Factored::Bandit::Experience::reset
void reset()
This function resets the QFunction and counts to zero.
AIToolbox::Factored::Bandit
Definition: GraphUtils.hpp:12