31 using namespace ArgumentHandlers;
33 namespace ArgumentHandlers {
36 "<faolieho@science.uva.nl>, <mtjspaan@isr.ist.utl.pt>";
47 "This is the documentation for the .dpomdp file argument parser\
48 This parser should be included as a child argp parser in the \
49 main argp parser of your application.(and this message will\
51 \vPROBLEM is either \n\
52 a) one of the following standard problems: DT, FF\n\
54 b) a Dec-POMDP problem filename (.dpomdp or .toi-dpomdp). \
55 If it includes an extension, PROBLEM will be attempted to be loaded as is, \
56 otherwise the <PROBLEMSDIR> will be searched. \
57 I.e., ~/.madp/problems/PROBLEM.{toi-}dpomdp will be loaded.\n\
58 Some of the standard problems take options.";
64 {
"agents",
OPT_NRAGENTS,
"NRAGENTS", 0,
"FireFighting: the number of agents (2)" },
65 {
"houses",
OPT_NRHOUSES,
"NRHOUSES", 0,
"FireFighting: the number of houses (3)" },
66 {
"firelevels",
OPT_NRFLS,
"NRFLS", 0,
"FireFighting: the number of firelevels (3)"},
72 static bool got_problemFile = 0;
75 return ARGP_ERR_UNKNOWN;
83 theArgumentsStruc->
nrAgents = atoi(arg);
86 theArgumentsStruc->
nrHouses = atoi(arg);
89 theArgumentsStruc->
nrFLs = atoi(arg);
91 case ARGP_KEY_NO_ARGS:
96 theArgumentsStruc->
dpf = std::string(
"").c_str();
97 if(strcmp(arg,
"DT") == 0)
99 else if(strcmp(arg,
"FF") == 0)
102 theArgumentsStruc->
dpf = arg;
107 return ARGP_ERR_UNKNOWN;
121 "This is the documentation for the global options parser\
122 This parser should be included as a child argp parser in the \
123 main argp parser of your application. (and this message will\
127 {
"verbose",
'v', 0, 0,
"Produce verbose output. Specifying this option multiple times increases verbosity." },
128 {
"quiet",
'q', 0, 0,
"Don't produce any output" },
129 {
"silent",
's', 0, OPTION_ALIAS },
148 return ARGP_ERR_UNKNOWN;
162 "This is the documentation for the model options parser\
163 This parser should be included as a child argp parser in the \
164 main argp parser of your application. (and this message will\
170 {
"sparse",
's',0, 0,
"Use sparse transition and observation models" },
171 {
"toi",
OPT_TOI, 0, 0,
"Indicate that PROBLEM is a transition observation independent Dec-POMDP" },
172 {
"discount",
'g',
"GAMMA", 0,
"Set the problem's discount parameter (overriding its default)" },
185 theArgumentsStruc->
sparse = 1;
188 theArgumentsStruc->
isTOI=1;
191 theArgumentsStruc->
discount = strtof(arg,0);
194 return ARGP_ERR_UNKNOWN;
206 "This is the documentation for the solution method options parser\
207 This parser should be included as a child argp parser in the \
208 main argp parser of your application. (and this message will\
217 {
"horizon",
'h',
"HOR", 0,
"Specifies the horizon to be considered" },
218 {
"inf",
OPT_INF , 0, 0,
"Indicate that horizon is infinite" },
231 theArgumentsStruc->
horizon = atoi(arg);
237 return ARGP_ERR_UNKNOWN;
250 "This is the documentation for the joint policy index argument parser\
251 This parser should be included as a child argp parser in the \
252 main argp parser of your application.(and this message will\
254 \vJPOL-INDEX is a (long long) integer that is the index of the joint \
255 policy to be considered.";
263 static bool got_jpolIndex = 0;
266 return ARGP_ERR_UNKNOWN;
273 case ARGP_KEY_NO_ARGS:
279 theArgumentsStruc->
jpolIndex = strtoull(arg,&left,10);
282 std::stringstream ss;
283 ss <<
"Could not entirely parse the JPOL-INDEX: arg='"
284 << arg <<
"', left='" << left
285 <<
"', found jpol index='"<< theArgumentsStruc->
jpolIndex
293 return ARGP_ERR_UNKNOWN;
306 "This is the documentation for the options options parser\
307 This parser should be included as a child argp parser in the \
308 main argp parser of your application. (and this message will\
312 0 or MAAstar -> use GMAA_MAAstar\n\
313 1 or kGMAA -> use GMAA_kGMAA (uses K)\n\
314 2 or FSPC -> use Forward Sweep Policy Computation (kGMAA with k=1)\n\
316 BGIP_SOLVERTYPE parameter:\n\
317 0 or BFS\t-\tbrute force search\n\
318 1 or AM \t-\tAlternating Maximization\n";
322 {
"GMAA",
'G',
"GMAA", 0,
"Select which GMAA variation to use" },
323 {
"BGIP_Solver",
'B',
"BGIP_SOLVERTYPE", 0,
"Select which Bayesian game solver to use"},
324 {
"k",
'k',
"K", 0,
"Set k in k-GMAA" },
325 {
"restarts",
'r',
"RESTARTS", 0,
"Set the number of restarts"},
326 {
"AM-restarts",
AM_RESTARTS,
"AM_RESTARTS", 0,
"nr restarts for solving BGs withFSPC_AM"},
341 theArgumentsStruc->
gmaa=static_cast<GMAA_t>(atoi(arg));
342 else if(strcmp(arg,
"MAAstar")==0)
344 else if(strcmp(arg,
"FSPC")==0)
346 else if(strcmp(arg,
"kGMAA")==0)
349 return ARGP_ERR_UNKNOWN;
353 int methodI=atoi(arg);
355 throw E(
"Wrong BGIP_SolverType number!");
359 else if(strcmp(arg,
"BFS")==0)
361 else if(strcmp(arg,
"AM")==0)
364 return ARGP_ERR_UNKNOWN;
368 theArgumentsStruc->
k = atoi(arg);
377 return ARGP_ERR_UNKNOWN;
392 "This is the documentation for the options options parser\
393 This parser should be included as a child argp parser in the \
394 main argp parser of your application. (and this message will\
398 {
"savePOMDP",
'P', 0, 0,
"Save the POMDP to disk" },
399 {
"saveIntermediateV",
'V', 0, 0,
"Save intermediate value functions to disk" },
400 {
"saveTimings",
't', 0, 0,
"Save timing results to disk"},
401 {
"minNrIterations",
'i',
"ITERS", 0,
"Make Perseus run at least ITERS iterations" },
402 {
"initReward",
'I', 0, 0,
"Initialize the value function with the immediate reward."},
403 {
"initZero",
'z', 0, 0,
"Initialize the value function with 0."},
416 theArgumentsStruc->
nrBeliefs = atoi(arg);
437 return ARGP_ERR_UNKNOWN;
451 "This is the documentation for the options options parser\
452 This parser should be included as a child argp parser in the \
453 main argp parser of your application. (and this message will\
457 {
"beliefs",
'n',
"BELIEFS", 0,
"Set the belief set size" },
458 {
"saveBeliefs",
'B', 0, 0,
"Save beliefs to disk" },
459 {
"beliefSamplingHorizon",
'H',
"HORIZON", 0,
"Introduce an artificial horizon when sampling the beliefs (useful in infinite-horizon case)" },
460 {
"uniqueBeliefs",
'u', 0, 0,
"Sample unique beliefs (no duplicates)" },
461 {
"useQMDP",
'Q', 0, 0,
"Follow the QMDP policy while sampling beliefs instead of acting uniformly at random."},
462 {
"QMDPexploreProb",
'x',
"PROB", 0,
"Probability with which to take a random action when using QMDP for belief sampling."},
475 theArgumentsStruc->
nrBeliefs = atoi(arg);
493 return ARGP_ERR_UNKNOWN;
507 "This is the documentation for the options options parser\
508 This parser should be included as a child argp parser in the \
509 main argp parser of your application. (and this message will\
511 \vBACKUP parameter:\n\
512 0 or POMDP -> use PerseusPOMDP (default)\n\
513 1 or BG -> use PerseusBG (BG solver can be specified by BGBACKUP)\n\
515 BGBACKUP parameter (details in AlphaVectorBG.{h,cpp}):\n\
516 0 or EXH_MAX -> use EXHAUSTIVE_ONLYKEEPMAX backup in PerseusBG\n\
517 1 or EXH_ALL -> use EXHAUSTIVE_STOREALL backup in PerseusBG\n\
518 2 or BGS_EXH -> use BGIP_SOLVER_EXHAUSTIVE backup in PerseusBG (default)\n\
519 3 or BGS_ALTMAX -> use BGIP_SOLVER_ALTERNATINGMAXIMIZATION backup in PerseusBG\n\
520 4 or BGS_ALTMAX100 -> use BGIP_SOLVER_ALTERNATINGMAXIMIZATION_100STARTS backup\n\
524 {
"backup",
'b',
"BACKUP", 0,
"Select which backup to use, see below" },
525 {
"vectorEachBelief",
'e', 0, 0,
"If specified, don't sample from belief set, but compute vector for each belief" },
526 {
"BGbackup",
'y',
"BGBACKUP", 0,
"Select which BG backup to use for PerseusBG" },
527 {
"waitPenalty",
'w',
"PENALTY", 0,
"Set the wait penalty for PerseusImplicitWaiting" },
528 {
"weight",
'W',
"WEIGHT", 0,
"Set the weight for PerseusWeighted{NS}" },
529 {
"commModel",
'c',
"COMM", 0,
"Select the communication model for PerseusWeighted" },
543 theArgumentsStruc->
bgBackup=static_cast<BGBackupType>(atoi(arg));
544 else if(strcmp(arg,
"EXH_MAX")==0)
546 else if(strcmp(arg,
"EXH_ALL")==0)
548 else if(strcmp(arg,
"BGS_EXH")==0)
550 else if(strcmp(arg,
"BGS_ALTMAX")==0)
552 else if(strcmp(arg,
"BGS_ALTMAX100")==0)
555 return ARGP_ERR_UNKNOWN;
559 theArgumentsStruc->
backup=static_cast<PerseusBackupType>(atoi(arg));
560 else if(strcmp(arg,
"POMDP")==0)
562 else if(strcmp(arg,
"BG")==0)
565 return ARGP_ERR_UNKNOWN;
571 theArgumentsStruc->
weight = strtof(arg,0);
574 theArgumentsStruc->
commModel = atoi(arg);
580 return ARGP_ERR_UNKNOWN;
589 "Perseus backup options",
597 "This is the documentation for the options options parser\
598 This parser should be included as a child argp parser in the \
599 main argp parser of your application. (and this message will\
600 not be shown)\vQHEUR parameter:\n\
601 0 or QMDP (defined on joint beliefs)\n\
604 3 or QMDPc (cached for each joint AO history)";
607 {
"Qheuristic",
'Q',
"QHEUR", 0,
"Select which Q-heuristic to use" },
621 theArgumentsStruc->
qheur=static_cast<Qheur_t>(atoi(arg));
622 else if(strcmp(arg,
"QMDP")==0)
624 else if(strcmp(arg,
"QPOMDP")==0)
626 else if(strcmp(arg,
"QBG")==0)
628 else if(strcmp(arg,
"QMDPc")==0)
631 return ARGP_ERR_UNKNOWN;
634 return ARGP_ERR_UNKNOWN;
649 "This is the documentation for the options options parser\
650 This parser should be included as a child argp parser in the \
651 main argp parser of your application. (and this message will\
655 {
"runs",
'r',
"RUNS", 0,
"Set the number of episodes to simulate" },
656 {
"seed",
'S',
"SEED", 0,
"Set the random seed" },
669 theArgumentsStruc->
nrRuns=atoi(arg);
675 return ARGP_ERR_UNKNOWN;
683 "Simulation options",
691 "This is the documentation for the CE (cross entropy) options parser\
692 This parser should be included as a child argp parser in the \
693 main argp parser of your application. (and this message will\
696 Options for using CE (the cross-entropy method) for optimization include \
697 the number of restarts (runs), the number of iteration for each runs, \
698 how much samples are drawn each iteration, and how much of those are \
699 used to update the probability distribution.";
704 {
"CE-restarts",
CE_RESTARTS,
"CERESTARTS", 0,
"Set the number of CE restarts (runs)"},
705 {
"CE-eval-runs",
CE_EVALUATION_RUNS,
"CEEVALRUNS", 0,
"Set the number of policy evaluation runs. More runs will result in more accurate evaluation. (set 0 for exact evaluation)."},
706 {
"iterations",
'i',
"ITERATIONS", 0,
"Set the number of iterations per run"},
707 {
"samples",
'n',
"SAMPLES", 0,
"Set the number of samples per iteration"},
708 {
"updateSamples",
'u',
"UPDATESAMPPLES", 0,
"Set the number of samples used to update the prob. distribution."},
709 {
"not_strictly_improving",
'N', 0, 0,
"Do not use a hard threshold: do not require that newly sampled policies are strictly better then before. (this corresponds to the gamma in the CE papers)"},
710 {
"alpha",
'a',
"ALPHA", 0,
"The learning rate"},
741 theArgumentsStruc->
CE_alpha = atof(arg);
744 return ARGP_ERR_UNKNOWN;
758 "This is the documentation for the JESP (Joint Equilibrium-based \
759 Search for Policies) options parser.\
760 This parser should be included as a child argp parser in the \
761 main argp parser of your application. (and this message will\
764 Options for using JESP (Joint Equilibrium-based \
765 Search for Policies) include: \
766 the type of JESP (exhaustive or Dynamic Programming), which can be:\n\
767 0 or Exh - exhaustive JESP\n\
768 1 or DP - Dynamic programming\n\n\
769 and the number of restarts (runs).";
774 {
"JESP-restarts",
JESP_RESTARTS,
"JESPRESTARTS", 0,
"Set the number of JESP restarts (runs)"},
775 {
"JESP-type",
JESP_TYPE,
"JESPTYPE", 0,
"Set the type of JESP (Exh or [DP])"},
792 theArgumentsStruc->
jesp=
static_cast<JESP_t>(atoi(arg));
793 else if(strcmp(arg,
"Exh")==0)
795 else if(strcmp(arg,
"DP")==0)
798 return ARGP_ERR_UNKNOWN;
801 return ARGP_ERR_UNKNOWN;