AIToolbox
A library that offers tools for AI problem solving.
QGreedyPolicy.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_MDP_Q_GREEDY_POLICY_HEADER_FILE
2 #define AI_TOOLBOX_MDP_Q_GREEDY_POLICY_HEADER_FILE
3 
5 
6 namespace AIToolbox::MDP {
14  public:
20  QGreedyPolicy(const QFunction & q);
21 
32  virtual size_t sampleAction(const size_t & s) const override;
33 
46  virtual double getActionProbability(const size_t & s, const size_t & a) const override;
47 
60  virtual Matrix2D getPolicy() const override;
61 
62  private:
63  // To avoid reallocating a vector every time for sampling.
64  mutable std::vector<size_t> bestActions_;
65  };
66 }
67 
68 #endif
QPolicyInterface.hpp
AIToolbox::MDP::QGreedyPolicy::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::QPolicyInterface
This class is an interface to specify a policy through a QFunction.
Definition: QPolicyInterface.hpp:20
AIToolbox::MDP::QFunction
Matrix2D QFunction
Definition: Types.hpp:52
AIToolbox::MDP::QGreedyPolicy::getPolicy
virtual Matrix2D getPolicy() const override
This function returns a matrix containing all probabilities of the policy.
AIToolbox::Matrix2D
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::AutoAlign > Matrix2D
Definition: Types.hpp:18
AIToolbox::MDP
Definition: DoubleQLearning.hpp:10
AIToolbox::MDP::QGreedyPolicy
This class implements a greedy policy through a QFunction.
Definition: QGreedyPolicy.hpp:13
AIToolbox::MDP::QGreedyPolicy::sampleAction
virtual size_t sampleAction(const size_t &s) const override
This function chooses the greediest action for state s.
AIToolbox::MDP::QGreedyPolicy::QGreedyPolicy
QGreedyPolicy(const QFunction &q)
Basic constructor.