AIToolbox
A library that offers tools for AI problem solving.
|
#include <AIToolbox/MDP/Policies/EpsilonPolicy.hpp>
Public Types | |
using | EpsilonBase = EpsilonPolicyInterface< size_t, size_t, size_t > |
Public Types inherited from AIToolbox::MDP::PolicyInterface | |
using | Base = AIToolbox::PolicyInterface< size_t, size_t, size_t > |
Public Types inherited from AIToolbox::EpsilonPolicyInterface< size_t, size_t, size_t > | |
using | Base = PolicyInterface< size_t, size_t, size_t > |
Public Member Functions | |
EpsilonPolicy (const PolicyInterface &p, double epsilon=0.1) | |
Basic constructor. More... | |
virtual Matrix2D | getPolicy () const override |
This function returns a matrix containing all probabilities of the policy. More... | |
Public Member Functions inherited from AIToolbox::PolicyInterface< size_t, size_t, size_t > | |
PolicyInterface (size_t s, size_t a) | |
Basic constructor. More... | |
virtual | ~PolicyInterface () |
Basic virtual destructor. More... | |
const size_t & | getS () const |
This function returns the number of states of the world. More... | |
const size_t & | getA () const |
This function returns the number of available actions to the agent. More... | |
Public Member Functions inherited from AIToolbox::EpsilonPolicyInterface< size_t, size_t, size_t > | |
EpsilonPolicyInterface (const Base &p, double epsilon=0.1) | |
Basic constructor. More... | |
virtual size_t | sampleAction (const size_t &s) const override |
This function chooses an action for state s, following the policy distribution and epsilon. More... | |
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. More... | |
void | setEpsilon (double e) |
This function sets the epsilon parameter. More... | |
double | getEpsilon () const |
This function will return the currently set epsilon parameter. More... | |
Protected Member Functions | |
virtual size_t | sampleRandomAction () const override |
This function returns a random action in the Action space. More... | |
virtual double | getRandomActionProbability () const override |
This function returns the probability of picking a random action. More... | |
Protected Member Functions inherited from AIToolbox::EpsilonPolicyInterface< size_t, size_t, size_t > | |
virtual size_t | sampleRandomAction () const=0 |
This function returns a random action in the Action space. More... | |
virtual double | getRandomActionProbability () const=0 |
This function returns the probability of picking a random action. More... | |
Protected Attributes | |
std::uniform_int_distribution< size_t > | randomDistribution_ |
Protected Attributes inherited from AIToolbox::PolicyInterface< size_t, size_t, size_t > | |
size_t | S |
size_t | A |
RandomEngine | rand_ |
Protected Attributes inherited from AIToolbox::EpsilonPolicyInterface< size_t, size_t, size_t > | |
const Base & | policy_ |
double | epsilon_ |
using AIToolbox::MDP::EpsilonPolicy::EpsilonBase = EpsilonPolicyInterface<size_t, size_t, size_t> |
AIToolbox::MDP::EpsilonPolicy::EpsilonPolicy | ( | const PolicyInterface & | p, |
double | epsilon = 0.1 |
||
) |
Basic constructor.
This constructor saves the input policy and the epsilon parameter for later use.
The epsilon parameter must be >= 0.0 and <= 1.0, otherwise the constructor will throw an std::invalid_argument.
p | The policy that is being extended. |
epsilon | The parameter that controls the amount of exploration. |
|
overridevirtual |
This function returns a matrix containing all probabilities of the policy.
Note that this may be expensive to compute, and should not be called often (aside from the fact that it needs to allocate a new Matrix2D each time).
Ideally this function can be called only when there is a repeated need to access the same policy values in an efficient manner.
Implements AIToolbox::MDP::PolicyInterface.
|
overrideprotectedvirtual |
This function returns the probability of picking a random action.
|
overrideprotectedvirtual |
This function returns a random action in the Action space.
|
mutableprotected |