MultiAgentDecisionProcess  Release 0.2.1
RewardModelMappingSparse.cpp
Go to the documentation of this file.
1 
29 
30 using namespace std;
31 
32 RewardModelMappingSparse::RewardModelMappingSparse(size_t nrS, size_t nrJA, string s_str,
33  string ja_str) :
34  RewardModel(nrS, nrJA),
35  _m_R(nrS,nrJA)
36 {
37  _m_s_str = s_str;
38  _m_ja_str = ja_str;
39 }
40 
42 {
43 }
44 
46 {
47  stringstream ss;
48  double r;
49  ss << _m_s_str <<"\t"<< _m_ja_str <<"\t"
50  << "R(" << _m_s_str <<","<< _m_ja_str
51  << ") (rewards of 0 are not printed)"<<endl;
52  for(Index s_i = 0; s_i < _m_nrStates; s_i++)
53  for(Index ja_i = 0; ja_i < _m_nrJointActions; ja_i++)
54  {
55  r=Get(s_i, ja_i);
56  if(std::abs(r)>0)
57  ss << s_i << "\t" << ja_i << "\t" << r << endl;
58  }
59  return(ss.str());
60 }
61