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;
232 if ((argc < 2) || strcmp(argv[1],
opt))
238 }
else if (!strcmp(argv[2],
"true") || !strcmp(argv[2],
"1")) {
241 }
else if (!strcmp(argv[2],
"false") || !strcmp(argv[2],
"0")) {
255 cerr <<
'\t' <<
opt <<
" (optional: false, 0, true, 1) default: "
256 << (
cur ?
"true" :
"false") << endl
257 <<
"\t\t" <<
exp << endl;
274 : fst(NULL), lst(NULL),
285 std::cerr <<
"Gecode configuration information:" << std::endl
287 <<
" - Variable types: ";
288 #ifdef GECODE_HAS_INT_VARS
289 std::cerr <<
"BoolVar IntVar ";
291 #ifdef GECODE_HAS_SET_VARS
292 std::cerr <<
"SetVar ";
294 #ifdef GECODE_HAS_FLOAT_VARS
295 std::cerr <<
"FloatVar "
297 <<
" - Trigonometric and transcendental float constraints: ";
298 #ifdef GECODE_HAS_MPFR
299 std::cerr <<
"enabled";
301 std::cerr <<
"disabled";
304 std::cerr << std::endl;
305 std::cerr <<
" - Thread support: ";
306 #ifdef GECODE_HAS_THREADS
308 std::cerr <<
"enabled (1 processing unit)";
311 <<
" processing units)";
313 std::cerr <<
"disabled";
315 std::cerr << std::endl
316 <<
" - Gist support: ";
317 #ifdef GECODE_HAS_GIST
318 std::cerr <<
"enabled";
320 std::cerr <<
"disabled";
322 std::cerr << std::endl << std::endl
323 <<
"Options for " <<
name() <<
":" << std::endl
324 <<
"\t-help, --help, -?" << std::endl
325 <<
"\t\tprint this help message" << std::endl;
336 if (
int a = o->parse(c,v)) {
341 if (!strcmp(v[1],
"-help") || !strcmp(v[1],
"--help") ||
342 !strcmp(v[1],
"-?")) {
349 for (
int i=1;
i<argc;
i++)
362 _model(
"-model",
"model variants"),
363 _symmetry(
"-symmetry",
"symmetry variants"),
364 _propagation(
"-propagation",
"propagation variants"),
365 _icl(
"-icl",
"integer consistency level",
ICL_DEF),
366 _branching(
"-branching",
"branching variants"),
367 _decay(
"-decay",
"decay factor",1.0),
369 _search(
"-search",
"search engine variants"),
370 _solutions(
"-solutions",
"number of solutions (0 = all)",1),
371 _threads(
"-threads",
"number of threads (0 = #processing units)",
373 _c_d(
"-c-d",
"recomputation commit distance",Search::Config::
c_d),
374 _a_d(
"-a-d",
"recomputation adaptation distance",Search::Config::
a_d),
375 _node(
"-node",
"node cutoff (0 = none, solution mode)"),
376 _fail(
"-fail",
"failure cutoff (0 = none, solution mode)"),
377 _time(
"-time",
"time (in ms) cutoff (0 = none, solution mode)"),
378 _restart(
"-restart",
"restart sequence type",
RM_NONE),
379 _r_base(
"-restart-base",
"base for geometric restart sequence",1.5),
380 _r_scale(
"-restart-scale",
"scale factor for restart sequence",250),
381 _nogoods(
"-nogoods",
"whether to use no-goods from restarts",false),
382 _nogoods_limit(
"-nogoods-limit",
"depth limit for no-good extraction",
384 _interrupt(
"-interrupt",
"whether to catch Ctrl-C (true) or not (false)",
387 _mode(
"-mode",
"how to execute script",
SM_SOLUTION),
388 _samples(
"-samples",
"how many samples (time mode)",1),
389 _iterations(
"-iterations",
"iterations per sample (time mode)",1),
390 _print_last(
"-print-last",
391 "whether to only print the last solution (solution mode)",
393 _out_file(
"-file-sol",
"where to print solutions "
394 "(supports stdout, stdlog, stderr)",
"stdout"),
395 _log_file(
"-file-stat",
"where to print statistics "
396 "(supports stdout, stdlog, stderr)",
"stdout")
430 std::cerr <<
"\t(unsigned int) default: " <<
size() << std::endl
431 <<
"\t\twhich version/size for script" << std::endl;
439 size(static_cast<unsigned int>(atoi(argv[1])));
456 std::cerr <<
"\t(string) default: " <<
instance() << std::endl
457 <<
"\t\twhich instance for script" << std::endl;
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Restart with linear sequence.
Driver::BoolOption _interrupt
Whether to catch SIGINT.
virtual ~StringValueOption(void)
Destructor.
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.
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.
Value propagation or consistency (naive)
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.
Value * lst
Last option value.
Restart with Luby sequence.
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.
Heap heap
The single global heap.
Driver::StringOption _model
General model options.
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.
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.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Value * fst
First option value.
virtual ~BaseOption(void)
Destructor.
Driver::StringOption _propagation
Propagation options.
Base class for script options.
const char * instance(void) const
Return instance name.
const char * _name
Script name.
Driver::StringOption _search
Search options.
Driver::BoolOption _print_last
Print only last solution found.
BaseOption * next
Next option Check for option and return its argument.
Driver::StringOption _symmetry
General symmetry options.
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
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.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
virtual ~StringOption(void)
Destructor.
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Print statistics for script.
virtual void help(void)
Print help text.
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.
InstanceOptions(const char *s)
Initialize options for script with name s.
const char * _inst
Instance string.
const char * value(void) const
Return current option value.
The default consistency for a constraint.
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.
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.
unsigned int size(void) const
Return size.
~InstanceOptions(void)
Destructor.
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
virtual void help(void)
Print help text.
Bounds propagation or consistency.
Driver::StringOption _icl
Integer consistency level.
Gecode toplevel namespace
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.
char * argument(int argc, char *argv[]) const
const char * name(void) const
Return name of script.
Restart with constant sequence.
Driver::UnsignedIntOption _r_scale
Restart scale factor.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
Domain propagation or consistency.
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.
virtual void help(void)
Print help text.
virtual void help(void)
Print help text.