MultiAgentDecisionProcess
Release 0.2.1
Main Page
Namespaces
Classes
Files
File List
File Members
ObservationHistory.cpp
Go to the documentation of this file.
1
28
#include "
Observation.h
"
29
#include "
ObservationHistory.h
"
30
//Necessary as header file contains a forward declaration:
31
#include "
PlanningUnitMADPDiscrete.h
"
32
33
using namespace
std;
34
35
#define DEBUG_OH 0
36
37
//Default constructor
38
ObservationHistory::ObservationHistory
(
PlanningUnitMADPDiscrete
& pu,
39
Index
agentI) :
40
Referrer
<
PlanningUnitMADPDiscrete
>(pu),
41
IndividualHistory
(agentI)
42
{
43
SetLength
(0);
44
_m_observationI
= 0;
45
_m_containsEmptyOI
=
true
;
46
_m_pred
= 0;
47
}
48
49
ObservationHistory::ObservationHistory
(
PlanningUnitMADPDiscrete
& pu,
Index
agentI,
Index
obsI) :
50
IndividualHistory
(agentI)
51
{
52
throw
E
(
"ObservationHistory::ObservationHistory(Index obsI) not yet implemented - non-empty initial observations not yet supported."
);
53
}
54
55
ObservationHistory::ObservationHistory
(
Index
obsI,
ObservationHistory
* pred):
56
Referrer
<
PlanningUnitMADPDiscrete
>( pred->GetReferred() ),
57
IndividualHistory
(pred->_m_agentI)
58
{
59
SetLength
(pred->
GetLength
() + 1);
60
_m_observationI
= obsI;
61
_m_containsEmptyOI
=
false
;
62
_m_pred
= pred;
63
}
64
65
//Destructor
66
ObservationHistory::~ObservationHistory
()
67
{
68
if
(
DEBUG_OH
){ cout <<
"Deleting observation history: "
;
69
Print
(); cout << endl;}
70
}
71
72
string
ObservationHistory::SoftPrint
()
const
73
{
74
stringstream ss;
75
if
(
_m_pred
!= 0)
76
{
77
if
(
_m_length
>= 1)
78
ss <<
_m_pred
->
SoftPrint
();
79
else
80
throw
E
(
"ObservationHistory:SoftPrint() - Warning:_m_pred != null,\
81
but lenght <= 1 !"
);
82
}
83
if
(!
_m_containsEmptyOI
)
// don't print the empty observation
84
{
85
// ss << GetReferred()->GetObservationDiscrete(_m_agentI,
86
// let's see if this works...
87
ss <<
GetReferred
()->
GetObservation
(
_m_agentI
,
88
_m_observationI
)->
SoftPrintBrief
() <<
", "
;
89
}
90
else
91
ss <<
"Oempty, "
;
92
93
return
(ss.str());
94
}
src
support
ObservationHistory.cpp
Generated on Mon Sep 23 2013 14:50:06 for MultiAgentDecisionProcess by
1.8.1.2