59 char*
d =
heap.
alloc<
char>(
static_cast<unsigned long int>(strlen(s)+1));
73 if ((argc < 2) || strcmp(argv[1],
opt))
76 std::cerr <<
"Missing argument for option \"" <<
opt <<
"\"" 84 :
opt(strdup(o)),
exp(strdup(e)) {}
110 std::cerr <<
'\t' <<
opt <<
" (string) default: " 111 << ((
cur == NULL) ?
"NONE" :
cur) << std::endl
112 <<
"\t\t" <<
exp << std::endl;
138 if (!strcmp(
a,
v->opt)) {
142 std::cerr <<
"Wrong argument \"" <<
a 143 <<
"\" for option \"" <<
opt <<
"\"" 153 std::cerr <<
'\t' <<
opt <<
" (";
154 const char*
d = NULL;
156 std::cerr <<
v->opt << ((
v->next != NULL) ?
", " :
"");
162 std::cerr <<
" default: " <<
d;
163 std::cerr << std::endl <<
"\t\t" <<
exp << std::endl;
166 std::cerr <<
"\t\t " <<
v->opt <<
": " <<
v->help << std::endl;
192 std::cerr <<
'\t' <<
opt <<
" (int) default: " <<
cur << std::endl
193 <<
"\t\t" <<
exp << std::endl;
200 cur =
static_cast<unsigned int>(atoi(
a));
208 std::cerr <<
'\t' <<
opt <<
" (unsigned int) default: " 210 <<
"\t\t" <<
exp << std::endl;
226 cerr <<
'\t' <<
opt <<
" (double) default: " <<
cur << endl
227 <<
"\t\t" <<
exp << endl;
233 if ((argc < 2) || strcmp(argv[1],
opt))
239 }
else if (!strcmp(argv[2],
"true") || !strcmp(argv[2],
"1")) {
242 }
else if (!strcmp(argv[2],
"false") || !strcmp(argv[2],
"0")) {
256 cerr <<
'\t' <<
opt <<
" (optional: false, 0, true, 1) default: " 257 << (
cur ?
"true" :
"false") << endl
258 <<
"\t\t" <<
exp << endl;
266 :
BaseOption(
"-ipl",
"integer propagation level (comma-separated list)"),
277 while ((*
c !=
',') && (*
c != 0))
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; }
289 std::cerr <<
"Wrong argument \"" <<
a 290 <<
"\" for option \"" <<
opt <<
"\"" 295 if (*
c ==
',')
a =
c+1;
else a =
c;
309 <<
" (def,val,bnd,dom,speed,memory,basic,advanced)" << endl
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;
322 cerr << endl <<
"\t\t" <<
exp << endl;
331 :
BaseOption(
"-trace",
"trace flags (comma-separated list)"),
341 while ((*
c !=
',') && (*
c != 0))
343 unsigned int e =
static_cast<unsigned int>(
c-
a);
346 else if (!strncmp(
"fix",
a,e)) {
cur |=
TE_FIX; }
348 else if (!strncmp(
"done",
a,e)) {
cur |=
TE_DONE ; }
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) ||
362 else if (!strncmp(
"variable",
a,e)) {
cur = (
TE_INIT |
370 std::cerr <<
"Wrong argument \"" <<
a 371 <<
"\" for option \"" <<
opt <<
"\"" 376 if (*
c ==
',')
a =
c+1;
else a =
c;
389 <<
" (init,prune,fix,fail,done,propagate,commit,none,all,variable,general)" 405 if (
f != 0) cerr <<
',';
410 if (
f != 0) cerr <<
',';
415 if (
f != 0) cerr <<
',';
420 if (
f != 0) cerr <<
',';
425 if (
f != 0) cerr <<
',';
430 if (
f != 0) cerr <<
',';
436 cerr << endl <<
"\t\t" <<
exp << endl;
453 : fst(NULL), lst(NULL),
454 _name(Driver::BaseOption::strdup(
n)) {}
464 std::cerr <<
"Gecode configuration information:" << std::endl
466 <<
" - Variable types: ";
467 #ifdef GECODE_HAS_INT_VARS 468 std::cerr <<
"BoolVar IntVar ";
470 #ifdef GECODE_HAS_SET_VARS 471 std::cerr <<
"SetVar ";
473 #ifdef GECODE_HAS_FLOAT_VARS 474 std::cerr <<
"FloatVar " 476 <<
" - Trigonometric and transcendental float constraints: ";
477 #ifdef GECODE_HAS_MPFR 478 std::cerr <<
"enabled";
480 std::cerr <<
"disabled";
483 std::cerr << std::endl;
484 std::cerr <<
" - Thread support: ";
485 #ifdef GECODE_HAS_THREADS 487 std::cerr <<
"enabled (1 processing unit)";
490 <<
" processing units)";
492 std::cerr <<
"disabled";
494 std::cerr << std::endl
495 <<
" - Gist support: ";
496 #ifdef GECODE_HAS_GIST 497 std::cerr <<
"enabled";
499 std::cerr <<
"disabled";
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;
515 if (
int a = o->parse(
c,
v)) {
520 if (!strcmp(
v[1],
"-help") || !strcmp(
v[1],
"--help") ||
521 !strcmp(
v[1],
"-?")) {
528 for (
int i=1;
i<argc;
i++)
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),
549 _search(
"-search",
"search engine variants"),
550 _solutions(
"-solutions",
"number of solutions (0 = all)",1),
551 _threads(
"-threads",
"number of threads (0 = #processing units)",
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",
569 _relax(
"-relax",
"probability for relaxing variable", 0.0),
570 _interrupt(
"-interrupt",
"whether to catch Ctrl-C (true) or not (false)",
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)",
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"),
617 std::cerr <<
"\t(unsigned int) default: " <<
size() << std::endl
618 <<
"\t\twhich version/size for script" << std::endl;
626 size(static_cast<unsigned int>(atoi(argv[1])));
643 std::cerr <<
"\t(string) default: " <<
instance() << std::endl
644 <<
"\t\twhich instance for script" << std::endl;
virtual void help(void)
Print help text.
char * argument(int argc, char *argv[]) const
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Restart with linear sequence.
Driver::BoolOption _interrupt
Whether to catch SIGINT.
virtual ~StringValueOption(void)
Destructor.
IntPropLevel vbd(IntPropLevel ipl)
Extract value, bounds, or domain propagation from propagation level.
Options(const char *s)
Initialize options for script with name s.
Driver::UnsignedIntOption _iterations
How many iterations per sample.
StringValueOption(const char *o, const char *e, const char *v=NULL)
Initialize for option o and explanation e and default value v.
static unsigned int npu(void)
Return number of processing units (1 if information not available)
Driver::DoubleOption _decay
Decay option.
unsigned int cur
Current value.
virtual void help(void)
Print help text.
Driver::DoubleOption _step
Step option.
virtual void help(void)
Print help text.
virtual void help(void)
Print help text.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
const char * exp
Short explanation.
void rfree(void *p)
Free memory block starting at p.
Value * next
Next option value.
virtual void help(void)
Print help text.
Driver::DoubleOption _threads
How many threads to use.
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Driver::StringOption _restart
Restart method option.
Driver::BoolOption _nogoods
Whether to use no-goods.
void add(int v, const char *o, const char *h=NULL)
Add option value for value v, string o, and help text h.
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Value * lst
Last option value.
Restart with Luby sequence.
const char * instance(void) const
Return instance name.
static void strdel(const char *s)
Delete heap-allocated copy of string s.
Driver::DoubleOption _r_base
Restart base.
void add(Driver::BaseOption &o)
Add new option o.
Trace commit operations by branchers.
Driver::StringOption _model
General model options.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
T * alloc(long unsigned int n)
Allocate block of n objects of type T from heap.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
TraceOption(int f=0)
Initialize with no tracing.
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Print solution and some statistics.
Driver::UnsignedIntOption _samples
How many samples.
Driver::StringValueOption _log_file
Where to print statistics.
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Simple propagation levels.
Value * fst
First option value.
virtual ~BaseOption(void)
Destructor.
Driver::StringOption _propagation
Propagation options.
Base class for script options.
IplOption(IntPropLevel ipl=IPL_DEF)
Initialize with default value ipl.
const char * _name
Script name.
Use basic propagation algorithm.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
const char * name(void) const
Return name of script.
Driver::StringOption _search
Search options.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Driver::BoolOption _print_last
Print only last solution found.
BaseOption * next
Next option Check for option and return its argument.
const unsigned int d_l
Default discrepancy limit for LDS.
Driver::StringOption _symmetry
General symmetry options.
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Use advanced propagation algorithm.
Driver::UnsignedIntOption _time
Cutoff for time.
Driver::StringOption _mode
Script mode to run.
const double threads
Number of threads to use.
Driver::DoubleOption _relax
Probability to relax variable.
Prefer to save memory Options: basic versus advanced propagation.
const char * value(void) const
Return current option value.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
IntPropLevel
Propagation levels for integer propagators.
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
virtual ~StringOption(void)
Destructor.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
const double base
Base for geometric restart sequence.
Print statistics for script.
virtual void help(void)
Print help text.
Driver::TraceOption _trace
Trace flags for tracing.
Restart with geometric sequence.
const char * opt
String for option (including hyphen)
static char * strdup(const char *s)
Create heap-allocated copy of string s.
Driver::StringValueOption _out_file
Where to print solutions.
Driver::BaseOption * fst
First registered option.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Heap heap
The single global heap.
InstanceOptions(const char *s)
Initialize options for script with name s.
const char * _inst
Instance string.
Domain propagation Preferences: prefer speed or memory.
virtual void help(void)
Print help text.
Driver::UnsignedIntOption _solutions
How many solutions.
virtual void help(void)
Print help text.
Driver::StringOption _branching
Branching options.
IntPropLevel cur
Current value.
const char * cur
Current value.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
SizeOptions(const char *s)
Initialize options for script with name s.
Trace propagator executions.
~InstanceOptions(void)
Destructor.
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
virtual void help(void)
Print help text.
Driver::IplOption _ipl
Integer propagation level.
Gecode toplevel namespace
Driver::UnsignedIntOption _seed
Seed option.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
virtual ~BaseOptions(void)
Destructor.
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
BaseOptions(const char *s)
Initialize options for script with name s.
#define GECODE_NEVER
Assert that this command is never executed.
unsigned int size(void) const
Return size.
Restart with constant sequence.
Driver::UnsignedIntOption _r_scale
Restart scale factor.
const unsigned int slice
Size of a slice in a portfolio and scale factor for restarts(in number of failures) ...
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
virtual void help(void)
Print help text.
virtual void help(void)
Print help text.