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 <<
"\""
100 : eopt(strdup(o)), iopt(stredup(o)),
exp(strdup(e)) {}
127 std::cerr <<
'\t' <<
iopt <<
" (string) default: "
128 << ((
cur == NULL) ?
"NONE" :
cur) << std::endl
129 <<
"\t\t" <<
exp << std::endl;
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;
173 std::cerr <<
v->opt << ((
v->next != NULL) ?
", " :
"");
179 std::cerr <<
" default: " <<
d;
180 std::cerr << std::endl <<
"\t\t" <<
exp << std::endl;
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 ; }
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) ||
387 else if (!strncmp(
"variable",
a,e)) {
cur = (
TE_INIT |
396 std::cerr <<
"Wrong argument \"" <<
a
397 <<
"\" for option \"" <<
iopt <<
"\""
402 if (*
c ==
',')
a =
c+1;
else a =
c;
415 <<
" (init,prune,fix,fail,done,propagate,commit,post,none,all,variable,general)"
431 if (
f != 0) cerr <<
',';
436 if (
f != 0) cerr <<
',';
441 if (
f != 0) cerr <<
',';
446 if (
f != 0) cerr <<
',';
451 if (
f != 0) cerr <<
',';
456 if (
f != 0) cerr <<
',';
461 if (
f != 0) cerr <<
',';
467 cerr << endl <<
"\t\t" <<
exp << endl;
484 : fst(NULL), lst(NULL),
485 _name(Driver::BaseOption::strdup(
n)) {}
495 std::cerr <<
"Gecode configuration information:" << std::endl
497 <<
" - Variable types: ";
498 #ifdef GECODE_HAS_INT_VARS
499 std::cerr <<
"BoolVar IntVar ";
501 #ifdef GECODE_HAS_SET_VARS
502 std::cerr <<
"SetVar ";
504 #ifdef GECODE_HAS_FLOAT_VARS
505 std::cerr <<
"FloatVar "
507 <<
" - Trigonometric and transcendental float constraints: ";
508 #ifdef GECODE_HAS_MPFR
509 std::cerr <<
"enabled";
511 std::cerr <<
"disabled";
514 std::cerr << std::endl;
515 std::cerr <<
" - Thread support: ";
516 #ifdef GECODE_HAS_THREADS
518 std::cerr <<
"enabled (1 processing unit)";
521 <<
" processing units)";
523 std::cerr <<
"disabled";
525 std::cerr << std::endl
526 <<
" - Gist support: ";
527 #ifdef GECODE_HAS_GIST
528 std::cerr <<
"enabled";
530 std::cerr <<
"disabled";
532 std::cerr << std::endl
533 <<
" - CPProfiler support: ";
534 #ifdef GECODE_HAS_CPPROFILER
535 std::cerr <<
"enabled";
537 std::cerr <<
"disabled";
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;
553 if (
int a = o->parse(
c,
v)) {
558 if (!strcmp(
v[1],
"-help") || !strcmp(
v[1],
"--help") ||
559 !strcmp(
v[1],
"-?")) {
566 for (
int i=1;
i<argc;
i++)
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),
587 _search(
"search",
"search engine variants"),
588 _solutions(
"solutions",
"number of solutions (0 = all)",1),
589 _threads(
"threads",
"number of threads (0 = #processing units)",
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",
607 _relax(
"relax",
"probability for relaxing variable", 0.0),
608 _interrupt(
"interrupt",
"whether to catch Ctrl-C (true) or not (false)",
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)",
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"),
623 #ifdef GECODE_HAS_CPPROFILER
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",
628 _profiler_info(
"cpprofiler-info",
"send solution information to CP-profiler", false)
655 #ifdef GECODE_HAS_CPPROFILER
669 std::cerr <<
"\t(unsigned int) default: " <<
size() << std::endl
670 <<
"\t\twhich version/size for script" << std::endl;
678 size(
static_cast<unsigned int>(atoi(argv[1])));
695 std::cerr <<
"\t(string) default: " <<
instance() << std::endl
696 <<
"\t\twhich instance for script" << std::endl;
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Base class for script options.
BaseOptions(const char *s)
Initialize options for script with name s.
void add(Driver::BaseOption &o)
Add new option o.
const char * _name
Script name.
virtual ~BaseOptions(void)
Destructor.
Driver::BaseOption * fst
First registered option.
const char * name(void) const
Return name of script.
virtual void help(void)
Print help text.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
static void strdel(const char *s)
Delete heap-allocated copy of string s.
static char * stredup(const char *s)
Create heap-allocated copy of string s with hyphen added.
const char * eopt
String for option (excluding hyphen)
virtual ~BaseOption(void)
Destructor.
char * argument(int argc, char *argv[]) const
static char * strdup(const char *s)
Create heap-allocated copy of string s.
const char * exp
Short explanation.
const char * iopt
String for option (including hyphen)
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
BaseOption * next
Next option Check for option and return its argument.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
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.
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.
IntPropLevel cur
Current value.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
IplOption(IntPropLevel ipl=IPL_DEF)
Initialize with default value ipl.
virtual void help(void)
Print help text.
Value * next
Next option value.
virtual ~StringOption(void)
Destructor.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
virtual void help(void)
Print help text.
Value * lst
Last option value.
Value * fst
First option value.
void add(int v, const char *o, const char *h=NULL)
Add option value for value v, string o, and help text h.
virtual void help(void)
Print help text.
virtual ~StringValueOption(void)
Destructor.
StringValueOption(const char *o, const char *e, const char *v=NULL)
Initialize for option o and explanation e and default value v.
const char * value(void) const
Return current option value.
const char * cur
Current value.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
virtual void help(void)
Print help text.
TraceOption(int f=0)
Initialize with no tracing.
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.
unsigned int cur
Current value.
virtual void help(void)
Print help text.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from heap.
void rfree(void *p)
Free memory block starting at p.
const char * _inst
Instance string.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
virtual void help(void)
Print help text.
const char * instance(void) const
Return instance name.
~InstanceOptions(void)
Destructor.
InstanceOptions(const char *s)
Initialize options for script with name s.
Driver::DoubleOption _relax
Probability to relax variable.
Driver::StringValueOption _log_file
Where to print statistics.
Driver::StringOption _model
General model options.
Driver::StringOption _mode
Script mode to run.
Driver::DoubleOption _decay
Decay option.
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
Driver::BoolOption _nogoods
Whether to use no-goods.
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
Driver::TraceOption _trace
Trace flags for tracing.
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
Driver::UnsignedIntOption _solutions
How many solutions.
Driver::UnsignedIntOption _iterations
How many iterations per sample.
Driver::StringOption _search
Search options.
Driver::StringOption _propagation
Propagation options.
Driver::IplOption _ipl
Integer propagation level.
Options(const char *s)
Initialize options for script with name s.
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
Driver::BoolOption _print_last
Print only last solution found.
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Driver::DoubleOption _threads
How many threads to use.
Driver::StringOption _branching
Branching options.
Driver::StringOption _restart
Restart method option.
Driver::UnsignedIntOption _seed
Seed option.
Driver::UnsignedIntOption _time
Cutoff for time.
Driver::DoubleOption _step
Step option.
Driver::UnsignedIntOption _profiler_port
Connect to this port.
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Driver::DoubleOption _r_base
Restart base.
Driver::StringOption _symmetry
General symmetry options.
Driver::StringValueOption _out_file
Where to print solutions.
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Driver::UnsignedIntOption _samples
How many samples.
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
unsigned int size(void) const
Return size.
virtual void help(void)
Print help text.
SizeOptions(const char *s)
Initialize options for script with name s.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
static unsigned int npu(void)
Return number of processing units (1 if information not available)
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Heap heap
The single global heap.
@ SM_STAT
Print statistics for script.
@ SM_SOLUTION
Print solution and some statistics.
@ SM_GIST
Run script in Gist.
@ SM_CPPROFILER
Run script with CP-profiler.
@ SM_TIME
Measure average runtime.
@ RM_CONSTANT
Restart with constant sequence.
@ RM_LINEAR
Restart with linear sequence.
@ RM_LUBY
Restart with Luby sequence.
@ RM_GEOMETRIC
Restart with geometric sequence.
IntPropLevel
Propagation levels for integer propagators.
@ IPL_BASIC
Use basic propagation algorithm.
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
@ IPL_VAL
Value propagation.
@ IPL_ADVANCED
Use advanced propagation algorithm.
@ IPL_DEF
Simple propagation levels.
@ IPL_BND
Bounds propagation.
@ TE_INIT
Trace init events.
@ TE_POST
Trace propagator posting.
@ TE_COMMIT
Trace commit operations by branchers.
@ TE_PRUNE
Trace prune events.
@ TE_PROPAGATE
Trace propagator executions.
@ TE_FIX
Trace fixpoint events.
@ TE_FAIL
Trace fail events.
@ TE_DONE
Trace done events.
IntPropLevel vbd(IntPropLevel ipl)
Extract value, bounds, or domain propagation from propagation level.
const unsigned int d_l
Default discrepancy limit for LDS.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
const double base
Base for geometric restart sequence.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
const unsigned int slice
Size of a slice in a portfolio and scale factor for restarts(in number of failures)
const unsigned int cpprofiler_port
Default port for CPProfiler.
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
const double threads
Number of threads to use.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i({1, 2, 3, 4})
#define GECODE_NEVER
Assert that this command is never executed.