MultiAgentDecisionProcess
Release 0.2.1
Main Page
Namespaces
Classes
Files
File List
File Members
TOIDecPOMDPDiscrete.h
Go to the documentation of this file.
1
28
/* Only include this header file once. */
29
#ifndef _TOIDECPOMDPDISCRETE_H_
30
#define _TOIDECPOMDPDISCRETE_H_ 1
31
32
/* the include directives */
33
#include <iostream>
34
#include "
Globals.h
"
35
#include "
TransitionObservationIndependentMADPDiscrete.h
"
36
#include "
RewardModelTOISparse.h
"
37
#include "
DecPOMDP.h
"
38
#include "
DecPOMDPDiscrete.h
"
39
#include "
DecPOMDPDiscreteInterface.h
"
40
43
class
TOIDecPOMDPDiscrete
:
44
public
TransitionObservationIndependentMADPDiscrete
,
45
public
DecPOMDP
,
46
public
DecPOMDPDiscreteInterface
47
{
48
private
:
52
bool
_m_initialized
;
53
54
protected
:
55
#if 0
56
58
RewardModel
*
_m_p_rModel
;
59
#else
60
RewardModelTOISparse
*
_m_p_rModel
;
61
#endif
62
63
std::vector<DecPOMDPDiscrete*>
_m_individualDecPOMDPDs
;
64
65
public
:
66
// Constructor, destructor and copy assignment.
68
84
TOIDecPOMDPDiscrete
(
85
std::string name=
"received unspec. by TOIDecPOMDPDiscrete"
,
86
std::string descr=
"received unspec. by TOIDecPOMDPDiscrete"
,
87
std::string pf=
"received unspec. by TOIDecPOMDPDiscrete"
);
88
90
TOIDecPOMDPDiscrete
(
const
TOIDecPOMDPDiscrete
& a);
92
virtual
~TOIDecPOMDPDiscrete
();
93
95
TOIDecPOMDPDiscrete
&
operator
=
96
(
const
TOIDecPOMDPDiscrete
& o);
97
98
//operators:
99
100
//data manipulation (set) functions:
104
virtual
bool
SetInitialized
(
bool
b);
105
107
void
CreateNewRewardModel
();
108
110
void
SetReward
(
Index
sI,
Index
jaI,
double
r)
111
{
_m_p_rModel
->
Set
(
JointToIndividualStateIndices
(sI),
112
JointToIndividualActionIndices
(jaI),
113
r);
114
}
115
116
void
SetReward
(
const
std::vector<Index> &sIs,
117
const
std::vector<Index> &aIs,
double
r)
118
{
_m_p_rModel
->
Set
(sIs, aIs, r);
119
}
120
122
void
SetReward
(
Index
sI,
Index
jaI,
Index
sucSI,
double
r)
123
{
throw
(
E
(
"SetReward(sI,jaI,sucSI,r) is not implemented yet..."
));}
126
void
SetReward
(
Index
sI,
Index
jaI,
Index
sucSI,
Index
joI,
127
double
r)
128
{
throw
(
E
(
"SetReward(sI,jaI,sucSI,joI, r) not implemented yet..."
));}
129
130
void
SetIndividualDecPOMDPD
(
DecPOMDPDiscrete
*model,
Index
agentI);
131
132
//get (data) functions:
133
134
DecPOMDPDiscrete
*
GetIndividualDecPOMDPD
(
Index
agentI)
135
const
136
{
return
_m_individualDecPOMDPDs
[agentI];}
137
139
virtual
double
GetReward
(
Index
sI,
Index
jaI)
const
140
{
return
(
GetReward
(
JointToIndividualStateIndices
(sI),
141
JointToIndividualActionIndices
(jaI)));
142
}
143
virtual
double
GetReward
(
const
std::vector<Index> &sIs,
144
const
std::vector<Index> &aIs)
const
145
{
return
(
_m_p_rModel
->
Get
(sIs, aIs));
146
}
147
148
std::vector<double>
GetRewards
(
Index
sI,
Index
jaI)
const
;
149
151
virtual
std::string
SoftPrint
()
const
;
153
void
Print
()
const
154
{std::cout <<
SoftPrint
();}
155
156
157
//functions to implement the DecPOMDPInterface:
159
double
GetReward
(
State
* s,
JointAction
* ja)
const
160
{
161
return
GetReward
(
162
((
StateDiscrete
*)s)->GetIndex(),
163
((
JointActionDiscrete
*)ja)->GetIndex());
164
}
166
void
SetReward
(
State
* s,
JointAction
* ja,
double
r)
167
{
168
return
SetReward
(
169
((
StateDiscrete
*)s)->GetIndex(),
170
((
JointActionDiscrete
*)ja)->GetIndex(), r);
171
}
172
173
//functions to implement the POSGInterface:
174
176
177
void
SetRewardForAgent
(
Index
agentI,
State
* s,
JointAction
* ja,
double
r)
178
{
SetReward
(s, ja, r); }
180
181
double
GetRewardForAgent
(
Index
agentI,
State
* s,
JointAction
* ja)
const
182
{
return
GetReward
(s, ja); }
183
184
//functions to implement the POSGDiscreteInterface:
185
187
void
CreateNewRewardModelForAgent
(
Index
agentI)
188
{
CreateNewRewardModel
();}
189
190
void
SetRewardForAgent
(
Index
agentI,
Index
sI,
Index
jaI,
double
r)
191
{
SetReward
(sI, jaI, r);}
192
194
void
SetRewardForAgent
(
Index
agentI,
Index
sI,
Index
jaI,
195
Index
sucSI,
double
r)
196
{
SetReward
(sI, jaI, sucSI, r);}
197
199
void
SetRewardForAgent
(
Index
agentI,
Index
sI,
Index
jaI,
200
Index
sucSI,
Index
joI,
double
r)
201
{
SetReward
(sI, jaI, sucSI, joI, r);}
202
204
double
GetRewardForAgent
(
Index
agentI,
Index
sI,
Index
jaI)
const
205
{
return
GetReward
(sI, jaI);}
206
207
RGet
*
GetRGet
()
const
{
return
(0); }
208
210
virtual
TOIDecPOMDPDiscrete
*
Clone
()
const
211
{
return
new
TOIDecPOMDPDiscrete
(*
this
); }
212
213
};
214
215
216
#endif
/* !_TOIDECPOMDPDISCRETE_H_ */
217
218
// Local Variables: ***
219
// mode:c++ ***
220
// End: ***
src
base
TOIDecPOMDPDiscrete.h
Generated on Mon Sep 23 2013 14:50:05 for MultiAgentDecisionProcess by
1.8.1.2