AIToolbox
A library that offers tools for AI problem solving.
PolicyWrapper.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_MDP_POLICY_WRAPPER_HEADER_FILE
2 #define AI_TOOLBOX_MDP_POLICY_WRAPPER_HEADER_FILE
3 
4 #include <vector>
5 #include <tuple>
6 
9 
10 namespace AIToolbox::MDP {
29  class PolicyWrapper : public PolicyInterface {
30  public:
32 
40  PolicyWrapper(const PolicyMatrix & p);
41 
49  virtual size_t sampleAction(const size_t & s) const override;
50 
59  virtual double getActionProbability(const size_t & s, const size_t & a) const override;
60 
66  const PolicyMatrix & getPolicyMatrix() const;
67 
75  virtual Matrix2D getPolicy() const override;
76 
77  private:
78  const PolicyMatrix & policy_;
79  };
80 }
81 
82 #endif
AIToolbox::MDP::PolicyWrapper::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.
PolicyInterface.hpp
AIToolbox::Matrix2D
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::AutoAlign > Matrix2D
Definition: Types.hpp:18
AIToolbox::MDP::PolicyWrapper::PolicyMatrix
Matrix2D PolicyMatrix
Definition: PolicyWrapper.hpp:31
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::PolicyWrapper::getPolicy
virtual Matrix2D getPolicy() const override
This function returns a matrix containing all probabilities of the policy.
AIToolbox::MDP::PolicyWrapper::sampleAction
virtual size_t sampleAction(const size_t &s) const override
This function chooses a random action for state s, following the policy distribution.
AIToolbox::MDP::PolicyWrapper::getPolicyMatrix
const PolicyMatrix & getPolicyMatrix() const
This function enables inspection of the internal policy.
Types.hpp
AIToolbox::MDP::PolicyInterface
Simple typedef for most of MDP's policy needs.
Definition: PolicyInterface.hpp:11
AIToolbox::MDP::PolicyWrapper::PolicyWrapper
PolicyWrapper(const PolicyMatrix &p)
Basic constructor.