30 #include <sys/times.h>
42 #define DEBUG_AlphaVectorBG_BeliefBackup 0
43 #define DEBUG_AlphaVectorBG_CheckBGIP_SolverExhaustive 0
68 #if DEBUG_AlphaVectorBG_BeliefBackup
70 clock_t ticks_before, ticks_after;
71 ticks_before = times(&timeStruct);
94 #if DEBUG_AlphaVectorBG_BeliefBackup
95 ticks_after = times(&timeStruct);
96 cout <<
"AlphaVectorBG::BeliefBackup backuptype " << type
98 << ticks_after - ticks_before <<
" clock ticks, "
99 <<
static_cast<double>((ticks_after - ticks_before))
100 / sysconf(_SC_CLK_TCK)
104 #if DEBUG_AlphaVectorBG_CheckBGIP_SolverExhaustive
108 if(!alphaOK.
Equal(alpha))
116 vector<vector<bool> >
119 vector<vector<bool> > mask;
120 size_t nrInV=V.size();
123 vector<bool> maskA(nrInV,
false);
124 for(
unsigned int i=0;i!=nrInV;++i)
125 if(V[i].GetAction()==a1)
128 mask.push_back(maskA);
151 vector<vector<bool> > mask=
GetMask(V);
153 boost::numeric::ublas::matrix<int> bestG_oa1(nrO,nrA);
155 for(
unsigned int o=0;o!=nrO;o++)
156 for(
unsigned int a1=0;a1!=nrA;++a1)
162 if(bestG_oa1(o,a1)==-1)
182 throw(
E(
"AlphaVectorBG::BeliefBackupBGIP_Solver type not supported"));
185 BGIP_Solver->
Solve();
190 vector<double> best(nrS);
192 for(
unsigned int s=0;s!=nrS;++s)
195 for(
unsigned int o=0;o!=nrO;o++)
198 if(bestG_oa1(o,a1)!=-1)
199 best[s]+=(*G[a][o])(bestG_oa1(o,a1),s);
208 for(
unsigned int s=0;s!=nrS;s++)
235 vector<vector<bool> > mask=
GetMask(V);
250 boost::numeric::ublas::matrix<int> bestG_oa1(nrO,nrA);
253 for(
unsigned int o=0;o!=nrO;o++)
254 for(
unsigned int a1=0;a1!=nrA;++a1)
266 vector<double> current(nrS),best(nrS);
267 double v,bestValue=-DBL_MAX;
275 for(
unsigned int s=0;s!=nrS;++s)
278 for(
unsigned int o=0;o!=nrO;o++)
285 if(bestG_oa1(o,a1)!=-1)
286 current[s]+=(*G[a][o])(bestG_oa1(o,a1),s);
306 for(
unsigned int s=0;s!=nrS;s++)
333 vector<vector<bool> > mask=
GetMask(V);
348 boost::numeric::ublas::matrix<int> bestG_oa1(nrO,nrA);
351 for(
unsigned int o=0;o!=nrO;o++)
352 for(
unsigned int a1=0;a1!=nrA;++a1)
372 for(
unsigned int o=0;o!=nrO;o++)
373 for(
unsigned int s=0;s!=nrS;++s)
380 if(bestG_oa1(o,a1)!=-1)
381 g_baBeta(k,s)+=(*G[a][o])(bestG_oa1(o,a1),s);
393 for(
unsigned int s=0;s!=nrS;s++)
412 str=
"EXHAUSTIVE_ONLYKEEPMAX";
415 str=
"EXHAUSTIVE_STOREALL";
418 str=
"BGIP_SOLVER_EXHAUSTIVE";
421 str=
"BGIP_SOLVER_ALTERNATINGMAXIMIZATION";
424 str=
"BGIP_SOLVER_ALTERNATINGMAXIMIZATION_100STARTS";