Generated on Tue Jul 18 2017 18:41:42 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: 2017-03-17 23:04:57 +0100 (Fri, 17 Mar 2017) $ by $Author: schulte $
11  * $Revision: 15597 $
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  void
65  BaseOption::strdel(const char* s) {
66  if (s == NULL)
67  return;
68  heap.rfree(const_cast<char*>(s));
69  }
70 
71  char*
72  BaseOption::argument(int argc, char* argv[]) const {
73  if ((argc < 2) || strcmp(argv[1],opt))
74  return NULL;
75  if (argc == 2) {
76  std::cerr << "Missing argument for option \"" << opt << "\""
77  << std::endl;
78  exit(EXIT_FAILURE);
79  }
80  return argv[2];
81  }
82 
83  BaseOption::BaseOption(const char* o, const char* e)
84  : opt(strdup(o)), exp(strdup(e)) {}
85 
87  strdel(opt);
88  strdel(exp);
89  }
90 
91 
92  StringValueOption::StringValueOption(const char* o, const char* e,
93  const char* v)
94  : BaseOption(o,e), cur(strdup(v)) {}
95  void
96  StringValueOption::value(const char* v) {
97  strdel(cur);
98  cur = strdup(v);
99  }
100  int
101  StringValueOption::parse(int argc, char* argv[]) {
102  if (char* a = argument(argc,argv)) {
103  cur = strdup(a);
104  return 2;
105  }
106  return 0;
107  }
108  void
110  std::cerr << '\t' << opt << " (string) default: "
111  << ((cur == NULL) ? "NONE" : cur) << std::endl
112  << "\t\t" << exp << std::endl;
113  }
115  strdel(cur);
116  }
117 
118 
119 
120  void
121  StringOption::add(int v, const char* o, const char* h) {
122  Value* n = new Value;
123  n->val = v;
124  n->opt = strdup(o);
125  n->help = strdup(h);
126  n->next = NULL;
127  if (fst == NULL) {
128  fst = n;
129  } else {
130  lst->next = n;
131  }
132  lst = n;
133  }
134  int
135  StringOption::parse(int argc, char* argv[]) {
136  if (char* a = argument(argc,argv)) {
137  for (Value* v = fst; v != NULL; v = v->next)
138  if (!strcmp(a,v->opt)) {
139  cur = v->val;
140  return 2;
141  }
142  std::cerr << "Wrong argument \"" << a
143  << "\" for option \"" << opt << "\""
144  << std::endl;
145  exit(EXIT_FAILURE);
146  }
147  return 0;
148  }
149  void
151  if (fst == NULL)
152  return;
153  std::cerr << '\t' << opt << " (";
154  const char* d = NULL;
155  for (Value* v = fst; v != NULL; v = v->next) {
156  std::cerr << v->opt << ((v->next != NULL) ? ", " : "");
157  if (v->val == cur)
158  d = v->opt;
159  }
160  std::cerr << ")";
161  if (d != NULL)
162  std::cerr << " default: " << d;
163  std::cerr << std::endl << "\t\t" << exp << std::endl;
164  for (Value* v = fst; v != NULL; v = v->next)
165  if (v->help != NULL)
166  std::cerr << "\t\t " << v->opt << ": " << v->help << std::endl;
167  }
168 
170  Value* v = fst;
171  while (v != NULL) {
172  strdel(v->opt);
173  strdel(v->help);
174  Value* n = v->next;
175  delete v;
176  v = n;
177  }
178  }
179 
180 
181  int
182  IntOption::parse(int argc, char* argv[]) {
183  if (char* a = argument(argc,argv)) {
184  cur = atoi(a);
185  return 2;
186  }
187  return 0;
188  }
189 
190  void
192  std::cerr << '\t' << opt << " (int) default: " << cur << std::endl
193  << "\t\t" << exp << std::endl;
194  }
195 
196 
197  int
198  UnsignedIntOption::parse(int argc, char* argv[]) {
199  if (char* a = argument(argc,argv)) {
200  cur = static_cast<unsigned int>(atoi(a));
201  return 2;
202  }
203  return 0;
204  }
205 
206  void
208  std::cerr << '\t' << opt << " (unsigned int) default: "
209  << cur << std::endl
210  << "\t\t" << exp << std::endl;
211  }
212 
213 
214  int
215  DoubleOption::parse(int argc, char* argv[]) {
216  if (char* a = argument(argc,argv)) {
217  cur = atof(a);
218  return 2;
219  }
220  return 0;
221  }
222 
223  void
225  using namespace std;
226  cerr << '\t' << opt << " (double) default: " << cur << endl
227  << "\t\t" << exp << endl;
228  }
229 
230 
231  int
232  BoolOption::parse(int argc, char* argv[]) {
233  if ((argc < 2) || strcmp(argv[1],opt))
234  return 0;
235  if (argc == 2) {
236  // Option without argument
237  cur = true;
238  return 1;
239  } else if (!strcmp(argv[2],"true") || !strcmp(argv[2],"1")) {
240  cur = true;
241  return 2;
242  } else if (!strcmp(argv[2],"false") || !strcmp(argv[2],"0")) {
243  cur = false;
244  return 2;
245  } else {
246  // Option without argument
247  cur = true;
248  return 1;
249  }
250  return 0;
251  }
252 
253  void
255  using namespace std;
256  cerr << '\t' << opt << " (optional: false, 0, true, 1) default: "
257  << (cur ? "true" : "false") << endl
258  << "\t\t" << exp << endl;
259  }
260 
261  /*
262  * Integer propagation level option
263  *
264  */
266  : BaseOption("-ipl","integer propagation level (comma-separated list)"),
267  cur(ipl) {}
268 
269  int
270  IplOption::parse(int argc, char* argv[]) {
271  if (char* a = argument(argc,argv)) {
272  int b = IPL_DEF;
273  int m = IPL_DEF;
274  do {
275  // Search for a comma
276  char* c = a;
277  while ((*c != ',') && (*c != 0))
278  c++;
279  unsigned int e = static_cast<unsigned int>(c-a);
280  if (!strncmp("def",a,e)) { b = IPL_DEF; }
281  else if (!strncmp("val",a,e)) { b = IPL_VAL; }
282  else if (!strncmp("bnd",a,e)) { b = IPL_BND; }
283  else if (!strncmp("dom",a,e)) { b = IPL_DOM; }
284  else if (!strncmp("speed",a,e)) { m |= IPL_SPEED; }
285  else if (!strncmp("memory",a,e)) { m |= IPL_MEMORY; }
286  else if (!strncmp("basic",a,e)) { m |= IPL_BASIC; }
287  else if (!strncmp("advanced",a,e)) { m |= IPL_ADVANCED; }
288  else {
289  std::cerr << "Wrong argument \"" << a
290  << "\" for option \"" << opt << "\""
291  << std::endl;
292  exit(EXIT_FAILURE);
293  }
294 
295  if (*c == ',') a = c+1; else a = c;
296 
297  } while (*a != 0);
298 
299  cur = static_cast<IntPropLevel>(b | m);
300  return 2;
301  }
302  return 0;
303  }
304 
305  void
307  using namespace std;
308  cerr << '\t' << opt
309  << " (def,val,bnd,dom,speed,memory,basic,advanced)" << endl
310  << "\t\tdefault: ";
311  switch (vbd(cur)) {
312  case IPL_DEF: cerr << "def"; break;
313  case IPL_VAL: cerr << "val"; break;
314  case IPL_BND: cerr << "bnd"; break;
315  case IPL_DOM: cerr << "dom"; break;
316  default: GECODE_NEVER;
317  }
318  if (cur & IPL_SPEED) cerr << ",speed";
319  if (cur & IPL_MEMORY) cerr << ",memory";
320  if (cur & IPL_BASIC) cerr << ",basic";
321  if (cur & IPL_ADVANCED) cerr << ",advanced";
322  cerr << endl << "\t\t" << exp << endl;
323  }
324 
325 
326  /*
327  * Trace flag option
328  *
329  */
331  : BaseOption("-trace","trace flags (comma-separated list)"),
332  cur(f) {}
333 
334  int
335  TraceOption::parse(int argc, char* argv[]) {
336  if (char* a = argument(argc,argv)) {
337  cur = 0;
338  do {
339  // Search for a comma
340  char* c = a;
341  while ((*c != ',') && (*c != 0))
342  c++;
343  unsigned int e = static_cast<unsigned int>(c-a);
344  if (!strncmp("init",a,e)) { cur |= TE_INIT; }
345  else if (!strncmp("prune",a,e)) { cur |= TE_PRUNE; }
346  else if (!strncmp("fix",a,e)) { cur |= TE_FIX; }
347  else if (!strncmp("fail",a,e)) { cur |= TE_FAIL; }
348  else if (!strncmp("done",a,e)) { cur |= TE_DONE ; }
349  else if (!strncmp("propagate",a,e)) { cur |= TE_PROPAGATE; }
350  else if (!strncmp("commit",a,e)) { cur |= TE_COMMIT; }
351  else if (!strncmp("none",a,e) ||
352  !strncmp("false",a,e) ||
353  !strncmp("0",a,e)) { cur = 0; }
354  else if (!strncmp("all",a,e) ||
355  !strncmp("1",a,e)) { cur = (TE_INIT |
356  TE_PRUNE |
357  TE_FIX |
358  TE_FAIL |
359  TE_DONE |
360  TE_PROPAGATE |
361  TE_COMMIT); }
362  else if (!strncmp("variable",a,e)) { cur = (TE_INIT |
363  TE_PRUNE |
364  TE_FIX |
365  TE_FAIL |
366  TE_DONE); }
367  else if (!strncmp("general",a,e)) { cur = (TE_PROPAGATE |
368  TE_COMMIT); }
369  else {
370  std::cerr << "Wrong argument \"" << a
371  << "\" for option \"" << opt << "\""
372  << std::endl;
373  exit(EXIT_FAILURE);
374  }
375 
376  if (*c == ',') a = c+1; else a = c;
377 
378  } while (*a != 0);
379 
380  return 2;
381  }
382  return 0;
383  }
384 
385  void
387  using namespace std;
388  cerr << '\t' << opt
389  << " (init,prune,fix,fail,done,propagate,commit,none,all,variable,general)"
390  << " default: ";
391  if (cur == 0) {
392  cerr << "none";
393  } else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE |
394  TE_PROPAGATE | TE_COMMIT)) {
395  cerr << "all";
396  } else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE)) {
397  cerr << "variable";
398  } else if (cur == (TE_PROPAGATE | TE_COMMIT)) {
399  cerr << "general";
400  } else {
401  int f = cur;
402  if ((f & TE_INIT) != 0) {
403  cerr << "init";
404  f -= TE_INIT;
405  if (f != 0) cerr << ',';
406  }
407  if ((f & TE_PRUNE) != 0) {
408  cerr << "prune";
409  f -= TE_PRUNE;
410  if (f != 0) cerr << ',';
411  }
412  if ((f & TE_FIX) != 0) {
413  cerr << "fix";
414  f -= TE_FIX;
415  if (f != 0) cerr << ',';
416  }
417  if ((f & TE_FAIL) != 0) {
418  cerr << "fail";
419  f -= TE_FAIL;
420  if (f != 0) cerr << ',';
421  }
422  if ((f & TE_DONE) != 0) {
423  cerr << "done";
424  f -= TE_DONE;
425  if (f != 0) cerr << ',';
426  }
427  if ((f & TE_PROPAGATE) != 0) {
428  cerr << "propagate";
429  f -= TE_PROPAGATE;
430  if (f != 0) cerr << ',';
431  }
432  if ((f & TE_COMMIT) != 0) {
433  cerr << "commit";
434  }
435  }
436  cerr << endl << "\t\t" << exp << endl;
437  }
438 
439 
440  }
441 
442  void
444  o.next = NULL;
445  if (fst == NULL) {
446  fst=&o;
447  } else {
448  lst->next=&o;
449  }
450  lst=&o;
451  }
453  : fst(NULL), lst(NULL),
454  _name(Driver::BaseOption::strdup(n)) {}
455 
456  void
457  BaseOptions::name(const char* n) {
460  }
461 
462  void
464  std::cerr << "Gecode configuration information:" << std::endl
465  << " - Version: " << GECODE_VERSION << std::endl
466  << " - Variable types: ";
467 #ifdef GECODE_HAS_INT_VARS
468  std::cerr << "BoolVar IntVar ";
469 #endif
470 #ifdef GECODE_HAS_SET_VARS
471  std::cerr << "SetVar ";
472 #endif
473 #ifdef GECODE_HAS_FLOAT_VARS
474  std::cerr << "FloatVar "
475  << std::endl
476  << " - Trigonometric and transcendental float constraints: ";
477 #ifdef GECODE_HAS_MPFR
478  std::cerr << "enabled";
479 #else
480  std::cerr << "disabled";
481 #endif
482 #endif
483  std::cerr << std::endl;
484  std::cerr << " - Thread support: ";
485 #ifdef GECODE_HAS_THREADS
486  if (Support::Thread::npu() == 1)
487  std::cerr << "enabled (1 processing unit)";
488  else
489  std::cerr << "enabled (" << Support::Thread::npu()
490  << " processing units)";
491 #else
492  std::cerr << "disabled";
493 #endif
494  std::cerr << std::endl
495  << " - Gist support: ";
496 #ifdef GECODE_HAS_GIST
497  std::cerr << "enabled";
498 #else
499  std::cerr << "disabled";
500 #endif
501  std::cerr << std::endl << std::endl
502  << "Options for " << name() << ":" << std::endl
503  << "\t-help, --help, -?" << std::endl
504  << "\t\tprint this help message" << std::endl;
505  for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
506  o->help();
507  }
508 
509  void
510  BaseOptions::parse(int& argc, char* argv[]) {
511  int c = argc;
512  char** v = argv;
513  next:
514  for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
515  if (int a = o->parse(c,v)) {
516  c -= a; v += a;
517  goto next;
518  }
519  if (c >= 2) {
520  if (!strcmp(v[1],"-help") || !strcmp(v[1],"--help") ||
521  !strcmp(v[1],"-?")) {
522  help();
523  exit(EXIT_SUCCESS);
524  }
525  }
526  // Copy remaining arguments
527  argc = c;
528  for (int i=1; i<argc; i++)
529  argv[i] = v[i];
530  return;
531  }
532 
535  }
536 
537 
538  Options::Options(const char* n)
539  : BaseOptions(n),
540 
541  _model("-model","model variants"),
542  _symmetry("-symmetry","symmetry variants"),
543  _propagation("-propagation","propagation variants"),
544  _branching("-branching","branching variants"),
545  _decay("-decay","decay factor",1.0),
546  _seed("-seed","random number generator seed",1U),
547  _step("-step","step distance for float optimization",0.0),
548 
549  _search("-search","search engine variants"),
550  _solutions("-solutions","number of solutions (0 = all)",1),
551  _threads("-threads","number of threads (0 = #processing units)",
552  Search::Config::threads),
553  _c_d("-c-d","recomputation commit distance",Search::Config::c_d),
554  _a_d("-a-d","recomputation adaptation distance",Search::Config::a_d),
555  _d_l("-d-l","discrepancy limit for LDS",Search::Config::d_l),
556  _node("-node","node cutoff (0 = none, solution mode)"),
557  _fail("-fail","failure cutoff (0 = none, solution mode)"),
558  _time("-time","time (in ms) cutoff (0 = none, solution mode)"),
559  _assets("-assets","#portfolio assets (#engines)",0),
560  _slice("-slice","portfolio slice (in #failures)",Search::Config::slice),
561  _restart("-restart","restart sequence type",RM_NONE),
562  _r_base("-restart-base","base for geometric restart sequence",
563  Search::Config::base),
564  _r_scale("-restart-scale","scale factor for restart sequence",
565  Search::Config::slice),
566  _nogoods("-nogoods","whether to use no-goods from restarts",false),
567  _nogoods_limit("-nogoods-limit","depth limit for no-good extraction",
568  Search::Config::nogoods_limit),
569  _relax("-relax","probability for relaxing variable", 0.0),
570  _interrupt("-interrupt","whether to catch Ctrl-C (true) or not (false)",
571  true),
572 
573  _mode("-mode","how to execute script",SM_SOLUTION),
574  _samples("-samples","how many samples (time mode)",1),
575  _iterations("-iterations","iterations per sample (time mode)",1),
576  _print_last("-print-last",
577  "whether to only print the last solution (solution mode)",
578  false),
579  _out_file("-file-sol", "where to print solutions "
580  "(supports stdout, stdlog, stderr)","stdout"),
581  _log_file("-file-stat", "where to print statistics "
582  "(supports stdout, stdlog, stderr)","stdout"),
583  _trace(0)
584  {
585 
586  _mode.add(SM_SOLUTION, "solution");
587  _mode.add(SM_TIME, "time");
588  _mode.add(SM_STAT, "stat");
589  _mode.add(SM_GIST, "gist");
590 
591  _restart.add(RM_NONE,"none");
592  _restart.add(RM_CONSTANT,"constant");
593  _restart.add(RM_LINEAR,"linear");
594  _restart.add(RM_LUBY,"luby");
595  _restart.add(RM_GEOMETRIC,"geometric");
596 
600  add(_d_l);
602  add(_assets); add(_slice);
605  add(_relax);
608  }
609 
610 
612  : Options(e), _size(0) {}
613 
614  void
616  Options::help();
617  std::cerr << "\t(unsigned int) default: " << size() << std::endl
618  << "\t\twhich version/size for script" << std::endl;
619  }
620 
621  void
622  SizeOptions::parse(int& argc, char* argv[]) {
623  Options::parse(argc,argv);
624  if (argc < 2)
625  return;
626  size(static_cast<unsigned int>(atoi(argv[1])));
627  }
628 
629 
630 
632  : Options(e), _inst(NULL) {}
633 
634  void
635  InstanceOptions::instance(const char* s) {
638  }
639 
640  void
642  Options::help();
643  std::cerr << "\t(string) default: " << instance() << std::endl
644  << "\t\twhich instance for script" << std::endl;
645  }
646 
647  void
648  InstanceOptions::parse(int& argc, char* argv[]) {
649  Options::parse(argc,argv);
650  if (argc < 2)
651  return;
652  instance(argv[1]);
653  }
654 
657  }
658 
659 }
660 
661 // STATISTICS: driver-any
virtual void help(void)
Print help text.
Definition: options.cpp:306
char * argument(int argc, char *argv[]) const
Definition: options.cpp:72
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Definition: driver.hh:385
Bounds propagation.
Definition: int.hh:959
Restart with linear sequence.
Definition: driver.hh:112
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Definition: driver.hh:399
virtual ~StringValueOption(void)
Destructor.
Definition: options.cpp:114
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:538
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:92
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:375
virtual void help(void)
Print help text.
Definition: options.cpp:615
Driver::DoubleOption _step
Step option.
Definition: driver.hh:377
virtual void help(void)
Print help text.
Definition: options.cpp:150
virtual void help(void)
Print help text.
Definition: options.cpp:386
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:198
const char * exp
Short explanation.
Definition: driver.hh:128
void rfree(void *p)
Free memory block starting at p.
Definition: heap.hpp:375
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:254
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:622
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:121
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Definition: driver.hh:387
Base class for options.
Definition: driver.hh:124
Restart with Luby sequence.
Definition: driver.hh:113
const char * instance(void) const
Return instance name.
Definition: options.hpp:570
static void strdel(const char *s)
Delete heap-allocated copy of string s.
Definition: options.cpp:65
No restarts.
Definition: driver.hh:110
Driver::DoubleOption _r_base
Restart base.
Definition: driver.hh:394
Trace init events.
void add(Driver::BaseOption &o)
Add new option o.
Definition: options.cpp:443
Trace commit operations by branchers.
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:270
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
Trace prune events.
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)
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:330
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Definition: driver.hh:389
Print solution and some statistics.
Definition: driver.hh:99
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
#define GECODE_VERSION
Definition: config.hpp:95
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:111
Simple propagation levels.
Definition: int.hh:957
virtual ~BaseOption(void)
Destructor.
Definition: options.cpp:86
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:265
const char * _name
Script name.
Definition: driver.hh:335
Use basic propagation algorithm.
Definition: int.hh:965
Measure average runtime.
Definition: driver.hh:100
Value propagation.
Definition: int.hh:958
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
const char * name(void) const
Return name of script.
Definition: options.hpp:170
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:335
Driver::BoolOption _print_last
Print only last solution found.
Definition: driver.hh:407
BaseOption * next
Next option Check for option and return its argument.
Definition: driver.hh:129
const unsigned int d_l
Default discrepancy limit for LDS.
Definition: search.hh:119
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:966
Prefer speed.
Definition: int.hh:962
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:106
int val
Value for an option value.
Definition: driver.hh:179
Driver::DoubleOption _relax
Probability to relax variable.
Definition: driver.hh:398
Prefer to save memory Options: basic versus advanced propagation.
Definition: int.hh:963
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:510
const int v[7]
Definition: distinct.cpp:263
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:955
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
virtual ~StringOption(void)
Destructor.
Definition: options.cpp:169
Trace done events.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:232
const double base
Base for geometric restart sequence.
Definition: search.hh:122
Print statistics for script.
Definition: driver.hh:101
virtual void help(void)
Print help text.
Definition: options.cpp:191
Driver::TraceOption _trace
Trace flags for tracing.
Definition: driver.hh:410
Restart with geometric sequence.
Definition: driver.hh:114
const char * opt
String for option (including hyphen)
Definition: driver.hh:127
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: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:215
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:135
Heap heap
The single global heap.
Definition: heap.cpp:48
InstanceOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:631
const char * _inst
Instance string.
Definition: driver.hh:672
Domain propagation Preferences: prefer speed or memory.
Definition: int.hh:960
virtual void help(void)
Print help text.
Definition: options.cpp:109
Driver::UnsignedIntOption _solutions
How many solutions.
Definition: driver.hh:383
virtual void help(void)
Print help text.
Definition: options.cpp:207
Driver::StringOption _branching
Branching options.
Definition: driver.hh:374
Run script in Gist.
Definition: driver.hh:102
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:109
Trace fail events.
SizeOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:611
Trace propagator executions.
Trace fixpoint events.
~InstanceOptions(void)
Destructor.
Definition: options.cpp:655
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
Definition: options.cpp:83
virtual void help(void)
Print help text.
Definition: options.cpp:224
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:101
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:648
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Definition: search.hh:127
virtual ~BaseOptions(void)
Destructor.
Definition: options.cpp:533
BaseOptions(const char *s)
Initialize options for script with name s.
Definition: options.cpp:452
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
unsigned int size(void) const
Return size.
Definition: options.hpp:561
Options for scripts
Definition: driver.hh:366
Restart with constant sequence.
Definition: driver.hh:111
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:124
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition: options.cpp:182
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:641
virtual void help(void)
Print help text.
Definition: options.cpp:463