59 char*
d =
heap.
alloc<
char>(
static_cast<unsigned long int>(strlen(s)+1));
68 char*
d =
heap.
alloc<
char>(
static_cast<unsigned long int>(strlen(s)+2));
85 const char* s = argv[1];
96 std::cerr <<
"Missing argument for option \"" <<
iopt <<
"\"" 131 std::cerr <<
'\t' <<
iopt <<
" (string) default: " 132 << ((
cur == NULL) ?
"NONE" : cur) << std::endl
133 <<
"\t\t" <<
exp << std::endl;
158 for (
Value*
v = fst;
v != NULL;
v =
v->next)
159 if (!strcmp(
a,
v->opt)) {
163 std::cerr <<
"Wrong argument \"" <<
a 164 <<
"\" for option \"" <<
iopt <<
"\"" 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) ?
", " :
"");
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)
187 std::cerr <<
"\t\t " <<
v->opt <<
": " <<
v->help << std::endl;
213 std::cerr <<
'\t' <<
iopt <<
" (int) default: " <<
cur << std::endl
214 <<
"\t\t" <<
exp << std::endl;
221 cur =
static_cast<unsigned int>(atoi(
a));
229 std::cerr <<
'\t' <<
iopt <<
" (unsigned int) default: " 231 <<
"\t\t" <<
exp << std::endl;
247 cerr <<
'\t' <<
iopt <<
" (double) default: " <<
cur << endl
248 <<
"\t\t" <<
exp << endl;
256 const char* s = argv[1];
270 }
else if (!strcmp(argv[2],
"true") || !strcmp(argv[2],
"1")) {
273 }
else if (!strcmp(argv[2],
"false") || !strcmp(argv[2],
"0")) {
287 cerr <<
'\t' <<
iopt <<
" (optional: false, 0, true, 1) default: " 288 << (
cur ?
"true" :
"false") << endl
289 <<
"\t\t" <<
exp << endl;
297 :
BaseOption(
"ipl",
"integer propagation level (comma-separated list)"),
308 while ((*c !=
',') && (*c != 0))
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; }
318 std::cerr <<
"Wrong argument \"" <<
a 319 <<
"\" for option \"" <<
iopt <<
"\"" 324 if (*c ==
',')
a = c+1;
else a =
c;
338 <<
" (def,val,bnd,dom,basic,advanced)" << endl
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;
349 cerr << endl <<
"\t\t" <<
exp << endl;
358 :
BaseOption(
"trace",
"trace flags (comma-separated list)"),
368 while ((*c !=
',') && (*c != 0))
370 unsigned int e =
static_cast<unsigned int>(c-
a);
373 else if (!strncmp(
"fix",
a,e)) {
cur |=
TE_FIX; }
375 else if (!strncmp(
"done",
a,e)) {
cur |=
TE_DONE ; }
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) ||
389 else if (!strncmp(
"variable",
a,e)) {
cur = (
TE_INIT |
397 std::cerr <<
"Wrong argument \"" <<
a 398 <<
"\" for option \"" <<
iopt <<
"\"" 403 if (*c ==
',')
a = c+1;
else a =
c;
416 <<
" (init,prune,fix,fail,done,propagate,commit,none,all,variable,general)" 432 if (f != 0) cerr <<
',';
437 if (f != 0) cerr <<
',';
442 if (f != 0) cerr <<
',';
447 if (f != 0) cerr <<
',';
452 if (f != 0) cerr <<
',';
457 if (f != 0) cerr <<
',';
463 cerr << endl <<
"\t\t" <<
exp << endl;
480 : fst(NULL), lst(NULL),
491 std::cerr <<
"Gecode configuration information:" << std::endl
493 <<
" - Variable types: ";
494 #ifdef GECODE_HAS_INT_VARS 495 std::cerr <<
"BoolVar IntVar ";
497 #ifdef GECODE_HAS_SET_VARS 498 std::cerr <<
"SetVar ";
500 #ifdef GECODE_HAS_FLOAT_VARS 501 std::cerr <<
"FloatVar " 503 <<
" - Trigonometric and transcendental float constraints: ";
504 #ifdef GECODE_HAS_MPFR 505 std::cerr <<
"enabled";
507 std::cerr <<
"disabled";
510 std::cerr << std::endl;
511 std::cerr <<
" - Thread support: ";
512 #ifdef GECODE_HAS_THREADS 514 std::cerr <<
"enabled (1 processing unit)";
517 <<
" processing units)";
519 std::cerr <<
"disabled";
521 std::cerr << std::endl
522 <<
" - Gist support: ";
523 #ifdef GECODE_HAS_GIST 524 std::cerr <<
"enabled";
526 std::cerr <<
"disabled";
528 std::cerr << std::endl
529 <<
" - CPProfiler support: ";
530 #ifdef GECODE_HAS_CPPROFILER 531 std::cerr <<
"enabled";
533 std::cerr <<
"disabled";
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;
549 if (
int a = o->parse(c,v)) {
554 if (!strcmp(v[1],
"-help") || !strcmp(v[1],
"--help") ||
555 !strcmp(v[1],
"-?")) {
562 for (
int i=1;
i<argc;
i++)
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),
583 _search(
"search",
"search engine variants"),
584 _solutions(
"solutions",
"number of solutions (0 = all)",1),
585 _threads(
"threads",
"number of threads (0 = #processing units)",
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",
603 _relax(
"relax",
"probability for relaxing variable", 0.0),
604 _interrupt(
"interrupt",
"whether to catch Ctrl-C (true) or not (false)",
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)",
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"),
619 #ifdef GECODE_HAS_CPPROFILER
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",
624 _profiler_info(
"cpprofiler-info",
"send solution information to CP-profiler", false)
651 #ifdef GECODE_HAS_CPPROFILER 665 std::cerr <<
"\t(unsigned int) default: " <<
size() << std::endl
666 <<
"\t\twhich version/size for script" << std::endl;
674 size(static_cast<unsigned int>(atoi(argv[1])));
691 std::cerr <<
"\t(string) default: " <<
instance() << std::endl
692 <<
"\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.
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.
const char * opt
String for 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.
Driver::UnsignedIntOption _profiler_port
Connect to this port.
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.
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
const char * iopt
String for option (including hyphen)
void add(Driver::BaseOption &o)
Add new option o.
const char * eopt
String for option (excluding hyphen)
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.
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)
const unsigned int cpprofiler_port
Default port for CPProfiler.
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.
const char * help
Optional help text.
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.
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.
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.
int val
Value for an option value.
Driver::DoubleOption _relax
Probability to relax variable.
static char * stredup(const char *s)
Create heap-allocated copy of string s with hyphen added.
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.
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.
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.
Run script with CP-profiler.
virtual void help(void)
Print help text.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
Driver::TraceOption _trace
Trace flags for tracing.
Restart with geometric sequence.
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.
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
const char * _inst
Instance string.
Domain propagation Options: basic versus advanced propagation.
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.
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.