MultiAgentDecisionProcess  Release 0.2.1
argumentHandlers.h
Go to the documentation of this file.
1 
28 #ifndef _ARGUMENTHANDLERS_H_
29 #define _ARGUMENTHANDLERS_H_ 1
30 
31 #include <iostream>
32 #include <stdlib.h>
33 #include <error.h>
34 #include <argp.h>
35 #include <vector>
36 #include "Globals.h"
37 #include "qheur.h"
38 #include "gmaatype.h"
39 #include "JESPtype.h"
40 #include "PerseusBackupType.h"
41 #include "BGBackupType.h"
42 #include "BGIP_SolverType.h"
43 #include "ProblemType.h" //problem enum.
44 
47 namespace ArgumentHandlers {
48 
49 using namespace qheur;
50 using namespace GMAAtype;
51 using namespace JESPtype;
52 using namespace BGIP_SolverType;
53 using namespace ProblemType;
54 
56 struct Arguments
57 {
58  //General options (globopt)
59  int verbose; // < 0 means quiet, > 0 is verbose
60 
61  //The dec-pomdp file argument (dpf)
62  const char * dpf; //the dpomdp file string
63  //do we use a standard (i.e. .cpp) problem rather than parsing:
65  size_t nrAgents;
66  size_t nrHouses;
67  size_t nrFLs;
68 
69  //output file options (outputFileOptions)
70  int dryrun;
71  char * description, * prefix;
72 
73  //model options (modelOptions)
74  int sparse;
75  int isTOI;
76  double discount;
77 
78  //solution methods options (solutionMethodOptions)
79  int horizon;
81 
82  //the jpolIndex input argument
84 
85  // GMAA options
86  GMAA_t gmaa; //the GMAA type
87  BGIP_Solver_t bgsolver; //the BG solver type
88  int nrRestarts; //the number of times that the GMAA algorithm is run
89  int k;
90 
91 
92 
93 
94  // JESP options
97  // alternating maximization options
99 
100  // Perseus options
108 
109  // Perseus belief set sampling options
115 
116  // Perseus backup options
119  double waitPenalty;
120  double weight;
123 
124  // Qheur options
126 
127  // Simulation options
128  int nrRuns;
130 
131 
132 
133 
134 
135 
136 
137 
138  // CE (cross-entropy) options
139  size_t nrCERestarts;
141  size_t nrCESamples;
143  bool CE_use_hard_threshold; //(gamma in CE papers)
144  double CE_alpha; //the learning rate
145  size_t nrCEEvalutionRuns; // number of policy evaluation runs
146 
147  //default values by constructor:
149  {
150  // general
151  verbose = 0;
152  // problem file
153  dpf = 0;
154  problem_type = PARSE;
155  nrAgents = 2;
156  nrHouses = 3;
157  nrFLs = 3;
158  // output
159  dryrun = 0;
160  description = NULL;
161  prefix = NULL;
162 
163  // model
164  sparse = 0;
165  isTOI = 0;
166  discount = -1;
167 
168  // solution method
169  horizon = 2;
170  infiniteHorizon = 0;
171 
172  // jpol index
173  jpolIndex = 0;
174 
175  // GMAA
176  gmaa = MAAstar;
177  bgsolver = BFS;
178  nrRestarts = 1;
179  nrAMRestarts = 10;
180  k = 1;
181 
182 
183 
184  //JESP options
185  jesp = JESPDP;
186  JESPnrRestarts = 10;
187 
188  // Perseus
189  savePOMDP = 0;
190  saveIntermediateV = 0;
191  minimumNrIterations = 0;
192  initializeWithImmediateReward = 0;
193  initializeWithZero = 0;
194  saveTimings = 0;
195 
196  // Perseus belief set sampling options
197  nrBeliefs = 10;
198  saveBeliefs = 0;
199  resetAfter = 0;
200  uniqueBeliefs = 0;
201  useQMDPforSamplingBeliefs = 0;
202  QMDPexploreProb = 0.1;
203 
204  // PerseusBackup
205  backup = POMDP;
206  bgBackup = BGIP_SOLVER_EXHAUSTIVE;
207  waitPenalty = -1;
208  weight = -1;
209  commModel = -1;
210  computeVectorForEachBelief = 0;
211 
212  // Qheur options
213  qheur = eQMDP;
214  // Simulation options
215  nrRuns = 1000;
216  randomSeed = 42;
217  // CE (cross-entropy) options
218  nrCERestarts = 10;
219  nrCEIterations = 50;
220  nrCESamples = 50;
221  nrCESamplesForUpdate = 10;
222  CE_use_hard_threshold = 1; //(gamma in CE papers)
223  CE_alpha = 0.3; //the learning rate
224  nrCEEvalutionRuns = 0; // number of policy evaluation runs. 0 = exact evaluation
225 
226  }
227 
228 };
229 
230 
231 extern const char *argp_program_bug_address;
232 
233 error_t problemFile_parse_argument (int key, char *arg,
234  struct argp_state *state);
235 extern const struct argp_child problemFile_child;
236 
237 error_t globalOptions_parse_argument (int key, char *arg,
238  struct argp_state *state);
239 extern const struct argp_child globalOptions_child;
240 
241 error_t modelOptions_parse_argument (int key, char *arg,
242  struct argp_state *state);
243 extern const struct argp_child modelOptions_child;
244 
245 error_t solutionMethodOptions_parse_argument (int key, char *arg,
246  struct argp_state *state);
247 extern const struct argp_child solutionMethodOptions_child;
248 
249 error_t jpolIndex_parse_argument (int key, char *arg,
250  struct argp_state *state);
251 extern const struct argp_child jpolIndex_child;
252 
253 error_t gmaa_parse_argument (int key, char *arg,
254  struct argp_state *state);
255 extern const struct argp_child gmaa_child;
256 
257 error_t perseus_parse_argument (int key, char *arg,
258  struct argp_state *state);
259 extern const struct argp_child perseus_child;
260 
261 error_t perseusbackup_parse_argument (int key, char *arg,
262  struct argp_state *state);
263 extern const struct argp_child perseusbackup_child;
264 
265 error_t perseusbelief_parse_argument (int key, char *arg,
266  struct argp_state *state);
267 extern const struct argp_child perseusbelief_child;
268 
269 error_t qheur_parse_argument (int key, char *arg,
270  struct argp_state *state);
271 extern const struct argp_child qheur_child;
272 
273 
274 error_t simulation_parse_argument (int key, char *arg,
275  struct argp_state *state);
276 extern const struct argp_child simulation_child;
277 
278 error_t CE_parse_argument (int key, char *arg,
279  struct argp_state *state);
280 extern const struct argp_child CE_child;
281 
282 error_t JESP_parse_argument (int key, char *arg,
283  struct argp_state *state);
284 extern const struct argp_child JESP_child;
285 
286 
287 } //namespace
288 
289 #endif /* !_ARGUMENTHANDLERS_H_*/