AIToolbox
A library that offers tools for AI problem solving.
EpsilonPolicy.hpp
Go to the documentation of this file.
1
#ifndef AI_TOOLBOX_BANDIT_EPSILON_POLICY_HEADER_FILE
2
#define AI_TOOLBOX_BANDIT_EPSILON_POLICY_HEADER_FILE
3
4
#include <
AIToolbox/Bandit/Policies/PolicyInterface.hpp
>
5
#include <
AIToolbox/EpsilonPolicyInterface.hpp
>
6
7
namespace
AIToolbox::Bandit
{
8
class
EpsilonPolicy
:
public
PolicyInterface
,
public
EpsilonPolicyInterface
<void, void, size_t> {
9
public
:
10
using
EpsilonBase
=
EpsilonPolicyInterface<void, void, size_t>
;
11
24
EpsilonPolicy
(
const
PolicyInterface
& p,
double
epsilon = 0.1);
25
37
virtual
Vector
getPolicy
()
const override
;
38
39
protected
:
45
virtual
size_t
sampleRandomAction
()
const override
;
46
52
virtual
double
getRandomActionProbability
()
const override
;
53
54
// Used to sampled random actions
55
mutable
std::uniform_int_distribution<size_t>
randomDistribution_
;
56
};
57
}
58
59
#endif
AIToolbox::Bandit::EpsilonPolicy::sampleRandomAction
virtual size_t sampleRandomAction() const override
This function returns a random action in the Action space.
AIToolbox::Bandit::PolicyInterface
Simple typedef for most of a normal Bandit's policy needs.
Definition:
PolicyInterface.hpp:11
AIToolbox::Bandit::EpsilonPolicy::getPolicy
virtual Vector getPolicy() const override
This function returns a matrix containing all probabilities of the policy.
AIToolbox::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
Definition:
Types.hpp:16
AIToolbox::Bandit
Definition:
Experience.hpp:6
PolicyInterface.hpp
AIToolbox::Bandit::EpsilonPolicy::EpsilonPolicy
EpsilonPolicy(const PolicyInterface &p, double epsilon=0.1)
Basic constructor.
AIToolbox::Bandit::EpsilonPolicy::getRandomActionProbability
virtual double getRandomActionProbability() const override
This function returns the probability of picking a random action.
AIToolbox::EpsilonPolicyInterface
This class is a policy wrapper for epsilon action choice.
Definition:
EpsilonPolicyInterface.hpp:29
AIToolbox::Bandit::EpsilonPolicy::randomDistribution_
std::uniform_int_distribution< size_t > randomDistribution_
Definition:
EpsilonPolicy.hpp:55
AIToolbox::Bandit::EpsilonPolicy
Definition:
EpsilonPolicy.hpp:8
EpsilonPolicyInterface.hpp