55 char*
d =
heap.
alloc<
char>(
static_cast<unsigned long int>(strlen(s)+1));
64 char*
d =
heap.
alloc<
char>(
static_cast<unsigned long int>(strlen(s)+2));
81 const char* s = argv[1];
92 std::cerr <<
"Missing argument for option \"" <<
iopt <<
"\"" 127 std::cerr <<
'\t' <<
iopt <<
" (string) default: " 128 << ((
cur == NULL) ?
"NONE" : cur) << std::endl
129 <<
"\t\t" <<
exp << std::endl;
154 for (
Value*
v = fst;
v != NULL;
v =
v->next)
155 if (!strcmp(
a,
v->opt)) {
159 std::cerr <<
"Wrong argument \"" <<
a 160 <<
"\" for option \"" <<
iopt <<
"\"" 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) ?
", " :
"");
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)
183 std::cerr <<
"\t\t " <<
v->opt <<
": " <<
v->help << std::endl;
209 std::cerr <<
'\t' <<
iopt <<
" (int) default: " <<
cur << std::endl
210 <<
"\t\t" <<
exp << std::endl;
217 cur =
static_cast<unsigned int>(atoi(
a));
225 std::cerr <<
'\t' <<
iopt <<
" (unsigned int) default: " 227 <<
"\t\t" <<
exp << std::endl;
243 cerr <<
'\t' <<
iopt <<
" (double) default: " <<
cur << endl
244 <<
"\t\t" <<
exp << endl;
252 const char* s = argv[1];
266 }
else if (!strcmp(argv[2],
"true") || !strcmp(argv[2],
"1")) {
269 }
else if (!strcmp(argv[2],
"false") || !strcmp(argv[2],
"0")) {
283 cerr <<
'\t' <<
iopt <<
" (optional: false, 0, true, 1) default: " 284 << (
cur ?
"true" :
"false") << endl
285 <<
"\t\t" <<
exp << endl;
293 :
BaseOption(
"ipl",
"integer propagation level (comma-separated list)"),
304 while ((*c !=
',') && (*c != 0))
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; }
314 std::cerr <<
"Wrong argument \"" <<
a 315 <<
"\" for option \"" <<
iopt <<
"\"" 320 if (*c ==
',')
a = c+1;
else a =
c;
334 <<
" (def,val,bnd,dom,basic,advanced)" << endl
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;
345 cerr << endl <<
"\t\t" <<
exp << endl;
354 :
BaseOption(
"trace",
"trace flags (comma-separated list)"),
364 while ((*c !=
',') && (*c != 0))
366 unsigned int e =
static_cast<unsigned int>(c-
a);
369 else if (!strncmp(
"fix",
a,e)) {
cur |=
TE_FIX; }
371 else if (!strncmp(
"done",
a,e)) {
cur |=
TE_DONE ; }
374 else if (!strncmp(
"none",
a,e) ||
375 !strncmp(
"false",
a,e) ||
376 !strncmp(
"0",
a,e)) {
cur = 0; }
377 else if (!strncmp(
"all",
a,e) ||
385 else if (!strncmp(
"variable",
a,e)) {
cur = (
TE_INIT |
393 std::cerr <<
"Wrong argument \"" <<
a 394 <<
"\" for option \"" <<
iopt <<
"\"" 399 if (*c ==
',')
a = c+1;
else a =
c;
412 <<
" (init,prune,fix,fail,done,propagate,commit,none,all,variable,general)" 428 if (f != 0) cerr <<
',';
433 if (f != 0) cerr <<
',';
438 if (f != 0) cerr <<
',';
443 if (f != 0) cerr <<
',';
448 if (f != 0) cerr <<
',';
453 if (f != 0) cerr <<
',';
459 cerr << endl <<
"\t\t" <<
exp << endl;
476 : fst(NULL), lst(NULL),
487 std::cerr <<
"Gecode configuration information:" << std::endl
489 <<
" - Variable types: ";
490 #ifdef GECODE_HAS_INT_VARS 491 std::cerr <<
"BoolVar IntVar ";
493 #ifdef GECODE_HAS_SET_VARS 494 std::cerr <<
"SetVar ";
496 #ifdef GECODE_HAS_FLOAT_VARS 497 std::cerr <<
"FloatVar " 499 <<
" - Trigonometric and transcendental float constraints: ";
500 #ifdef GECODE_HAS_MPFR 501 std::cerr <<
"enabled";
503 std::cerr <<
"disabled";
506 std::cerr << std::endl;
507 std::cerr <<
" - Thread support: ";
508 #ifdef GECODE_HAS_THREADS 510 std::cerr <<
"enabled (1 processing unit)";
513 <<
" processing units)";
515 std::cerr <<
"disabled";
517 std::cerr << std::endl
518 <<
" - Gist support: ";
519 #ifdef GECODE_HAS_GIST 520 std::cerr <<
"enabled";
522 std::cerr <<
"disabled";
524 std::cerr << std::endl
525 <<
" - CPProfiler support: ";
526 #ifdef GECODE_HAS_CPPROFILER 527 std::cerr <<
"enabled";
529 std::cerr <<
"disabled";
531 std::cerr << std::endl << std::endl
532 <<
"Options for " <<
name() <<
":" << std::endl
533 <<
"\t-help, --help, -?" << std::endl
534 <<
"\t\tprint this help message" << std::endl;
545 if (
int a = o->parse(c,v)) {
550 if (!strcmp(v[1],
"-help") || !strcmp(v[1],
"--help") ||
551 !strcmp(v[1],
"-?")) {
558 for (
int i=1;
i<argc;
i++)
571 _model(
"model",
"model variants"),
572 _symmetry(
"symmetry",
"symmetry variants"),
573 _propagation(
"propagation",
"propagation variants"),
574 _branching(
"branching",
"branching variants"),
575 _decay(
"decay",
"decay factor",1.0),
576 _seed(
"seed",
"random number generator seed",1U),
577 _step(
"step",
"step distance for float optimization",0.0),
579 _search(
"search",
"search engine variants"),
580 _solutions(
"solutions",
"number of solutions (0 = all)",1),
581 _threads(
"threads",
"number of threads (0 = #processing units)",
583 _c_d(
"c-d",
"recomputation commit distance",Search::Config::
c_d),
584 _a_d(
"a-d",
"recomputation adaptation distance",Search::Config::
a_d),
585 _d_l(
"d-l",
"discrepancy limit for LDS",Search::Config::
d_l),
586 _node(
"node",
"node cutoff (0 = none, solution mode)"),
587 _fail(
"fail",
"failure cutoff (0 = none, solution mode)"),
588 _time(
"time",
"time (in ms) cutoff (0 = none, solution mode)"),
589 _assets(
"assets",
"#portfolio assets (#engines)",0),
590 _slice(
"slice",
"portfolio slice (in #failures)",Search::Config::
slice),
591 _restart(
"restart",
"restart sequence type",
RM_NONE),
592 _r_base(
"restart-base",
"base for geometric restart sequence",
593 Search::Config::
base),
594 _r_scale(
"restart-scale",
"scale factor for restart sequence",
595 Search::Config::
slice),
596 _nogoods(
"nogoods",
"whether to use no-goods from restarts",false),
597 _nogoods_limit(
"nogoods-limit",
"depth limit for no-good extraction",
599 _relax(
"relax",
"probability for relaxing variable", 0.0),
600 _interrupt(
"interrupt",
"whether to catch Ctrl-C (true) or not (false)",
604 _samples(
"samples",
"how many samples (time mode)",1),
605 _iterations(
"iterations",
"iterations per sample (time mode)",1),
606 _print_last(
"print-last",
607 "whether to only print the last solution (solution mode)",
609 _out_file(
"file-sol",
"where to print solutions " 610 "(supports stdout, stdlog, stderr)",
"stdout"),
611 _log_file(
"file-stat",
"where to print statistics " 612 "(supports stdout, stdlog, stderr)",
"stdout"),
615 #ifdef GECODE_HAS_CPPROFILER
617 _profiler_id(
"cpprofiler-id",
"use this execution id with CP-profiler", 0),
618 _profiler_port(
"cpprofiler-port",
"connect to CP-profiler on this port",
620 _profiler_info(
"cpprofiler-info",
"send solution information to CP-profiler", false)
647 #ifdef GECODE_HAS_CPPROFILER 661 std::cerr <<
"\t(unsigned int) default: " <<
size() << std::endl
662 <<
"\t\twhich version/size for script" << std::endl;
670 size(static_cast<unsigned int>(atoi(argv[1])));
687 std::cerr <<
"\t(string) default: " <<
instance() << std::endl
688 <<
"\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.