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