Generated on Fri Jan 28 2022 04:43:06 for Gecode by doxygen 1.8.13
options.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2004
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining
15  * a copy of this software and associated documentation files (the
16  * "Software"), to deal in the Software without restriction, including
17  * without limitation the rights to use, copy, modify, merge, publish,
18  * distribute, sublicense, and/or sell copies of the Software, and to
19  * permit persons to whom the Software is furnished to do so, subject to
20  * the following conditions:
21  *
22  * The above copyright notice and this permission notice shall be
23  * included in all copies or substantial portions of the Software.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32  *
33  */
34 
35 #include <gecode/driver.hh>
36 
37 #include <iostream>
38 #include <iomanip>
39 
40 #include <cstdlib>
41 #include <cstring>
42 
43 namespace Gecode {
44 
45  namespace Driver {
46 
47  /*
48  * Option baseclass
49  *
50  */
51  char*
52  BaseOption::strdup(const char* s) {
53  if (s == NULL)
54  return NULL;
55  char* d = heap.alloc<char>(static_cast<unsigned long int>(strlen(s)+1));
56  (void) strcpy(d,s);
57  return d;
58  }
59 
60  char*
61  BaseOption::stredup(const char* s) {
62  if (s == NULL)
63  return NULL;
64  char* d = heap.alloc<char>(static_cast<unsigned long int>(strlen(s)+2));
65  d[0] = '-';
66  (void) strcpy(d+1,s);
67  return d;
68  }
69 
70  void
71  BaseOption::strdel(const char* s) {
72  if (s == NULL)
73  return;
74  heap.rfree(const_cast<char*>(s));
75  }
76 
77  char*
78  BaseOption::argument(int argc, char* argv[]) const {
79  if (argc < 2)
80  return NULL;
81  const char* s = argv[1];
82  if (s[0] == '-') {
83  s++;
84  if (s[0] == '-')
85  s++;
86  } else {
87  return NULL;
88  }
89  if (strcmp(s,eopt))
90  return NULL;
91  if (argc == 2) {
92  std::cerr << "Missing argument for option \"" << iopt << "\""
93  << std::endl;
94  exit(EXIT_FAILURE);
95  }
96  return argv[2];
97  }
98 
99  BaseOption::BaseOption(const char* o, const char* e)
100  : eopt(strdup(o)), iopt(stredup(o)), exp(strdup(e)) {}
101 
103  strdel(eopt);
104  strdel(iopt);
105  strdel(exp);
106  }
107 
108 
109  StringValueOption::StringValueOption(const char* o, const char* e,
110  const char* v)
111  : BaseOption(o,e), cur(strdup(v)) {}
112  void
114  strdel(cur);
115  cur = strdup(v);
116  }
117  int
118  StringValueOption::parse(int argc, char* argv[]) {
119  if (char* a = argument(argc,argv)) {
120  cur = strdup(a);
121  return 2;
122  }
123  return 0;
124  }
125  void
127  std::cerr << '\t' << iopt << " (string) default: "
128  << ((cur == NULL) ? "NONE" : cur) << std::endl
129  << "\t\t" << exp << std::endl;
130  }
132  strdel(cur);
133  }
134 
135 
136 
137  void
138  StringOption::add(int v, const char* o, const char* h) {
139  Value* n = new Value;
140  n->val = v;
141  n->opt = strdup(o);
142  n->help = strdup(h);
143  n->next = NULL;
144  if (fst == NULL) {
145  fst = n;
146  } else {
147  lst->next = n;
148  }
149  lst = n;
150  }
151  int
152  StringOption::parse(int argc, char* argv[]) {
153  if (char* a = argument(argc,argv)) {
154  for (Value* v = fst; v != NULL; v = v->next)
155  if (!strcmp(a,v->opt)) {
156  cur = v->val;
157  return 2;
158  }
159  std::cerr << "Wrong argument \"" << a
160  << "\" for option \"" << iopt << "\""
161  << std::endl;
162  exit(EXIT_FAILURE);
163  }
164  return 0;
165  }
166  void
168  if (fst == NULL)
169  return;
170  std::cerr << '\t' << iopt << " (";
171  const char* d = NULL;
172  for (Value* v = fst; v != NULL; v = v->next) {
173  std::cerr << v->opt << ((v->next != NULL) ? ", " : "");
174  if (v->val == cur)
175  d = v->opt;
176  }
177  std::cerr << ")";
178  if (d != NULL)
179  std::cerr << " default: " << d;
180  std::cerr << std::endl << "\t\t" << exp << std::endl;
181  for (Value* v = fst; v != NULL; v = v->next)
182  if (v->help != NULL)
183  std::cerr << "\t\t " << v->opt << ": " << v->help << std::endl;
184  }
185 
187  Value* v = fst;
188  while (v != NULL) {
189  strdel(v->opt);
190  strdel(v->help);
191  Value* n = v->next;
192  delete v;
193  v = n;
194  }
195  }
196 
197 
198  int
199  IntOption::parse(int argc, char* argv[]) {
200  if (char* a = argument(argc,argv)) {
201  cur = atoi(a);
202  return 2;
203  }
204  return 0;
205  }
206 
207  void
209  std::cerr << '\t' << iopt << " (int) default: " << cur << std::endl
210  << "\t\t" << exp << std::endl;
211  }
212 
213 
214  int
215  UnsignedIntOption::parse(int argc, char* argv[]) {
216  if (char* a = argument(argc,argv)) {
217  cur = static_cast<unsigned int>(atoi(a));
218  return 2;
219  }
220  return 0;
221  }
222 
223  void
225  std::cerr << '\t' << iopt << " (unsigned int) default: "
226  << cur << std::endl
227  << "\t\t" << exp << std::endl;
228  }
229 
230 
231  int
232  DoubleOption::parse(int argc, char* argv[]) {
233  if (char* a = argument(argc,argv)) {
234  cur = atof(a);
235  return 2;
236  }
237  return 0;
238  }
239 
240  void
242  using namespace std;
243  cerr << '\t' << iopt << " (double) default: " << cur << endl
244  << "\t\t" << exp << endl;
245  }
246 
247 
248  int
249  BoolOption::parse(int argc, char* argv[]) {
250  if (argc < 2)
251  return 0;
252  const char* s = argv[1];
253  if (s[0] == '-') {
254  s++;
255  if (s[0] == '-')
256  s++;
257  } else {
258  return 0;
259  }
260  if (strcmp(s,eopt))
261  return 0;
262  if (argc == 2) {
263  // Option without argument
264  cur = true;
265  return 1;
266  } else if (!strcmp(argv[2],"true") || !strcmp(argv[2],"1")) {
267  cur = true;
268  return 2;
269  } else if (!strcmp(argv[2],"false") || !strcmp(argv[2],"0")) {
270  cur = false;
271  return 2;
272  } else {
273  // Option without argument
274  cur = true;
275  return 1;
276  }
277  return 0;
278  }
279 
280  void
282  using namespace std;
283  cerr << '\t' << iopt << " (optional: false, 0, true, 1) default: "
284  << (cur ? "true" : "false") << endl
285  << "\t\t" << exp << endl;
286  }
287 
288  /*
289  * Integer propagation level option
290  *
291  */
293  : BaseOption("ipl","integer propagation level (comma-separated list)"),
294  cur(ipl) {}
295 
296  int
297  IplOption::parse(int argc, char* argv[]) {
298  if (char* a = argument(argc,argv)) {
299  int b = IPL_DEF;
300  int m = IPL_DEF;
301  do {
302  // Search for a comma
303  char* c = a;
304  while ((*c != ',') && (*c != 0))
305  c++;
306  unsigned int e = static_cast<unsigned int>(c-a);
307  if (!strncmp("def",a,e)) { b = IPL_DEF; }
308  else if (!strncmp("val",a,e)) { b = IPL_VAL; }
309  else if (!strncmp("bnd",a,e)) { b = IPL_BND; }
310  else if (!strncmp("dom",a,e)) { b = IPL_DOM; }
311  else if (!strncmp("basic",a,e)) { m |= IPL_BASIC; }
312  else if (!strncmp("advanced",a,e)) { m |= IPL_ADVANCED; }
313  else {
314  std::cerr << "Wrong argument \"" << a
315  << "\" for option \"" << iopt << "\""
316  << std::endl;
317  exit(EXIT_FAILURE);
318  }
319 
320  if (*c == ',') a = c+1; else a = c;
321 
322  } while (*a != 0);
323 
324  cur = static_cast<IntPropLevel>(b | m);
325  return 2;
326  }
327  return 0;
328  }
329 
330  void
332  using namespace std;
333  cerr << '\t' << iopt
334  << " (def,val,bnd,dom,basic,advanced)" << endl
335  << "\t\tdefault: ";
336  switch (vbd(cur)) {
337  case IPL_DEF: cerr << "def"; break;
338  case IPL_VAL: cerr << "val"; break;
339  case IPL_BND: cerr << "bnd"; break;
340  case IPL_DOM: cerr << "dom"; break;
341  default: GECODE_NEVER;
342  }
343  if (cur & IPL_BASIC) cerr << ",basic";
344  if (cur & IPL_ADVANCED) cerr << ",advanced";
345  cerr << endl << "\t\t" << exp << endl;
346  }
347 
348 
349  /*
350  * Trace flag option
351  *
352  */
354  : BaseOption("trace","trace flags (comma-separated list)"),
355  cur(f) {}
356 
357  int
358  TraceOption::parse(int argc, char* argv[]) {
359  if (char* a = argument(argc,argv)) {
360  cur = 0;
361  do {
362  // Search for a comma
363  char* c = a;
364  while ((*c != ',') && (*c != 0))
365  c++;
366  unsigned int e = static_cast<unsigned int>(c-a);
367  if (!strncmp("init",a,e)) { cur |= TE_INIT; }
368  else if (!strncmp("prune",a,e)) { cur |= TE_PRUNE; }
369  else if (!strncmp("fix",a,e)) { cur |= TE_FIX; }
370  else if (!strncmp("fail",a,e)) { cur |= TE_FAIL; }
371  else if (!strncmp("done",a,e)) { cur |= TE_DONE ; }
372  else if (!strncmp("propagate",a,e)) { cur |= TE_PROPAGATE; }
373  else if (!strncmp("commit",a,e)) { cur |= TE_COMMIT; }
374  else if (!strncmp("none",a,e) ||
375  !strncmp("false",a,e) ||
376  !strncmp("0",a,e)) { cur = 0; }
377  else if (!strncmp("all",a,e) ||
378  !strncmp("1",a,e)) { cur = (TE_INIT |
379  TE_PRUNE |
380  TE_FIX |
381  TE_FAIL |
382  TE_DONE |
383  TE_PROPAGATE |
384  TE_COMMIT); }
385  else if (!strncmp("variable",a,e)) { cur = (TE_INIT |
386  TE_PRUNE |
387  TE_FIX |
388  TE_FAIL |
389  TE_DONE); }
390  else if (!strncmp("general",a,e)) { cur = (TE_PROPAGATE |
391  TE_COMMIT); }
392  else {
393  std::cerr << "Wrong argument \"" << a
394  << "\" for option \"" << iopt << "\""
395  << std::endl;
396  exit(EXIT_FAILURE);
397  }
398 
399  if (*c == ',') a = c+1; else a = c;
400 
401  } while (*a != 0);
402 
403  return 2;
404  }
405  return 0;
406  }
407 
408  void
410  using namespace std;
411  cerr << '\t' << iopt
412  << " (init,prune,fix,fail,done,propagate,commit,none,all,variable,general)"
413  << " default: ";
414  if (cur == 0) {
415  cerr << "none";
416  } else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE |
417  TE_PROPAGATE | TE_COMMIT)) {
418  cerr << "all";
419  } else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE)) {
420  cerr << "variable";
421  } else if (cur == (TE_PROPAGATE | TE_COMMIT)) {
422  cerr << "general";
423  } else {
424  int f = cur;
425  if ((f & TE_INIT) != 0) {
426  cerr << "init";
427  f -= TE_INIT;
428  if (f != 0) cerr << ',';
429  }
430  if ((f & TE_PRUNE) != 0) {
431  cerr << "prune";
432  f -= TE_PRUNE;
433  if (f != 0) cerr << ',';
434  }
435  if ((f & TE_FIX) != 0) {
436  cerr << "fix";
437  f -= TE_FIX;
438  if (f != 0) cerr << ',';
439  }
440  if ((f & TE_FAIL) != 0) {
441  cerr << "fail";
442  f -= TE_FAIL;
443  if (f != 0) cerr << ',';
444  }
445  if ((f & TE_DONE) != 0) {
446  cerr << "done";
447  f -= TE_DONE;
448  if (f != 0) cerr << ',';
449  }
450  if ((f & TE_PROPAGATE) != 0) {
451  cerr << "propagate";
452  f -= TE_PROPAGATE;
453  if (f != 0) cerr << ',';
454  }
455  if ((f & TE_COMMIT) != 0) {
456  cerr << "commit";
457  }
458  }
459  cerr << endl << "\t\t" << exp << endl;
460  }
461 
462 
463  }
464 
465  void
467  o.next = NULL;
468  if (fst == NULL) {
469  fst=&o;
470  } else {
471  lst->next=&o;
472  }
473  lst=&o;
474  }
476  : fst(NULL), lst(NULL),
477  _name(Driver::BaseOption::strdup(n)) {}
478 
479  void
480  BaseOptions::name(const char* n) {
483  }
484 
485  void
487  std::cerr << "Gecode configuration information:" << std::endl
488  << " - Version: " << GECODE_VERSION << std::endl
489  << " - Variable types: ";
490 #ifdef GECODE_HAS_INT_VARS
491  std::cerr << "BoolVar IntVar ";
492 #endif
493 #ifdef GECODE_HAS_SET_VARS
494  std::cerr << "SetVar ";
495 #endif
496 #ifdef GECODE_HAS_FLOAT_VARS
497  std::cerr << "FloatVar "
498  << std::endl
499  << " - Trigonometric and transcendental float constraints: ";
500 #ifdef GECODE_HAS_MPFR
501  std::cerr << "enabled";
502 #else
503  std::cerr << "disabled";
504 #endif
505 #endif
506  std::cerr << std::endl;
507  std::cerr << " - Thread support: ";
508 #ifdef GECODE_HAS_THREADS
509  if (Support::Thread::npu() == 1)
510  std::cerr << "enabled (1 processing unit)";
511  else
512  std::cerr << "enabled (" << Support::Thread::npu()
513  << " processing units)";
514 #else
515  std::cerr << "disabled";
516 #endif
517  std::cerr << std::endl
518  << " - Gist support: ";
519 #ifdef GECODE_HAS_GIST
520  std::cerr << "enabled";
521 #else
522  std::cerr << "disabled";
523 #endif
524  std::cerr << std::endl
525  << " - CPProfiler support: ";
526 #ifdef GECODE_HAS_CPPROFILER
527  std::cerr << "enabled";
528 #else
529  std::cerr << "disabled";
530 #endif
531  std::cerr << std::endl << std::endl
532  << "Options for " << name() << ":" << std::endl
533  << "\t-help, --help, -?" << std::endl
534  << "\t\tprint this help message" << std::endl;
535  for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
536  o->help();
537  }
538 
539  void
540  BaseOptions::parse(int& argc, char* argv[]) {
541  int c = argc;
542  char** v = argv;
543  next:
544  for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
545  if (int a = o->parse(c,v)) {
546  c -= a; v += a;
547  goto next;
548  }
549  if (c >= 2) {
550  if (!strcmp(v[1],"-help") || !strcmp(v[1],"--help") ||
551  !strcmp(v[1],"-?")) {
552  help();
553  exit(EXIT_SUCCESS);
554  }
555  }
556  // Copy remaining arguments
557  argc = c;
558  for (int i=1; i<argc; i++)
559  argv[i] = v[i];
560  return;
561  }
562 
565  }
566 
567 
568  Options::Options(const char* n)
569  : BaseOptions(n),
570 
571  _model("model","model variants"),
572  _symmetry("symmetry","symmetry variants"),
573  _propagation("propagation","propagation variants"),
574  _branching("branching","branching variants"),
575  _decay("decay","decay factor",1.0),
576  _seed("seed","random number generator seed",1U),
577  _step("step","step distance for float optimization",0.0),
578 
579  _search("search","search engine variants"),
580  _solutions("solutions","number of solutions (0 = all)",1),
581  _threads("threads","number of threads (0 = #processing units)",
582  Search::Config::threads),
583  _c_d("c-d","recomputation commit distance",Search::Config::c_d),
584  _a_d("a-d","recomputation adaptation distance",Search::Config::a_d),
585  _d_l("d-l","discrepancy limit for LDS",Search::Config::d_l),
586  _node("node","node cutoff (0 = none, solution mode)"),
587  _fail("fail","failure cutoff (0 = none, solution mode)"),
588  _time("time","time (in ms) cutoff (0 = none, solution mode)"),
589  _assets("assets","#portfolio assets (#engines)",0),
590  _slice("slice","portfolio slice (in #failures)",Search::Config::slice),
591  _restart("restart","restart sequence type",RM_NONE),
592  _r_base("restart-base","base for geometric restart sequence",
593  Search::Config::base),
594  _r_scale("restart-scale","scale factor for restart sequence",
595  Search::Config::slice),
596  _nogoods("nogoods","whether to use no-goods from restarts",false),
597  _nogoods_limit("nogoods-limit","depth limit for no-good extraction",
598  Search::Config::nogoods_limit),
599  _relax("relax","probability for relaxing variable", 0.0),
600  _interrupt("interrupt","whether to catch Ctrl-C (true) or not (false)",
601  true),
602 
603  _mode("mode","how to execute script",SM_SOLUTION),
604  _samples("samples","how many samples (time mode)",1),
605  _iterations("iterations","iterations per sample (time mode)",1),
606  _print_last("print-last",
607  "whether to only print the last solution (solution mode)",
608  false),
609  _out_file("file-sol", "where to print solutions "
610  "(supports stdout, stdlog, stderr)","stdout"),
611  _log_file("file-stat", "where to print statistics "
612  "(supports stdout, stdlog, stderr)","stdout"),
613  _trace(0)
614 
615 #ifdef GECODE_HAS_CPPROFILER
616  ,
617  _profiler_id("cpprofiler-id", "use this execution id with CP-profiler", 0),
618  _profiler_port("cpprofiler-port", "connect to CP-profiler on this port",
619  Search::Config::cpprofiler_port),
620  _profiler_info("cpprofiler-info", "send solution information to CP-profiler", false)
621 #endif
622  {
623 
624  _mode.add(SM_SOLUTION, "solution");
625  _mode.add(SM_TIME, "time");
626  _mode.add(SM_STAT, "stat");
627  _mode.add(SM_GIST, "gist");
628  _mode.add(SM_CPPROFILER, "cpprofiler");
629 
630  _restart.add(RM_NONE,"none");
631  _restart.add(RM_CONSTANT,"constant");
632  _restart.add(RM_LINEAR,"linear");
633  _restart.add(RM_LUBY,"luby");
634  _restart.add(RM_GEOMETRIC,"geometric");
635 
639  add(_d_l);
641  add(_assets); add(_slice);
644  add(_relax);
647 #ifdef GECODE_HAS_CPPROFILER
648  add(_profiler_id);
651 #endif
652  }
653 
654 
656  : Options(e), _size(0) {}
657 
658  void
660  Options::help();
661  std::cerr << "\t(unsigned int) default: " << size() << std::endl
662  << "\t\twhich version/size for script" << std::endl;
663  }
664 
665  void
666  SizeOptions::parse(int& argc, char* argv[]) {
667  Options::parse(argc,argv);
668  if (argc < 2)
669  return;
670  size(static_cast<unsigned int>(atoi(argv[1])));
671  }
672 
673 
674 
676  : Options(e), _inst(NULL) {}
677 
678  void
679  InstanceOptions::instance(const char* s) {
682  }
683 
684  void
686  Options::help();
687  std::cerr << "\t(string) default: " << instance() << std::endl
688  << "\t\twhich instance for script" << std::endl;
689  }
690 
691  void
692  InstanceOptions::parse(int& argc, char* argv[]) {
693  Options::parse(argc,argv);
694  if (argc < 2)
695  return;
696  instance(argv[1]);
697  }
698 
701  }
702 
703 }
704 
705 // STATISTICS: driver-any
virtual void help(void)
Print help text.
Definition: options.cpp:331
char * argument(int argc, char *argv[]) const
Definition: options.cpp:78
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Definition: driver.hh:385
Bounds propagation.
Definition: int.hh:978
Restart with linear sequence.
Definition: driver.hh:109
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Definition: driver.hh:399
virtual ~StringValueOption(void)
Destructor.
Definition: options.cpp:131
IntPropLevel vbd(IntPropLevel ipl)
Extract value, bounds, or domain propagation from propagation level.
Definition: ipl.hpp:37
Options(const char *s)
Initialize options for script with name s.
Definition: options.cpp:568
Driver::UnsignedIntOption _iterations
How many iterations per sample.
Definition: driver.hh:406
StringValueOption(const char *o, const char *e, const char *v=NULL)
Initialize for option o and explanation e and default value v.
Definition: options.cpp:109
static unsigned int npu(void)
Return number of processing units (1 if information not available)
Definition: none.hpp:76
Driver::DoubleOption _decay
Decay option.
Definition: driver.hh:375
virtual void help(void)
Print help text.
Definition: options.cpp:659
Driver::DoubleOption _step
Step option.
Definition: driver.hh:377
virtual void help(void)
Print help text.
Definition: options.cpp:167
virtual void help(void)
Print help text.
Definition: options.cpp:409
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:215
const char * exp
Short explanation.
Definition: driver.hh:126
void rfree(void *p)
Free memory block starting at p.
Definition: heap.hpp:371
Value * next
Next option value.
Definition: driver.hh:182
const char * opt
String for option value.
Definition: driver.hh:180
virtual void help(void)
Print help text.
Definition: options.cpp:281
Driver::DoubleOption _threads
How many threads to use.
Definition: driver.hh:384
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
Definition: driver.hh:397
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:666
Driver::StringOption _restart
Restart method option.
Definition: driver.hh:393
Driver::BoolOption _nogoods
Whether to use no-goods.
Definition: driver.hh:396
void add(int v, const char *o, const char *h=NULL)
Add option value for value v, string o, and help text h.
Definition: options.cpp:138
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Definition: driver.hh:387
Driver::UnsignedIntOption _profiler_port
Connect to this port.
Definition: driver.hh:414
Base class for options.
Definition: driver.hh:121
Restart with Luby sequence.
Definition: driver.hh:110
const char * instance(void) const
Return instance name.
Definition: options.hpp:599
static void strdel(const char *s)
Delete heap-allocated copy of string s.
Definition: options.cpp:71
Definition: flatzinc.cpp:52
No restarts.
Definition: driver.hh:107
Driver::DoubleOption _r_base
Restart base.
Definition: driver.hh:394
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
Definition: driver.hh:415
Trace init events.
Definition: recorder.hpp:43
const char * iopt
String for option (including hyphen)
Definition: driver.hh:125
void add(Driver::BaseOption &o)
Add new option o.
Definition: options.cpp:466
const char * eopt
String for option (excluding hyphen)
Definition: driver.hh:124
Trace commit operations by branchers.
Definition: recorder.hpp:51
Gecode::IntSet d(v, 7)
Driver::StringOption _model
General model options.
Definition: driver.hh:370
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:297
Gecode::FloatVal c(-8, 8)
Trace prune events.
Definition: recorder.hpp:44
T * alloc(long unsigned int n)
Allocate block of n objects of type T from heap.
Definition: heap.hpp:431
const unsigned int cpprofiler_port
Default port for CPProfiler.
Definition: search.hh:134
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
TraceOption(int f=0)
Initialize with no tracing.
Definition: options.cpp:353
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Definition: driver.hh:389
Gecode::IntArgs i({1, 2, 3, 4})
Print solution and some statistics.
Definition: driver.hh:95
const char * help
Optional help text.
Definition: driver.hh:181
int cur
Current value.
Definition: driver.hh:311
Driver::UnsignedIntOption _samples
How many samples.
Definition: driver.hh:405
Driver::StringValueOption _log_file
Where to print statistics.
Definition: driver.hh:409
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
Definition: driver.hh:391
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Definition: search.hh:115
Simple propagation levels.
Definition: int.hh:976
virtual ~BaseOption(void)
Destructor.
Definition: options.cpp:102
Driver::StringOption _propagation
Propagation options.
Definition: driver.hh:372
Base class for script options.
Definition: driver.hh:331
IplOption(IntPropLevel ipl=IPL_DEF)
Initialize with default value ipl.
Definition: options.cpp:292
const char * _name
Script name.
Definition: driver.hh:335
Use basic propagation algorithm.
Definition: int.hh:981
struct Gecode::@593::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Measure average runtime.
Definition: driver.hh:96
Value propagation.
Definition: int.hh:977
const char * name(void) const
Return name of script.
Definition: options.hpp:166
Driver::StringOption _search
Search options.
Definition: driver.hh:382
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:358
Driver::BoolOption _print_last
Print only last solution found.
Definition: driver.hh:407
#define GECODE_VERSION
Definition: config.hpp:107
BaseOption * next
Next option Check for option and return its argument.
Definition: driver.hh:127
const unsigned int d_l
Default discrepancy limit for LDS.
Definition: search.hh:123
Driver::StringOption _symmetry
General symmetry options.
Definition: driver.hh:371
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Definition: driver.hh:386
Use advanced propagation algorithm.
Definition: int.hh:982
Driver::UnsignedIntOption _time
Cutoff for time.
Definition: driver.hh:390
Driver::StringOption _mode
Script mode to run.
Definition: driver.hh:404
const double threads
Number of threads to use.
Definition: search.hh:110
int val
Value for an option value.
Definition: driver.hh:179
Driver::DoubleOption _relax
Probability to relax variable.
Definition: driver.hh:398
static char * stredup(const char *s)
Create heap-allocated copy of string s with hyphen added.
Definition: options.cpp:61
const char * value(void) const
Return current option value.
Definition: options.hpp:46
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:540
const int v[7]
Definition: distinct.cpp:259
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:974
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
virtual ~StringOption(void)
Destructor.
Definition: options.cpp:186
Trace done events.
Definition: recorder.hpp:47
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:249
const double base
Base for geometric restart sequence.
Definition: search.hh:126
Print statistics for script.
Definition: driver.hh:97
Run script with CP-profiler.
Definition: driver.hh:99
virtual void help(void)
Print help text.
Definition: options.cpp:208
Driver::TraceOption _trace
Trace flags for tracing.
Definition: driver.hh:410
Restart with geometric sequence.
Definition: driver.hh:111
static char * strdup(const char *s)
Create heap-allocated copy of string s.
Definition: options.cpp:52
Driver::StringValueOption _out_file
Where to print solutions.
Definition: driver.hh:408
Driver::BaseOption * fst
First registered option.
Definition: driver.hh:333
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:232
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:152
Heap heap
The single global heap.
Definition: heap.cpp:44
InstanceOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:675
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Definition: driver.hh:413
const char * _inst
Instance string.
Definition: driver.hh:698
Domain propagation Options: basic versus advanced propagation.
Definition: int.hh:979
virtual void help(void)
Print help text.
Definition: options.cpp:126
Driver::UnsignedIntOption _solutions
How many solutions.
Definition: driver.hh:383
virtual void help(void)
Print help text.
Definition: options.cpp:224
Driver::StringOption _branching
Branching options.
Definition: driver.hh:374
Run script in Gist.
Definition: driver.hh:98
IntPropLevel cur
Current value.
Definition: driver.hh:291
const char * cur
Current value.
Definition: driver.hh:153
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
Definition: search.hh:113
Trace fail events.
Definition: recorder.hpp:46
SizeOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:655
Trace propagator executions.
Definition: recorder.hpp:50
Trace fixpoint events.
Definition: recorder.hpp:45
~InstanceOptions(void)
Destructor.
Definition: options.cpp:699
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
Definition: options.cpp:99
virtual void help(void)
Print help text.
Definition: options.cpp:241
Driver::IplOption _ipl
Integer propagation level.
Definition: driver.hh:373
Gecode toplevel namespace
Driver::UnsignedIntOption _seed
Seed option.
Definition: driver.hh:376
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:118
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:692
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Definition: search.hh:131
virtual ~BaseOptions(void)
Destructor.
Definition: options.cpp:563
BaseOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:475
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56
unsigned int size(void) const
Return size.
Definition: options.hpp:590
Options for scripts
Definition: driver.hh:366
Restart with constant sequence.
Definition: driver.hh:108
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Definition: driver.hh:395
const unsigned int slice
Size of a slice in a portfolio and scale factor for restarts(in number of failures) ...
Definition: search.hh:128
struct Gecode::@593::NNF::@62::@64 a
For atomic nodes.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:199
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Definition: driver.hh:388
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
Definition: driver.hh:392
virtual void help(void)
Print help text.
Definition: options.cpp:685
virtual void help(void)
Print help text.
Definition: options.cpp:486