MultiAgentDecisionProcess  Release 0.2.1
ActionObservationHistory.cpp
Go to the documentation of this file.
1 
29 #include "Action.h"
30 #include "Observation.h"
32 #include "ActionHistory.h"
33 #include "ObservationHistoryTree.h"
34 
35 using namespace std;
36 
37 #define DEBUG_AOH 0
38 
39 //Default constructor
42  IndividualHistory(agentI)
43 {
44  SetLength(0);
45  _m_pred = 0;
46  _m_ahI = 0; //HARDCODED
47  _m_ohI = 0; //HARDCODED
48 }
53 {
54  SetLength(pred->GetLength() + 1);
55  _m_pred = pred;
56  _m_ahI =
58  ->GetSuccessor(aI) //=aht'
59  ->GetIndex(); //=ahI'
60  _m_ohI =
62  ->GetSuccessor(oI) //=oht'
63  ->GetIndex(); //=ohI'
64 }
65 
67 {
68  stringstream ss;
69  if(_m_pred != 0)
70  {
71  if(_m_length >= 1)
72  ss << _m_pred->SoftPrint();
73  else
74  {
75  ss << "ObservationHistory:Print() - Warning:_m_pred != "<<
76  "null, but lenght < 1 !"<<endl;
77  throw E(ss);
78  }
79  }
80 
82  _m_agentI, _m_ahI) //=aht
83  ->GetContainedElement(); //=ah
84  if (!ah->IsEmpty()) // don't print the empty observation
85  {
86  ss << ", ";
87  Index aI = ah->GetLastActionIndex(); // aI
89  }
90  else
91  ss << "EMPTY_AH";
92 
93  ss << ", ";
94 
96  _m_agentI, _m_ohI) //=oht
97  ->GetContainedElement(); //=oh
98  if (!oh->ContainsEmptyOI()) // don't print the empty observation
99  {
100  ss << ", ";
101  Index oI = oh->GetLastObservationIndex(); // oI
103  }
104  else
105  ss << "Oempty";
106 
107  return(ss.str());
108 }