MultiAgentDecisionProcess  Release 0.2.1
PlanningUnit.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _PLANNINGUNIT_H_
30 #define _PLANNINGUNIT_H_ 1
31 
32 /* the include directives */
33 #include <iostream>
34 #include <stdlib.h>
35 #include "Globals.h"
37 
38 #define DEBUG_PU_CONSTRUCTORS 0
39 
40 class JointPolicy;
41 
49 {
50  private:
51 
54 
57 
59  size_t _m_horizon;
61  int _m_seed;
62 
63  protected:
64 
65  public:
66  // Constructor, destructor and copy assignment.
68 
70  PlanningUnit(size_t horizon,
72  _m_problem(p),
73  _m_agentI(0),
74  _m_horizon(horizon),
75  _m_seed(0)
76  {}
77 
79  virtual ~PlanningUnit(){}
80 
81  //operators:
82 
83  //data manipulation (set) functions:
85  void SetSeed(int s){ _m_seed = s; InitSeed(); }
86 
89 
91  virtual void SetHorizon(size_t horizon) { _m_horizon = horizon; }
92 
94  void InitSeed() const { srand(_m_seed); }
95 
96  //get (data) functions:
98  size_t GetHorizon() const { return(_m_horizon); }
100  int GetSeed() const { return(_m_seed); }
101 
103  size_t GetNrAgents() const { return(_m_problem->GetNrAgents()); }
104 
107  Index curIndex = _m_agentI;
108  _m_agentI = (_m_agentI+1) % GetNrAgents();
109  return(curIndex);
110  }
111 
114  { return(_m_problem); }
115 
116  //other
117 
119  virtual void Plan() = 0;
120 
122  virtual JointPolicy* GetJointPolicy() = 0;
123 };
124 
125 
126 #endif /* !_PLANNINGUNIT_H_ */
127 
128 
129 // Local Variables: ***
130 // mode:c++ ***
131 // End: ***