| 
    AIToolbox
    
   A library that offers tools for AI problem solving. 
   | 
 
 
 
 
Go to the documentation of this file.    1 #ifndef AI_TOOLBOX_MDP_UTILS_HEADER_FILE 
    2 #define AI_TOOLBOX_MDP_UTILS_HEADER_FILE 
   78         if constexpr(IsModelEigen<M>) {
 
   79             return model.getRewardFunction();
 
   81             const auto S = model.getS();
 
   82             const auto A = model.getA();
 
   86             for ( 
size_t s = 0; s < S; ++s )
 
   87                 for ( 
size_t a = 0; a < A; ++a )
 
   88                     for ( 
size_t s1 = 0; s1 < S; ++s1 )
 
   89                         ir(s, a) += model.getTransitionProbability(s,a,s1) * model.getExpectedReward(s,a,s1);
 
  107         const auto A = model.getA();
 
  109         if constexpr(IsModelEigen<M>) {
 
  110             for ( 
size_t a = 0; a < A; ++a )
 
  111                 ir.col(a).noalias() += model.getTransitionFunction(a) * v;
 
  113             const auto S = model.getS();
 
  114             for ( 
size_t s = 0; s < S; ++s )
 
  115                 for ( 
size_t a = 0; a < A; ++a )
 
  116                     for ( 
size_t s1 = 0; s1 < S; ++s1 )
 
  117                         ir(s, a) += model.getTransitionProbability(s,a,s1) * v[s1];