Scheduler
rewards.cpp
Go to the documentation of this file.
1 
10 #include "rewards.h"
11 
12 #include <ostream>
13 
14 using namespace Mdp;
15 
16 Rewards::Rewards(size_t S, size_t A) :
17  nbOfStates(S),
18  nbOfActions(A),
19  rewards(std::vector<std::vector<double>>(S, std::vector<double>(A, 0.0)))
20 {
21 }
22 
23 double Rewards::getReward(state_t state, action_t action)
24 {
25  return rewards[state][action];
26 }
27 
28 void Rewards::setReward(state_t state, action_t action, double reward)
29 {
30  rewards[state][action] = reward;
31 }
32 
33 
34 void Rewards::print(std::ostream& stream)
35 {
36  stream << "Printing rewards/costs\n";
37  for (state_t i = 0; i < nbOfStates; i++)
38  {
39  for (action_t j = 0; j < nbOfActions; j++)
40  {
41  stream << rewards[i][j] << " ";
42  }
43  stream << "\n";
44  }
45 }
46 
47 
48 
49 
const size_t A
const size_t S
void print(std::ostream &stream)
Definition: rewards.cpp:34
void setReward(state_t state, action_t action, double reward)
Definition: rewards.cpp:28
size_t action_t
Definition: action_impl.h:18
Definition: action.h:18
size_t state_t
Definition: state.h:19
Definition: reward.py:1
double getReward(state_t, action_t)
Definition: rewards.cpp:23
Rewards(size_t nbOfStates, size_t nbOfActions)
Definition: rewards.cpp:16