MultiAgentDecisionProcess
Release 0.2.1
Main Page
Namespaces
Classes
Files
File List
File Members
GeneralizedMAAStarPlanner.h
Go to the documentation of this file.
1
28
/* Only include this header file once. */
29
#ifndef _GENERALIZEDMAASTARPLANNER_H_
30
#define _GENERALIZEDMAASTARPLANNER_H_ 1
31
32
/* the include directives */
33
#include <iostream>
34
#include <time.h>
35
#include <sys/times.h>
36
#include <fstream>
37
#include "
Globals.h
"
38
#include "
TimedAlgorithm.h
"
39
40
//use forward declarations when possible to speed up compilation:
41
//class PlanningUnitDecPOMDPDiscrete;
42
//class BayesianGameIdenticalPayoff;
43
44
//class JPolValPair;
45
//class QFunctionJAOHInterface;
46
//class TimedAlgorithm;
47
//class PolicyPoolJPolValPair;
48
49
class
PartialPolicyPoolInterface
;
50
class
PartialPolicyPoolItemInterface
;
51
52
class
JointPolicy
;
53
class
JointPolicyDiscrete
;
54
class
JointPolicyDiscretePure
;
55
class
JointPolicyPureVector
;
56
class
PartialJointPolicyDiscretePure
;
57
class
PartialJointPolicyPureVector
;
58
59
class
Interface_ProblemToPolicyDiscretePure
;
60
// keep these in header file so derived classes can use them
61
#define DEBUG_GMAA3 0
62
#define DEBUG_GMAA4 0
63
#define DEBUG_GMAA5 0
64
90
class
GeneralizedMAAStarPlanner
:
91
public
TimedAlgorithm
92
{
93
94
private
:
95
protected
:
97
JointPolicyDiscretePure
*
_m_foundPolicy
;
99
double
_m_expectedRewardFoundPolicy
;
100
101
103
int
_m_verboseness
;
104
107
LIndex
_m_maxJPolPoolSize
;
108
111
std::ofstream*
_m_intermediateResultFile
;
112
113
bool
_m_useSparseBeliefs
;
114
115
bool
_m_saveIntermediateTiming
;
116
std::string
_m_intermediateTimingFilename
;
117
118
size_t
_m_bgCounter
;
119
std::string
_m_bgBaseFilename
;
120
121
/*the # of joint policies for Bayesian Games that are evaluated.*/
122
LIndex
_m_nrJPolBGsEvaluated
;
123
124
size_t
_m_nrPoliciesToProcess
;
125
129
double
_m_slack
;
130
132
137
virtual
Interface_ProblemToPolicyDiscretePure
*
138
GetThisFromMostDerivedPU
() = 0;
139
140
// The 'NEXT' and 'SELECT' functions
141
148
virtual
bool
ConstructAndValuateNextPolicies
(
149
PartialPolicyPoolItemInterface
* ppi,
PartialPolicyPoolInterface
*
150
poolOfNextPolicies)=0;
151
159
virtual
void
SelectPoliciesToProcessFurther
(
PartialPolicyPoolInterface
*
160
poolOfNextPolicies,
bool
are_LBs,
double
bestLB)=0;
161
172
virtual
PartialPolicyPoolInterface
*
NewPP
()
const
=0;
183
// virtual PartialPolicyPoolItemInterface* NewPPI()=0;
188
virtual
PartialPolicyPoolItemInterface
*
NewPPI
(
189
PartialJointPolicyDiscretePure
* p,
190
double
v)
const
=0;
191
204
virtual
PartialJointPolicyDiscretePure
*
NewJPol
()
const
=0;
205
206
211
void
SelectKBestPoliciesToProcessFurther
(
212
PartialPolicyPoolInterface
* poolOfNextPolicies,
bool
are_LBs,
213
double
bestLB,
size_t
k);
214
215
216
//auxiliary functions -\todo TODO all these functions are now performed in BayesianGameForDecPOMDPStage, this class should use that class.
217
238
virtual
PartialJointPolicyDiscretePure
*
ConstructExtendedJointPolicy
(
239
const
PartialJointPolicyDiscretePure
& jpolPrevTs
240
,
const
JointPolicyDiscretePure
& jpolBG
241
,
const
std::vector<size_t>& nrOHts
242
,
const
std::vector<Index>& firstOHtsI) = 0;
243
/* this uses GetNrAgents() and should therefore not be put here...
244
//for convenience we also provide a possible implementation here
245
PartialJointPolicyPureVector* ConstructExtendedJointPolicyPureVector(
246
PartialJointPolicyPureVector& jpolPrevTs
247
, JointPolicyPureVector& jpolBG
248
, const std::vector<size_t>& nrOHts
249
, const std::vector<Index>& firstOHtsI);
250
*/
251
252
253
void
Prune
(
PartialPolicyPoolInterface
& JPVs,
size_t
k);
254
255
public
:
256
// Constructor, destructor and copy assignment.
258
GeneralizedMAAStarPlanner
(
259
int
verbose_level=0,
260
double
slack = 0.0
261
);
262
263
265
~GeneralizedMAAStarPlanner
();
267
GeneralizedMAAStarPlanner
&
operator=
(
const
268
GeneralizedMAAStarPlanner
& o);
269
//operators:
270
271
//data manipulation (set) functions:
272
273
void
SetIntermediateResultFile
(std::ofstream& of)
274
{
_m_intermediateResultFile
= &of;}
275
void
SetIntermediateTimingFilename
(std::string filename);
276
void
SetSaveAllBGs
(std::string filename)
277
{
_m_bgBaseFilename
=filename; }
278
void
SetVerbose
(
int
verbose);
279
280
void
Plan
();
281
282
//get (data) functions:
283
//do not define these functions here (that requires inclusion of
284
//header files...)
285
JointPolicy
*
GetJointPolicy
();
286
//{ return(_m_foundPolicy); }
287
JointPolicyDiscrete
*
GetJointPolicyDiscrete
();
288
//{ return(_m_foundPolicy); }
289
JointPolicyDiscretePure
*
GetJointPolicyDiscretePure
();
290
//{ return(_m_foundPolicy); }
291
292
double
GetExpectedReward
()
const
293
{
return
(
_m_expectedRewardFoundPolicy
); }
294
LIndex
GetMaxJPolPoolSize
()
const
295
{
return
(
_m_maxJPolPoolSize
);}
296
LIndex
GetNrEvaluatedJPolBGs
()
const
297
{
return
_m_nrJPolBGsEvaluated
;}
298
};
299
300
301
#endif
/* !_GENERALIZEDMAASTARPLANNER_H_ */
302
303
// Local Variables: ***
304
// mode:c++ ***
305
// End: ***
src
planning
GeneralizedMAAStarPlanner.h
Generated on Mon Sep 23 2013 14:50:05 for MultiAgentDecisionProcess by
1.8.1.2