AIToolbox
A library that offers tools for AI problem solving.
|
Go to the documentation of this file. 1 #ifndef AI_TOOLBOX_MDP_POLICY_EVALUATION_HEADER_FILE
2 #define AI_TOOLBOX_MDP_POLICY_EVALUATION_HEADER_FILE
135 horizon_(horizon), vParameter_(std::move(v)), model_(m), S(0), A(0)
144 if constexpr (!IsModelEigen<M>)
152 const size_t size = vParameter_.size();
165 unsigned timestep = 0;
166 double variation = tolerance_ * 2;
173 while ( timestep < horizon_ && (!useTolerance || variation > tolerance_) ) {
180 v1_ *= model_.getDiscount();
183 if constexpr(IsModelEigen<M>)
189 for (
size_t s = 0; s < S; ++s )
190 v1_(s) = q.row(s) * p.row(s).transpose();
195 variation = (v1_ - val0).cwiseAbs().maxCoeff();
200 return std::make_tuple(useTolerance ? variation : 0.0, std::move(v1_), std::move(q));
205 if ( t < 0.0 )
throw std::invalid_argument(
"Tolerance must be >= 0");
216 vParameter_ = std::move(v);
#define AI_SEVERITY_WARNING
Definition: Logging.hpp:70
#define AI_LOGGER(SEV, ARGS)
Definition: Logging.hpp:114
#define AI_SEVERITY_DEBUG
Definition: Logging.hpp:68