Generated on Thu Jan 20 2022 00:00:00 for Gecode by doxygen 1.9.1
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("post",a,e)) { cur |= TE_POST; }
375  else if (!strncmp("none",a,e) ||
376  !strncmp("false",a,e) ||
377  !strncmp("0",a,e)) { cur = 0; }
378  else if (!strncmp("all",a,e) ||
379  !strncmp("1",a,e)) { cur = (TE_INIT |
380  TE_PRUNE |
381  TE_FIX |
382  TE_FAIL |
383  TE_DONE |
384  TE_PROPAGATE |
385  TE_COMMIT |
386  TE_POST); }
387  else if (!strncmp("variable",a,e)) { cur = (TE_INIT |
388  TE_PRUNE |
389  TE_FIX |
390  TE_FAIL |
391  TE_DONE); }
392  else if (!strncmp("general",a,e)) { cur = (TE_PROPAGATE |
393  TE_COMMIT |
394  TE_POST); }
395  else {
396  std::cerr << "Wrong argument \"" << a
397  << "\" for option \"" << iopt << "\""
398  << std::endl;
399  exit(EXIT_FAILURE);
400  }
401 
402  if (*c == ',') a = c+1; else a = c;
403 
404  } while (*a != 0);
405 
406  return 2;
407  }
408  return 0;
409  }
410 
411  void
413  using namespace std;
414  cerr << '\t' << iopt
415  << " (init,prune,fix,fail,done,propagate,commit,post,none,all,variable,general)"
416  << " default: ";
417  if (cur == 0) {
418  cerr << "none";
419  } else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE |
421  cerr << "all";
422  } else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE)) {
423  cerr << "variable";
424  } else if (cur == (TE_PROPAGATE | TE_COMMIT | TE_POST)) {
425  cerr << "general";
426  } else {
427  int f = cur;
428  if ((f & TE_INIT) != 0) {
429  cerr << "init";
430  f -= TE_INIT;
431  if (f != 0) cerr << ',';
432  }
433  if ((f & TE_PRUNE) != 0) {
434  cerr << "prune";
435  f -= TE_PRUNE;
436  if (f != 0) cerr << ',';
437  }
438  if ((f & TE_FIX) != 0) {
439  cerr << "fix";
440  f -= TE_FIX;
441  if (f != 0) cerr << ',';
442  }
443  if ((f & TE_FAIL) != 0) {
444  cerr << "fail";
445  f -= TE_FAIL;
446  if (f != 0) cerr << ',';
447  }
448  if ((f & TE_DONE) != 0) {
449  cerr << "done";
450  f -= TE_DONE;
451  if (f != 0) cerr << ',';
452  }
453  if ((f & TE_PROPAGATE) != 0) {
454  cerr << "propagate";
455  f -= TE_PROPAGATE;
456  if (f != 0) cerr << ',';
457  }
458  if ((f & TE_COMMIT) != 0) {
459  cerr << "commit";
460  f -= TE_COMMIT;
461  if (f != 0) cerr << ',';
462  }
463  if ((f & TE_POST) != 0) {
464  cerr << "post";
465  }
466  }
467  cerr << endl << "\t\t" << exp << endl;
468  }
469 
470 
471  }
472 
473  void
475  o.next = NULL;
476  if (fst == NULL) {
477  fst=&o;
478  } else {
479  lst->next=&o;
480  }
481  lst=&o;
482  }
484  : fst(NULL), lst(NULL),
485  _name(Driver::BaseOption::strdup(n)) {}
486 
487  void
488  BaseOptions::name(const char* n) {
491  }
492 
493  void
495  std::cerr << "Gecode configuration information:" << std::endl
496  << " - Version: " << GECODE_VERSION << std::endl
497  << " - Variable types: ";
498 #ifdef GECODE_HAS_INT_VARS
499  std::cerr << "BoolVar IntVar ";
500 #endif
501 #ifdef GECODE_HAS_SET_VARS
502  std::cerr << "SetVar ";
503 #endif
504 #ifdef GECODE_HAS_FLOAT_VARS
505  std::cerr << "FloatVar "
506  << std::endl
507  << " - Trigonometric and transcendental float constraints: ";
508 #ifdef GECODE_HAS_MPFR
509  std::cerr << "enabled";
510 #else
511  std::cerr << "disabled";
512 #endif
513 #endif
514  std::cerr << std::endl;
515  std::cerr << " - Thread support: ";
516 #ifdef GECODE_HAS_THREADS
517  if (Support::Thread::npu() == 1)
518  std::cerr << "enabled (1 processing unit)";
519  else
520  std::cerr << "enabled (" << Support::Thread::npu()
521  << " processing units)";
522 #else
523  std::cerr << "disabled";
524 #endif
525  std::cerr << std::endl
526  << " - Gist support: ";
527 #ifdef GECODE_HAS_GIST
528  std::cerr << "enabled";
529 #else
530  std::cerr << "disabled";
531 #endif
532  std::cerr << std::endl
533  << " - CPProfiler support: ";
534 #ifdef GECODE_HAS_CPPROFILER
535  std::cerr << "enabled";
536 #else
537  std::cerr << "disabled";
538 #endif
539  std::cerr << std::endl << std::endl
540  << "Options for " << name() << ":" << std::endl
541  << "\t-help, --help, -?" << std::endl
542  << "\t\tprint this help message" << std::endl;
543  for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
544  o->help();
545  }
546 
547  void
548  BaseOptions::parse(int& argc, char* argv[]) {
549  int c = argc;
550  char** v = argv;
551  next:
552  for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
553  if (int a = o->parse(c,v)) {
554  c -= a; v += a;
555  goto next;
556  }
557  if (c >= 2) {
558  if (!strcmp(v[1],"-help") || !strcmp(v[1],"--help") ||
559  !strcmp(v[1],"-?")) {
560  help();
561  exit(EXIT_SUCCESS);
562  }
563  }
564  // Copy remaining arguments
565  argc = c;
566  for (int i=1; i<argc; i++)
567  argv[i] = v[i];
568  return;
569  }
570 
573  }
574 
575 
576  Options::Options(const char* n)
577  : BaseOptions(n),
578 
579  _model("model","model variants"),
580  _symmetry("symmetry","symmetry variants"),
581  _propagation("propagation","propagation variants"),
582  _branching("branching","branching variants"),
583  _decay("decay","decay factor",1.0),
584  _seed("seed","random number generator seed",1U),
585  _step("step","step distance for float optimization",0.0),
586 
587  _search("search","search engine variants"),
588  _solutions("solutions","number of solutions (0 = all)",1),
589  _threads("threads","number of threads (0 = #processing units)",
590  Search::Config::threads),
591  _c_d("c-d","recomputation commit distance",Search::Config::c_d),
592  _a_d("a-d","recomputation adaptation distance",Search::Config::a_d),
593  _d_l("d-l","discrepancy limit for LDS",Search::Config::d_l),
594  _node("node","node cutoff (0 = none, solution mode)"),
595  _fail("fail","failure cutoff (0 = none, solution mode)"),
596  _time("time","time (in ms) cutoff (0 = none, solution mode)"),
597  _assets("assets","#portfolio assets (#engines)",0),
598  _slice("slice","portfolio slice (in #failures)",Search::Config::slice),
599  _restart("restart","restart sequence type",RM_NONE),
600  _r_base("restart-base","base for geometric restart sequence",
601  Search::Config::base),
602  _r_scale("restart-scale","scale factor for restart sequence",
603  Search::Config::slice),
604  _nogoods("nogoods","whether to use no-goods from restarts",false),
605  _nogoods_limit("nogoods-limit","depth limit for no-good extraction",
606  Search::Config::nogoods_limit),
607  _relax("relax","probability for relaxing variable", 0.0),
608  _interrupt("interrupt","whether to catch Ctrl-C (true) or not (false)",
609  true),
610 
611  _mode("mode","how to execute script",SM_SOLUTION),
612  _samples("samples","how many samples (time mode)",1),
613  _iterations("iterations","iterations per sample (time mode)",1),
614  _print_last("print-last",
615  "whether to only print the last solution (solution mode)",
616  false),
617  _out_file("file-sol", "where to print solutions "
618  "(supports stdout, stdlog, stderr)","stdout"),
619  _log_file("file-stat", "where to print statistics "
620  "(supports stdout, stdlog, stderr)","stdout"),
621  _trace(0)
622 
623 #ifdef GECODE_HAS_CPPROFILER
624  ,
625  _profiler_id("cpprofiler-id", "use this execution id with CP-profiler", 0),
626  _profiler_port("cpprofiler-port", "connect to CP-profiler on this port",
627  Search::Config::cpprofiler_port),
628  _profiler_info("cpprofiler-info", "send solution information to CP-profiler", false)
629 #endif
630  {
631 
632  _mode.add(SM_SOLUTION, "solution");
633  _mode.add(SM_TIME, "time");
634  _mode.add(SM_STAT, "stat");
635  _mode.add(SM_GIST, "gist");
636  _mode.add(SM_CPPROFILER, "cpprofiler");
637 
638  _restart.add(RM_NONE,"none");
639  _restart.add(RM_CONSTANT,"constant");
640  _restart.add(RM_LINEAR,"linear");
641  _restart.add(RM_LUBY,"luby");
642  _restart.add(RM_GEOMETRIC,"geometric");
643 
647  add(_d_l);
649  add(_assets); add(_slice);
652  add(_relax);
655 #ifdef GECODE_HAS_CPPROFILER
656  add(_profiler_id);
659 #endif
660  }
661 
662 
664  : Options(e), _size(0) {}
665 
666  void
668  Options::help();
669  std::cerr << "\t(unsigned int) default: " << size() << std::endl
670  << "\t\twhich version/size for script" << std::endl;
671  }
672 
673  void
674  SizeOptions::parse(int& argc, char* argv[]) {
675  Options::parse(argc,argv);
676  if (argc < 2)
677  return;
678  size(static_cast<unsigned int>(atoi(argv[1])));
679  }
680 
681 
682 
684  : Options(e), _inst(NULL) {}
685 
686  void
687  InstanceOptions::instance(const char* s) {
690  }
691 
692  void
694  Options::help();
695  std::cerr << "\t(string) default: " << instance() << std::endl
696  << "\t\twhich instance for script" << std::endl;
697  }
698 
699  void
700  InstanceOptions::parse(int& argc, char* argv[]) {
701  Options::parse(argc,argv);
702  if (argc < 2)
703  return;
704  instance(argv[1]);
705  }
706 
709  }
710 
711 }
712 
713 // STATISTICS: driver-any
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Base class for script options.
Definition: driver.hh:331
BaseOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:483
void add(Driver::BaseOption &o)
Add new option o.
Definition: options.cpp:474
const char * _name
Script name.
Definition: driver.hh:335
virtual ~BaseOptions(void)
Destructor.
Definition: options.cpp:571
Driver::BaseOption * fst
First registered option.
Definition: driver.hh:333
const char * name(void) const
Return name of script.
Definition: options.hpp:166
virtual void help(void)
Print help text.
Definition: options.cpp:494
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:548
Base class for options.
Definition: driver.hh:121
static void strdel(const char *s)
Delete heap-allocated copy of string s.
Definition: options.cpp:71
static char * stredup(const char *s)
Create heap-allocated copy of string s with hyphen added.
Definition: options.cpp:61
const char * eopt
String for option (excluding hyphen)
Definition: driver.hh:124
virtual ~BaseOption(void)
Destructor.
Definition: options.cpp:102
char * argument(int argc, char *argv[]) const
Definition: options.cpp:78
static char * strdup(const char *s)
Create heap-allocated copy of string s.
Definition: options.cpp:52
const char * exp
Short explanation.
Definition: driver.hh:126
const char * iopt
String for option (including hyphen)
Definition: driver.hh:125
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
Definition: options.cpp:99
BaseOption * next
Next option Check for option and return its argument.
Definition: driver.hh:127
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:249
virtual void help(void)
Print help text.
Definition: options.cpp:281
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:232
double cur
Current value.
Definition: driver.hh:251
virtual void help(void)
Print help text.
Definition: options.cpp:241
virtual void help(void)
Print help text.
Definition: options.cpp:208
int cur
Current value.
Definition: driver.hh:211
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:199
IntPropLevel cur
Current value.
Definition: driver.hh:291
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:297
IplOption(IntPropLevel ipl=IPL_DEF)
Initialize with default value ipl.
Definition: options.cpp:292
virtual void help(void)
Print help text.
Definition: options.cpp:331
Value * next
Next option value.
Definition: driver.hh:182
virtual ~StringOption(void)
Destructor.
Definition: options.cpp:186
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:152
int cur
Current value.
Definition: driver.hh:184
virtual void help(void)
Print help text.
Definition: options.cpp:167
Value * lst
Last option value.
Definition: driver.hh:186
Value * fst
First option value.
Definition: driver.hh:185
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
virtual void help(void)
Print help text.
Definition: options.cpp:126
virtual ~StringValueOption(void)
Destructor.
Definition: options.cpp:131
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
const char * value(void) const
Return current option value.
Definition: options.hpp:46
const char * cur
Current value.
Definition: driver.hh:153
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:118
virtual void help(void)
Print help text.
Definition: options.cpp:412
int cur
Current value.
Definition: driver.hh:311
TraceOption(int f=0)
Initialize with no tracing.
Definition: options.cpp:353
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:358
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:215
unsigned int cur
Current value.
Definition: driver.hh:231
virtual void help(void)
Print help text.
Definition: options.cpp:224
T * alloc(long unsigned int n)
Allocate block of n objects of type T from heap.
Definition: heap.hpp:431
void rfree(void *p)
Free memory block starting at p.
Definition: heap.hpp:371
const char * _inst
Instance string.
Definition: driver.hh:698
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:700
virtual void help(void)
Print help text.
Definition: options.cpp:693
const char * instance(void) const
Return instance name.
Definition: options.hpp:599
~InstanceOptions(void)
Destructor.
Definition: options.cpp:707
InstanceOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:683
Options for scripts
Definition: driver.hh:366
Driver::DoubleOption _relax
Probability to relax variable.
Definition: driver.hh:398
Driver::StringValueOption _log_file
Where to print statistics.
Definition: driver.hh:409
Driver::StringOption _model
General model options.
Definition: driver.hh:370
Driver::StringOption _mode
Script mode to run.
Definition: driver.hh:404
Driver::DoubleOption _decay
Decay option.
Definition: driver.hh:375
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
Definition: driver.hh:397
Driver::BoolOption _nogoods
Whether to use no-goods.
Definition: driver.hh:396
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
Definition: driver.hh:392
Driver::TraceOption _trace
Trace flags for tracing.
Definition: driver.hh:410
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Definition: driver.hh:387
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
Definition: driver.hh:391
Driver::UnsignedIntOption _solutions
How many solutions.
Definition: driver.hh:383
Driver::UnsignedIntOption _iterations
How many iterations per sample.
Definition: driver.hh:406
Driver::StringOption _search
Search options.
Definition: driver.hh:382
Driver::StringOption _propagation
Propagation options.
Definition: driver.hh:372
Driver::IplOption _ipl
Integer propagation level.
Definition: driver.hh:373
Options(const char *s)
Initialize options for script with name s.
Definition: options.cpp:576
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
Definition: driver.hh:415
Driver::BoolOption _print_last
Print only last solution found.
Definition: driver.hh:407
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Definition: driver.hh:385
Driver::DoubleOption _threads
How many threads to use.
Definition: driver.hh:384
Driver::StringOption _branching
Branching options.
Definition: driver.hh:374
Driver::StringOption _restart
Restart method option.
Definition: driver.hh:393
Driver::UnsignedIntOption _seed
Seed option.
Definition: driver.hh:376
Driver::UnsignedIntOption _time
Cutoff for time.
Definition: driver.hh:390
Driver::DoubleOption _step
Step option.
Definition: driver.hh:377
Driver::UnsignedIntOption _profiler_port
Connect to this port.
Definition: driver.hh:414
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Definition: driver.hh:395
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Definition: driver.hh:413
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Definition: driver.hh:399
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Definition: driver.hh:386
Driver::DoubleOption _r_base
Restart base.
Definition: driver.hh:394
Driver::StringOption _symmetry
General symmetry options.
Definition: driver.hh:371
Driver::StringValueOption _out_file
Where to print solutions.
Definition: driver.hh:408
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Definition: driver.hh:388
Driver::UnsignedIntOption _samples
How many samples.
Definition: driver.hh:405
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Definition: driver.hh:389
unsigned int size(void) const
Return size.
Definition: options.hpp:590
virtual void help(void)
Print help text.
Definition: options.cpp:667
SizeOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:663
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:674
static unsigned int npu(void)
Return number of processing units (1 if information not available)
Definition: none.hpp:76
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Heap heap
The single global heap.
Definition: heap.cpp:44
@ SM_STAT
Print statistics for script.
Definition: driver.hh:97
@ SM_SOLUTION
Print solution and some statistics.
Definition: driver.hh:95
@ SM_GIST
Run script in Gist.
Definition: driver.hh:98
@ SM_CPPROFILER
Run script with CP-profiler.
Definition: driver.hh:99
@ SM_TIME
Measure average runtime.
Definition: driver.hh:96
@ RM_CONSTANT
Restart with constant sequence.
Definition: driver.hh:108
@ RM_LINEAR
Restart with linear sequence.
Definition: driver.hh:109
@ RM_LUBY
Restart with Luby sequence.
Definition: driver.hh:110
@ RM_NONE
No restarts.
Definition: driver.hh:107
@ RM_GEOMETRIC
Restart with geometric sequence.
Definition: driver.hh:111
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:974
@ IPL_BASIC
Use basic propagation algorithm.
Definition: int.hh:981
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Definition: int.hh:979
@ IPL_VAL
Value propagation.
Definition: int.hh:977
@ IPL_ADVANCED
Use advanced propagation algorithm.
Definition: int.hh:982
@ IPL_DEF
Simple propagation levels.
Definition: int.hh:976
@ IPL_BND
Bounds propagation.
Definition: int.hh:978
@ TE_INIT
Trace init events.
Definition: recorder.hpp:43
@ TE_POST
Trace propagator posting.
Definition: recorder.hpp:52
@ TE_COMMIT
Trace commit operations by branchers.
Definition: recorder.hpp:51
@ TE_PRUNE
Trace prune events.
Definition: recorder.hpp:44
@ TE_PROPAGATE
Trace propagator executions.
Definition: recorder.hpp:50
@ TE_FIX
Trace fixpoint events.
Definition: recorder.hpp:45
@ TE_FAIL
Trace fail events.
Definition: recorder.hpp:46
@ TE_DONE
Trace done events.
Definition: recorder.hpp:47
IntPropLevel vbd(IntPropLevel ipl)
Extract value, bounds, or domain propagation from propagation level.
Definition: ipl.hpp:37
const unsigned int d_l
Default discrepancy limit for LDS.
Definition: search.hh:123
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
Definition: search.hh:115
const double base
Base for geometric restart sequence.
Definition: search.hh:126
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
Definition: search.hh:113
const unsigned int slice
Size of a slice in a portfolio and scale factor for restarts(in number of failures)
Definition: search.hh:128
const unsigned int cpprofiler_port
Default port for CPProfiler.
Definition: search.hh:134
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Definition: search.hh:131
const double threads
Number of threads to use.
Definition: search.hh:110
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i({1, 2, 3, 4})
Gecode::IntSet d(v, 7)
const int v[7]
Definition: distinct.cpp:259
Definition: flatzinc.cpp:52
#define GECODE_VERSION
Definition: config.hpp:107
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56