AIToolbox
A library that offers tools for AI problem solving.
|
Go to the documentation of this file. 1 #ifndef AI_TOOLBOX_EPSILON_POLICY_INTERFACE_HEADER_FILE
2 #define AI_TOOLBOX_EPSILON_POLICY_INTERFACE_HEADER_FILE
28 template <
typename State,
typename Sampling,
typename Action>
118 template <
typename State,
typename Sampling,
typename Action>
125 template <
typename State,
typename Sampling,
typename Action>
128 return sampleRandomAction();
130 return policy_.sampleAction(s);
133 template <
typename State,
typename Sampling,
typename Action>
136 return (1.0 - epsilon_) * policy_.
getActionProbability(s,a) + epsilon_ * getRandomActionProbability();
139 template <
typename State,
typename Sampling,
typename Action>
141 if ( e < 0.0 || e > 1.0 )
throw std::invalid_argument(
"Epsilon must be >= 0 and <= 1");
145 template <
typename State,
typename Sampling,
typename Action>
159 template <
typename Action>
186 virtual Action sampleAction()
const override;
198 virtual double getActionProbability(
const Action & a)
const override;
214 void setEpsilon(
double e);
221 double getEpsilon()
const;
229 virtual Action sampleRandomAction()
const = 0;
240 virtual double getRandomActionProbability()
const = 0;
246 template <
typename Action>
253 template <
typename Action>
261 template <
typename Action>
267 template <
typename Action>
269 if ( e < 0.0 || e > 1.0 )
throw std::invalid_argument(
"Epsilon must be >= 0 and <= 1");
273 template <
typename Action>