AIToolbox
A library that offers tools for AI problem solving.
PGAAPPPolicy.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_MDP_PGA_APP_POLICY_HEADER_FILE
2 #define AI_TOOLBOX_MDP_PGA_APP_POLICY_HEADER_FILE
3 
6 
7 namespace AIToolbox::MDP {
21  class PGAAPPPolicy : public QPolicyInterface {
22  public:
32  PGAAPPPolicy(const QFunction & q, double lRate = 0.001, double predictionLength = 3.0);
33 
43  void stepUpdateP(size_t s);
44 
55  virtual size_t sampleAction(const size_t & s) const override;
56 
65  virtual double getActionProbability(const size_t & s, const size_t & a) const override;
66 
74  virtual Matrix2D getPolicy() const override;
75 
83  void setLearningRate(double lRate);
84 
90  double getLearningRate() const;
91 
99  void setPredictionLength(double pLength);
100 
106  double getPredictionLength() const;
107 
108  private:
109  double lRate_, predictionLength_;
110  PolicyWrapper::PolicyMatrix policyMatrix_;
111  PolicyWrapper policy_;
112  };
113 }
114 
115 #endif
QPolicyInterface.hpp
AIToolbox::MDP::PGAAPPPolicy::setLearningRate
void setLearningRate(double lRate)
This function sets the new learning rate.
AIToolbox::MDP::QPolicyInterface
This class is an interface to specify a policy through a QFunction.
Definition: QPolicyInterface.hpp:20
AIToolbox::MDP::PGAAPPPolicy::sampleAction
virtual size_t sampleAction(const size_t &s) const override
This function chooses an action for state s, following the policy distribution.
AIToolbox::MDP::QFunction
Matrix2D QFunction
Definition: Types.hpp:52
AIToolbox::Matrix2D
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::AutoAlign > Matrix2D
Definition: Types.hpp:18
AIToolbox::MDP::PGAAPPPolicy::getPolicy
virtual Matrix2D getPolicy() const override
This function returns a matrix containing all probabilities of the policy.
AIToolbox::MDP::PolicyWrapper::PolicyMatrix
Matrix2D PolicyMatrix
Definition: PolicyWrapper.hpp:31
AIToolbox::MDP::PGAAPPPolicy
This class implements the PGA-APP learning algorithm.
Definition: PGAAPPPolicy.hpp:21
AIToolbox::MDP
Definition: DoubleQLearning.hpp:10
AIToolbox::MDP::PolicyWrapper
This class provides an MDP Policy interface around a Matrix2D.
Definition: PolicyWrapper.hpp:29
AIToolbox::MDP::PGAAPPPolicy::setPredictionLength
void setPredictionLength(double pLength)
This function sets the new prediction length.
AIToolbox::MDP::PGAAPPPolicy::stepUpdateP
void stepUpdateP(size_t s)
This function updates the policy based on changes in the QFunction.
PolicyWrapper.hpp
AIToolbox::MDP::PGAAPPPolicy::getActionProbability
virtual double getActionProbability(const size_t &s, const size_t &a) const override
This function returns the probability of taking the specified action in the specified state.
AIToolbox::MDP::PGAAPPPolicy::getLearningRate
double getLearningRate() const
This function returns the current learning rate.
AIToolbox::MDP::PGAAPPPolicy::getPredictionLength
double getPredictionLength() const
This function returns the current prediction length.
AIToolbox::MDP::PGAAPPPolicy::PGAAPPPolicy
PGAAPPPolicy(const QFunction &q, double lRate=0.001, double predictionLength=3.0)
Basic constructor.