MultiAgentDecisionProcess  Release 0.2.1
GeneralizedMAAStarPlannerForDecPOMDPDiscrete.cpp
Go to the documentation of this file.
1 
28 #include <float.h>
29 #include <limits.h>
31 
32 #include "QFunctionJAOHInterface.h"
33 
35 #include "PartialJPDPValuePair.h"
37 
38 //#include "JointObservationHistoryTree.h"
39 //#include "JointBeliefInterface.h"
40 //#include "JointActionObservationHistoryTree.h"
41 //#include "BeliefIteratorGeneric.h"
42 
43 
44 using namespace std;
45 
46 //Default constructor
49  size_t horizon,
51  , int verboseness)
52 :
53  PlanningUnitDecPOMDPDiscrete(params, horizon, p)
54  ,GeneralizedMAAStarPlanner(verboseness)
55 {
56  _m_qHeuristic=0;
58 }
59 
62  size_t horizon,
64 :
66 {
67  _m_qHeuristic=0;
69 }
70 
71 /*
72 //Destructor
73 GeneralizedMAAStarPlannerForDecPOMDPDiscrete::
74 ~GeneralizedMAAStarPlannerForDecPOMDPDiscrete()
75 {
76 }
77 */
78 //Copy assignment operator
80 {
81  if (this == &o) return *this; // Gracefully handle self assignment
82  // Put the normal assignment duties here...
83  throw("GeneralizedMAAStarPlannerForDecPOMDPDiscrete::operator= not implemented");
84 
85  return *this;
86 }
87 
88 //this function extends a previous policy jpolPrevTs for ts-1 with the behavior specified by the policy of the BayesianGame for time step ts (jpolBG).
90  const PartialJointPolicyDiscretePure& jpolPrevTs,
91  const JointPolicyDiscretePure& jpolBG,
92  const vector<size_t>& nrOHts,
93  const vector<Index>& firstOHtsI)
94 {
95  //check policy types
97  throw E("GeneralizedMAAStarPlannerForDecPOMDPDiscrete::ConstructExtendedJointPolicy --- jpolPrevTs.GetIndexDomainCategory() != PolicyGlobals::OHIST_INDEX ");
99  throw E("GeneralizedMAAStarPlannerForDecPOMDPDiscrete::ConstructExtendedJointPolicy --- jpolPrevTs.GetIndexDomainCategory() != PolicyGlobals::TYPE_INDEX ");
100  //construct a policy for the DecPOMDP:
101  //a copy of jpolPrevTs with extended to this time step (ts) by
102  //jpolBG
103  PartialJointPolicyDiscretePure* jpolTs = new
104  PartialJointPolicyPureVector(jpolPrevTs);
105  jpolTs->SetDepth( jpolTs->GetDepth()+1 );
106  for(Index agentI=0; agentI < GetNrAgents(); agentI++)
107  {
108  for(Index type = 0; type < nrOHts[agentI]; type++)
109  {
110  Index ohI = type + firstOHtsI[agentI];
111  jpolTs->SetAction(agentI, ohI,
112  jpolBG.GetActionIndex(agentI, type) );
113  }
114  }
115  return(jpolTs);
116 }
117 
118 
120 NewJPol() const
121 { return new PartialJointPolicyPureVector(*this, OHIST_INDEX, 0.0); }
122 
126 {
128  //this can be used to have a more compact representation by doing:
129  // PartialJointPolicyPureVector* p =
130  // static_cast<PartialJointPolicyPureVector*>(jp);
131  // ppi = new PartialJPPVIndexValPair(jp,v);
132 
134  //delete jp;
135  return (ppi);
136 }
137 
140 NewPP() const
141 {
142  return (new PolicyPoolPartialJPolValPair);
143 }