MultiAgentDecisionProcess  Release 0.2.1
GeneralizedMAAStarPlanner.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _GENERALIZEDMAASTARPLANNER_H_
30 #define _GENERALIZEDMAASTARPLANNER_H_ 1
31 
32 /* the include directives */
33 #include <iostream>
34 #include <time.h>
35 #include <sys/times.h>
36 #include <fstream>
37 #include "Globals.h"
38 #include "TimedAlgorithm.h"
39 
40 //use forward declarations when possible to speed up compilation:
41 //class PlanningUnitDecPOMDPDiscrete;
42 //class BayesianGameIdenticalPayoff;
43 
44 //class JPolValPair;
45 //class QFunctionJAOHInterface;
46 //class TimedAlgorithm;
47 //class PolicyPoolJPolValPair;
48 
51 
52 class JointPolicy;
58 
60 // keep these in header file so derived classes can use them
61 #define DEBUG_GMAA3 0
62 #define DEBUG_GMAA4 0
63 #define DEBUG_GMAA5 0
64 
91  public TimedAlgorithm
92 {
93 
94  private:
95  protected:
100 
101 
104 
108 
112 
114 
117 
118  size_t _m_bgCounter;
119  std::string _m_bgBaseFilename;
120 
121  /*the # of joint policies for Bayesian Games that are evaluated.*/
123 
125 
129  double _m_slack;
130 
132 
139 
140  // The 'NEXT' and 'SELECT' functions
141 
148  virtual bool ConstructAndValuateNextPolicies(
150  poolOfNextPolicies)=0;
151 
160  poolOfNextPolicies, bool are_LBs, double bestLB)=0;
161 
172  virtual PartialPolicyPoolInterface* NewPP()const=0;
183 // virtual PartialPolicyPoolItemInterface* NewPPI()=0;
190  double v) const=0;
191 
204  virtual PartialJointPolicyDiscretePure* NewJPol() const=0;
205 
206 
212  PartialPolicyPoolInterface* poolOfNextPolicies, bool are_LBs,
213  double bestLB, size_t k);
214 
215 
216  //auxiliary functions -\todo TODO all these functions are now performed in BayesianGameForDecPOMDPStage, this class should use that class.
217 
239  const PartialJointPolicyDiscretePure& jpolPrevTs
240  , const JointPolicyDiscretePure& jpolBG
241  , const std::vector<size_t>& nrOHts
242  , const std::vector<Index>& firstOHtsI) = 0;
243 /* this uses GetNrAgents() and should therefore not be put here...
244  //for convenience we also provide a possible implementation here
245  PartialJointPolicyPureVector* ConstructExtendedJointPolicyPureVector(
246  PartialJointPolicyPureVector& jpolPrevTs
247  , JointPolicyPureVector& jpolBG
248  , const std::vector<size_t>& nrOHts
249  , const std::vector<Index>& firstOHtsI);
250 */
251 
252 
253  void Prune(PartialPolicyPoolInterface& JPVs, size_t k);
254 
255  public:
256  // Constructor, destructor and copy assignment.
259  int verbose_level=0,
260  double slack = 0.0
261  );
262 
263 
269  //operators:
270 
271  //data manipulation (set) functions:
272 
273  void SetIntermediateResultFile(std::ofstream& of)
275  void SetIntermediateTimingFilename(std::string filename);
276  void SetSaveAllBGs(std::string filename)
277  { _m_bgBaseFilename=filename; }
278  void SetVerbose(int verbose);
279 
280  void Plan();
281 
282  //get (data) functions:
283  //do not define these functions here (that requires inclusion of
284  //header files...)
286  //{ return(_m_foundPolicy); }
288  //{ return(_m_foundPolicy); }
290  //{ return(_m_foundPolicy); }
291 
292  double GetExpectedReward() const
293  { return(_m_expectedRewardFoundPolicy); }
295  { return(_m_maxJPolPoolSize);}
297  {return _m_nrJPolBGsEvaluated;}
298 };
299 
300 
301 #endif /* !_GENERALIZEDMAASTARPLANNER_H_ */
302 
303 // Local Variables: ***
304 // mode:c++ ***
305 // End: ***