MultiAgentDecisionProcess  Release 0.2.1
TOIDecPOMDPDiscrete.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _TOIDECPOMDPDISCRETE_H_
30 #define _TOIDECPOMDPDISCRETE_H_ 1
31 
32 /* the include directives */
33 #include <iostream>
34 #include "Globals.h"
36 #include "RewardModelTOISparse.h"
37 #include "DecPOMDP.h"
38 #include "DecPOMDPDiscrete.h"
40 
45  public DecPOMDP,
47 {
48 private:
53 
54 protected:
55 #if 0
56 
59 #else
61 #endif
62 
63  std::vector<DecPOMDPDiscrete*> _m_individualDecPOMDPDs;
64 
65 public:
66  // Constructor, destructor and copy assignment.
68 
85  std::string name="received unspec. by TOIDecPOMDPDiscrete",
86  std::string descr="received unspec. by TOIDecPOMDPDiscrete",
87  std::string pf="received unspec. by TOIDecPOMDPDiscrete");
88 
92  virtual ~TOIDecPOMDPDiscrete();
93 
95  TOIDecPOMDPDiscrete& operator=
96  (const TOIDecPOMDPDiscrete& o);
97 
98  //operators:
99 
100  //data manipulation (set) functions:
104  virtual bool SetInitialized(bool b);
105 
107  void CreateNewRewardModel();
108 
110  void SetReward(Index sI, Index jaI, double r)
113  r);
114  }
115 
116  void SetReward(const std::vector<Index> &sIs,
117  const std::vector<Index> &aIs, double r)
118  { _m_p_rModel->Set(sIs, aIs, r);
119  }
120 
122  void SetReward(Index sI, Index jaI, Index sucSI, double r)
123  {throw(E("SetReward(sI,jaI,sucSI,r) is not implemented yet..."));}
126  void SetReward(Index sI, Index jaI, Index sucSI, Index joI,
127  double r)
128  {throw(E("SetReward(sI,jaI,sucSI,joI, r) not implemented yet..."));}
129 
130  void SetIndividualDecPOMDPD(DecPOMDPDiscrete *model, Index agentI);
131 
132  //get (data) functions:
133 
135  const
136  {return _m_individualDecPOMDPDs[agentI];}
137 
139  virtual double GetReward(Index sI, Index jaI) const
142  }
143  virtual double GetReward(const std::vector<Index> &sIs,
144  const std::vector<Index> &aIs) const
145  { return(_m_p_rModel->Get(sIs, aIs));
146  }
147 
148  std::vector<double> GetRewards(Index sI, Index jaI) const;
149 
151  virtual std::string SoftPrint() const;
153  void Print() const
154  {std::cout << SoftPrint();}
155 
156 
157  //functions to implement the DecPOMDPInterface:
159  double GetReward(State* s, JointAction* ja) const
160  {
161  return GetReward(
162  ((StateDiscrete*)s)->GetIndex(),
163  ((JointActionDiscrete*)ja)->GetIndex());
164  }
166  void SetReward(State* s, JointAction* ja, double r)
167  {
168  return SetReward(
169  ((StateDiscrete*)s)->GetIndex(),
170  ((JointActionDiscrete*)ja)->GetIndex(), r);
171  }
172 
173  //functions to implement the POSGInterface:
174 
176 
177  void SetRewardForAgent(Index agentI, State* s, JointAction* ja, double r)
178  {SetReward(s, ja, r); }
180 
181  double GetRewardForAgent(Index agentI, State* s, JointAction* ja) const
182  {return GetReward(s, ja); }
183 
184  //functions to implement the POSGDiscreteInterface:
185 
189 
190  void SetRewardForAgent(Index agentI, Index sI, Index jaI, double r)
191  {SetReward(sI, jaI, r);}
192 
194  void SetRewardForAgent(Index agentI, Index sI, Index jaI,
195  Index sucSI, double r)
196  {SetReward(sI, jaI, sucSI, r);}
197 
199  void SetRewardForAgent(Index agentI, Index sI, Index jaI,
200  Index sucSI, Index joI, double r)
201  {SetReward(sI, jaI, sucSI, joI, r);}
202 
204  double GetRewardForAgent(Index agentI, Index sI, Index jaI) const
205  {return GetReward(sI, jaI);}
206 
207  RGet* GetRGet() const { return(0); }
208 
210  virtual TOIDecPOMDPDiscrete* Clone() const
211  { return new TOIDecPOMDPDiscrete(*this); }
212 
213 };
214 
215 
216 #endif /* !_TOIDECPOMDPDISCRETE_H_ */
217 
218 // Local Variables: ***
219 // mode:c++ ***
220 // End: ***