AIToolbox
A library that offers tools for AI problem solving.
MiningProblem.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_FACTORED_BANDIT_MINING_PROBLEM_HEADER_FILE
2 #define AI_TOOLBOX_FACTORED_BANDIT_MINING_PROBLEM_HEADER_FILE
3 
5 
53  class MiningBandit {
54  public:
63  MiningBandit(Action A, std::vector<unsigned> workersPerVillage, std::vector<double> productivityPerMine, bool normalizeToOne = true);
64 
72  const Rewards & sampleR(const Action & a) const;
73 
84  double getRegret(const Action & a) const;
85 
89  const Action & getOptimalAction() const;
90 
94  const Action & getA() const;
95 
102  const std::vector<PartialKeys> & getGroups() const;
103 
117  std::vector<QFunctionRule> getDeterministicRules() const;
118 
130  double getNormalizationConstant() const;
131 
132  private:
140  void computeProbabilities(const Action & a) const;
141 
142  Action A;
143  std::vector<unsigned> workersPerVillage_;
144  std::vector<double> productivityPerMine_;
145 
146  Action optimal_;
147  double rewardNorm_;
148  bool normalizeToOne_;
149 
150  std::vector<PartialKeys> villagesPerMine_;
151 
152  mutable Rewards helper_;
153  mutable AIToolbox::RandomEngine rand_;
154  };
155 
178  std::tuple<Action, std::vector<unsigned>, std::vector<double>> makeMiningParameters(unsigned seed);
179 }
180 
181 #endif
AIToolbox::Factored::Bandit::MiningBandit::sampleR
const Rewards & sampleR(const Action &a) const
This function samples the rewards for each mine from a set of Bernoulli distributions.
Types.hpp
AIToolbox::Factored::Bandit::MiningBandit::getNormalizationConstant
double getNormalizationConstant() const
This function returns the normalization constant used.
AIToolbox::Factored::Rewards
Vector Rewards
Definition: Types.hpp:71
AIToolbox::Factored::Bandit::MiningBandit::getA
const Action & getA() const
This function returns the joint action space.
AIToolbox::Factored::Bandit::MiningBandit::MiningBandit
MiningBandit(Action A, std::vector< unsigned > workersPerVillage, std::vector< double > productivityPerMine, bool normalizeToOne=true)
Basic constructor.
AIToolbox::Factored::Bandit::MiningBandit::getGroups
const std::vector< PartialKeys > & getGroups() const
This function returns, for each mine, which villages are connected to it.
AIToolbox::Factored::Bandit::MiningBandit
This class represents the mining bandit problem.
Definition: MiningProblem.hpp:53
AIToolbox::RandomEngine
std::mt19937 RandomEngine
Definition: Types.hpp:14
AIToolbox::Factored::Action
Factors Action
Definition: Types.hpp:69
AIToolbox::Factored::Bandit::MiningBandit::getRegret
double getRegret(const Action &a) const
This function computes the deterministic regret of the input joint action.
AIToolbox::Factored::Bandit::MiningBandit::getOptimalAction
const Action & getOptimalAction() const
This function returns the optimal action for this bandit.
AIToolbox::Factored::Bandit::MiningBandit::getDeterministicRules
std::vector< QFunctionRule > getDeterministicRules() const
This function returns a set of QFunctionRule for the bandit, ignoring stochasticity.
AIToolbox::Factored::Bandit::makeMiningParameters
std::tuple< Action, std::vector< unsigned >, std::vector< double > > makeMiningParameters(unsigned seed)
This function generates the parameters for a random MiningBandit.
AIToolbox::Factored::Bandit
Definition: GraphUtils.hpp:12