AIToolbox
A library that offers tools for AI problem solving.
CooperativeQLearning.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_FACTORED_MDP_COOPERATIVE_QLEARNING_HEADER_FILE
2 #define AI_TOOLBOX_FACTORED_MDP_COOPERATIVE_QLEARNING_HEADER_FILE
3 
5 
8 
9 namespace AIToolbox::Factored::MDP {
18  public:
33  // SparseCooperativeQLearning(State S, Action A, double discount, double alpha);
34  CooperativeQLearning(const DDNGraph & g, const std::vector<std::vector<size_t>> & basisDomains, double discount, double alpha);
35 
55  Action stepUpdateQ(const State & s, const Action & a, const State & s1, const Rewards & rew);
56 
81  void setLearningRate(double a);
82 
88  double getLearningRate() const;
89 
102  void setDiscount(double d);
103 
109  double getDiscount() const;
110 
116  const DDNGraph & getGraph() const;
117 
123  const State & getS() const;
124 
130  const Action & getA() const;
131 
137  const FactoredMatrix2D & getQFunction() const;
138 
146  void setQFunction(double val);
147 
148  private:
149  const DDNGraph & graph_;
150  double discount_, alpha_;
151  FactoredMatrix2D q_;
152  QGreedyPolicy<> policy_;
153  // Helper
154  Vector agentNormRews_;
155  };
156 }
157 
158 #endif
AIToolbox::Factored::MDP::QGreedyPolicy
This class implements a greedy policy through a QFunction.
Definition: QGreedyPolicy.hpp:23
AIToolbox::Factored::MDP::CooperativeQLearning::setLearningRate
void setLearningRate(double a)
This function sets the learning rate parameter.
AIToolbox::Factored::Rewards
Vector Rewards
Definition: Types.hpp:71
AIToolbox::Factored::MDP::CooperativeQLearning::getS
const State & getS() const
This function returns the state space on which SparseCooperativeQLearning is working.
QGreedyPolicy.hpp
AIToolbox::Factored::MDP
Definition: CooperativePrioritizedSweeping.hpp:13
AIToolbox::Factored::State
Factors State
Definition: Types.hpp:67
AIToolbox::Factored::FactoredMatrix2D
This class represents a factored 2D matrix.
Definition: FactoredMatrix.hpp:140
AIToolbox::Factored::MDP::CooperativeQLearning::getLearningRate
double getLearningRate() const
This function will return the current set learning rate parameter.
AIToolbox::Factored::MDP::CooperativeQLearning::getA
const Action & getA() const
This function returns the action space on which SparseCooperativeQLearning is working.
AIToolbox::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
Definition: Types.hpp:16
BayesianNetwork.hpp
AIToolbox::Factored::DynamicDecisionNetworkGraph
This class represents the structure of a dynamic decision network.
Definition: BayesianNetwork.hpp:52
AIToolbox::Factored::MDP::CooperativeQLearning::CooperativeQLearning
CooperativeQLearning(const DDNGraph &g, const std::vector< std::vector< size_t >> &basisDomains, double discount, double alpha)
Basic constructor.
AIToolbox::Factored::MDP::CooperativeQLearning::stepUpdateQ
Action stepUpdateQ(const State &s, const Action &a, const State &s1, const Rewards &rew)
This function updates the internal QFunction based on experience.
AIToolbox::Factored::MDP::CooperativeQLearning::setQFunction
void setQFunction(double val)
This function sets the QFunction to a set value.
AIToolbox::Factored::Action
Factors Action
Definition: Types.hpp:69
AIToolbox::Factored::MDP::CooperativeQLearning::getGraph
const DDNGraph & getGraph() const
This function returns the DDN on which SparseCooperativeQLearning is working.
AIToolbox::Factored::MDP::CooperativeQLearning::getQFunction
const FactoredMatrix2D & getQFunction() const
This function returns a reference to the internal QFunction.
AIToolbox::Factored::MDP::CooperativeQLearning::setDiscount
void setDiscount(double d)
This function sets the new discount parameter.
Types.hpp
AIToolbox::Factored::MDP::CooperativeQLearning
This class represents the Cooperative QLearning algorithm.
Definition: CooperativeQLearning.hpp:17
AIToolbox::Factored::MDP::CooperativeQLearning::getDiscount
double getDiscount() const
This function returns the currently set discount parameter.