options.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2004
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <gecode/driver.hh>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
namespace Gecode {
namespace Driver {
/*
* Option baseclass
*
*/
char*
BaseOption::strdup(const char* s) {
if (s == NULL)
return NULL;
char* d = heap.alloc<char>(static_cast<unsigned long int>(strlen(s)+1));
(void) strcpy(d,s);
return d;
}
char*
BaseOption::stredup(const char* s) {
if (s == NULL)
return NULL;
char* d = heap.alloc<char>(static_cast<unsigned long int>(strlen(s)+2));
d[0] = '-';
(void) strcpy(d+1,s);
return d;
}
void
BaseOption::strdel(const char* s) {
if (s == NULL)
return;
heap.rfree(const_cast<char*>(s));
}
char*
BaseOption::argument(int argc, char* argv[]) const {
if (argc < 2)
return NULL;
const char* s = argv[1];
if (s[0] == '-') {
s++;
if (s[0] == '-')
s++;
} else {
return NULL;
}
if (strcmp(s,eopt))
return NULL;
if (argc == 2) {
std::cerr << "Missing argument for option \"" << iopt << "\""
<< std::endl;
exit(EXIT_FAILURE);
}
return argv[2];
}
BaseOption::BaseOption(const char* o, const char* e)
: eopt(strdup(o)), iopt(stredup(o)), exp(strdup(e)) {}
BaseOption::~BaseOption(void) {
strdel(eopt);
strdel(iopt);
strdel(exp);
}
StringValueOption::StringValueOption(const char* o, const char* e,
const char* v)
: BaseOption(o,e), cur(strdup(v)) {}
void
StringValueOption::value(const char* v) {
strdel(cur);
cur = strdup(v);
}
int
StringValueOption::parse(int argc, char* argv[]) {
if (char* a = argument(argc,argv)) {
cur = strdup(a);
return 2;
}
return 0;
}
void
StringValueOption::help(void) {
std::cerr << '\t' << iopt << " (string) default: "
<< ((cur == NULL) ? "NONE" : cur) << std::endl
<< "\t\t" << exp << std::endl;
}
StringValueOption::~StringValueOption(void) {
strdel(cur);
}
void
StringOption::add(int v, const char* o, const char* h) {
Value* n = new Value;
n->val = v;
n->opt = strdup(o);
n->help = strdup(h);
n->next = NULL;
if (fst == NULL) {
fst = n;
} else {
lst->next = n;
}
lst = n;
}
int
StringOption::parse(int argc, char* argv[]) {
if (char* a = argument(argc,argv)) {
for (Value* v = fst; v != NULL; v = v->next)
if (!strcmp(a,v->opt)) {
cur = v->val;
return 2;
}
std::cerr << "Wrong argument \"" << a
<< "\" for option \"" << iopt << "\""
<< std::endl;
exit(EXIT_FAILURE);
}
return 0;
}
void
StringOption::help(void) {
if (fst == NULL)
return;
std::cerr << '\t' << iopt << " (";
const char* d = NULL;
for (Value* v = fst; v != NULL; v = v->next) {
std::cerr << v->opt << ((v->next != NULL) ? ", " : "");
if (v->val == cur)
d = v->opt;
}
std::cerr << ")";
if (d != NULL)
std::cerr << " default: " << d;
std::cerr << std::endl << "\t\t" << exp << std::endl;
for (Value* v = fst; v != NULL; v = v->next)
if (v->help != NULL)
std::cerr << "\t\t " << v->opt << ": " << v->help << std::endl;
}
StringOption::~StringOption(void) {
Value* v = fst;
while (v != NULL) {
strdel(v->opt);
strdel(v->help);
Value* n = v->next;
delete v;
v = n;
}
}
int
IntOption::parse(int argc, char* argv[]) {
if (char* a = argument(argc,argv)) {
cur = atoi(a);
return 2;
}
return 0;
}
void
IntOption::help(void) {
std::cerr << '\t' << iopt << " (int) default: " << cur << std::endl
<< "\t\t" << exp << std::endl;
}
int
UnsignedIntOption::parse(int argc, char* argv[]) {
if (char* a = argument(argc,argv)) {
cur = static_cast<unsigned int>(atoi(a));
return 2;
}
return 0;
}
void
UnsignedIntOption::help(void) {
std::cerr << '\t' << iopt << " (unsigned int) default: "
<< cur << std::endl
<< "\t\t" << exp << std::endl;
}
int
DoubleOption::parse(int argc, char* argv[]) {
if (char* a = argument(argc,argv)) {
cur = atof(a);
return 2;
}
return 0;
}
void
DoubleOption::help(void) {
using namespace std;
cerr << '\t' << iopt << " (double) default: " << cur << endl
<< "\t\t" << exp << endl;
}
int
BoolOption::parse(int argc, char* argv[]) {
if (argc < 2)
return 0;
const char* s = argv[1];
if (s[0] == '-') {
s++;
if (s[0] == '-')
s++;
} else {
return 0;
}
if (strcmp(s,eopt))
return 0;
if (argc == 2) {
// Option without argument
cur = true;
return 1;
} else if (!strcmp(argv[2],"true") || !strcmp(argv[2],"1")) {
cur = true;
return 2;
} else if (!strcmp(argv[2],"false") || !strcmp(argv[2],"0")) {
cur = false;
return 2;
} else {
// Option without argument
cur = true;
return 1;
}
return 0;
}
void
BoolOption::help(void) {
using namespace std;
cerr << '\t' << iopt << " (optional: false, 0, true, 1) default: "
<< (cur ? "true" : "false") << endl
<< "\t\t" << exp << endl;
}
/*
* Integer propagation level option
*
*/
IplOption::IplOption(IntPropLevel ipl)
: BaseOption("ipl","integer propagation level (comma-separated list)"),
cur(ipl) {}
int
IplOption::parse(int argc, char* argv[]) {
if (char* a = argument(argc,argv)) {
int b = IPL_DEF;
int m = IPL_DEF;
do {
// Search for a comma
char* c = a;
while ((*c != ',') && (*c != 0))
c++;
unsigned int e = static_cast<unsigned int>(c-a);
if (!strncmp("def",a,e)) { b = IPL_DEF; }
else if (!strncmp("val",a,e)) { b = IPL_VAL; }
else if (!strncmp("bnd",a,e)) { b = IPL_BND; }
else if (!strncmp("dom",a,e)) { b = IPL_DOM; }
else if (!strncmp("basic",a,e)) { m |= IPL_BASIC; }
else if (!strncmp("advanced",a,e)) { m |= IPL_ADVANCED; }
else {
std::cerr << "Wrong argument \"" << a
<< "\" for option \"" << iopt << "\""
<< std::endl;
exit(EXIT_FAILURE);
}
if (*c == ',') a = c+1; else a = c;
} while (*a != 0);
cur = static_cast<IntPropLevel>(b | m);
return 2;
}
return 0;
}
void
IplOption::help(void) {
using namespace std;
cerr << '\t' << iopt
<< " (def,val,bnd,dom,basic,advanced)" << endl
<< "\t\tdefault: ";
switch (vbd(cur)) {
case IPL_DEF: cerr << "def"; break;
case IPL_VAL: cerr << "val"; break;
case IPL_BND: cerr << "bnd"; break;
case IPL_DOM: cerr << "dom"; break;
default: GECODE_NEVER;
}
if (cur & IPL_BASIC) cerr << ",basic";
if (cur & IPL_ADVANCED) cerr << ",advanced";
cerr << endl << "\t\t" << exp << endl;
}
/*
* Trace flag option
*
*/
TraceOption::TraceOption(int f)
: BaseOption("trace","trace flags (comma-separated list)"),
cur(f) {}
int
TraceOption::parse(int argc, char* argv[]) {
if (char* a = argument(argc,argv)) {
cur = 0;
do {
// Search for a comma
char* c = a;
while ((*c != ',') && (*c != 0))
c++;
unsigned int e = static_cast<unsigned int>(c-a);
if (!strncmp("init",a,e)) { cur |= TE_INIT; }
else if (!strncmp("prune",a,e)) { cur |= TE_PRUNE; }
else if (!strncmp("fix",a,e)) { cur |= TE_FIX; }
else if (!strncmp("fail",a,e)) { cur |= TE_FAIL; }
else if (!strncmp("done",a,e)) { cur |= TE_DONE ; }
else if (!strncmp("propagate",a,e)) { cur |= TE_PROPAGATE; }
else if (!strncmp("commit",a,e)) { cur |= TE_COMMIT; }
else if (!strncmp("post",a,e)) { cur |= TE_POST; }
else if (!strncmp("none",a,e) ||
!strncmp("false",a,e) ||
!strncmp("0",a,e)) { cur = 0; }
else if (!strncmp("all",a,e) ||
!strncmp("1",a,e)) { cur = (TE_INIT |
TE_PRUNE |
TE_FIX |
TE_FAIL |
TE_DONE |
TE_PROPAGATE |
TE_COMMIT |
TE_POST); }
else if (!strncmp("variable",a,e)) { cur = (TE_INIT |
TE_PRUNE |
TE_FIX |
TE_FAIL |
TE_DONE); }
else if (!strncmp("general",a,e)) { cur = (TE_PROPAGATE |
TE_COMMIT |
TE_POST); }
else {
std::cerr << "Wrong argument \"" << a
<< "\" for option \"" << iopt << "\""
<< std::endl;
exit(EXIT_FAILURE);
}
if (*c == ',') a = c+1; else a = c;
} while (*a != 0);
return 2;
}
return 0;
}
void
TraceOption::help(void) {
using namespace std;
cerr << '\t' << iopt
<< " (init,prune,fix,fail,done,propagate,commit,post,none,all,variable,general)"
<< " default: ";
if (cur == 0) {
cerr << "none";
} else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE |
TE_PROPAGATE | TE_COMMIT | TE_POST)) {
cerr << "all";
} else if (cur == (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE)) {
cerr << "variable";
} else if (cur == (TE_PROPAGATE | TE_COMMIT | TE_POST)) {
cerr << "general";
} else {
int f = cur;
if ((f & TE_INIT) != 0) {
cerr << "init";
f -= TE_INIT;
if (f != 0) cerr << ',';
}
if ((f & TE_PRUNE) != 0) {
cerr << "prune";
f -= TE_PRUNE;
if (f != 0) cerr << ',';
}
if ((f & TE_FIX) != 0) {
cerr << "fix";
f -= TE_FIX;
if (f != 0) cerr << ',';
}
if ((f & TE_FAIL) != 0) {
cerr << "fail";
f -= TE_FAIL;
if (f != 0) cerr << ',';
}
if ((f & TE_DONE) != 0) {
cerr << "done";
f -= TE_DONE;
if (f != 0) cerr << ',';
}
if ((f & TE_PROPAGATE) != 0) {
cerr << "propagate";
f -= TE_PROPAGATE;
if (f != 0) cerr << ',';
}
if ((f & TE_COMMIT) != 0) {
cerr << "commit";
f -= TE_COMMIT;
if (f != 0) cerr << ',';
}
if ((f & TE_POST) != 0) {
cerr << "post";
}
}
cerr << endl << "\t\t" << exp << endl;
}
}
void
BaseOptions::add(Driver::BaseOption& o) {
o.next = NULL;
if (fst == NULL) {
fst=&o;
} else {
lst->next=&o;
}
lst=&o;
}
BaseOptions::BaseOptions(const char* n)
: fst(NULL), lst(NULL),
_name(Driver::BaseOption::strdup(n)) {}
void
BaseOptions::name(const char* n) {
Driver::BaseOption::strdel(_name);
_name = Driver::BaseOption::strdup(n);
}
void
BaseOptions::help(void) {
std::cerr << "Gecode configuration information:" << std::endl
<< " - Version: " << GECODE_VERSION << std::endl
<< " - Variable types: ";
#ifdef GECODE_HAS_INT_VARS
std::cerr << "BoolVar IntVar ";
#endif
#ifdef GECODE_HAS_SET_VARS
std::cerr << "SetVar ";
#endif
#ifdef GECODE_HAS_FLOAT_VARS
std::cerr << "FloatVar "
<< std::endl
<< " - Trigonometric and transcendental float constraints: ";
#ifdef GECODE_HAS_MPFR
std::cerr << "enabled";
#else
std::cerr << "disabled";
#endif
#endif
std::cerr << std::endl;
std::cerr << " - Thread support: ";
#ifdef GECODE_HAS_THREADS
if (Support::Thread::npu() == 1)
std::cerr << "enabled (1 processing unit)";
else
std::cerr << "enabled (" << Support::Thread::npu()
<< " processing units)";
#else
std::cerr << "disabled";
#endif
std::cerr << std::endl
<< " - Gist support: ";
#ifdef GECODE_HAS_GIST
std::cerr << "enabled";
#else
std::cerr << "disabled";
#endif
std::cerr << std::endl
<< " - CPProfiler support: ";
#ifdef GECODE_HAS_CPPROFILER
std::cerr << "enabled";
#else
std::cerr << "disabled";
#endif
std::cerr << std::endl << std::endl
<< "Options for " << name() << ":" << std::endl
<< "\t-help, --help, -?" << std::endl
<< "\t\tprint this help message" << std::endl;
for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
o->help();
}
void
BaseOptions::parse(int& argc, char* argv[]) {
int c = argc;
char** v = argv;
next:
for (Driver::BaseOption* o = fst; o != NULL; o = o->next)
if (int a = o->parse(c,v)) {
c -= a; v += a;
goto next;
}
if (c >= 2) {
if (!strcmp(v[1],"-help") || !strcmp(v[1],"--help") ||
!strcmp(v[1],"-?")) {
help();
exit(EXIT_SUCCESS);
}
}
// Copy remaining arguments
argc = c;
for (int i=1; i<argc; i++)
argv[i] = v[i];
return;
}
BaseOptions::~BaseOptions(void) {
Driver::BaseOption::strdel(_name);
}
Options::Options(const char* n)
: BaseOptions(n),
_model("model","model variants"),
_symmetry("symmetry","symmetry variants"),
_propagation("propagation","propagation variants"),
_branching("branching","branching variants"),
_decay("decay","decay factor",1.0),
_seed("seed","random number generator seed",1U),
_step("step","step distance for float optimization",0.0),
_search("search","search engine variants"),
_solutions("solutions","number of solutions (0 = all)",1),
_threads("threads","number of threads (0 = #processing units)",
Search::Config::threads),
_c_d("c-d","recomputation commit distance",Search::Config::c_d),
_a_d("a-d","recomputation adaptation distance",Search::Config::a_d),
_d_l("d-l","discrepancy limit for LDS",Search::Config::d_l),
_node("node","node cutoff (0 = none, solution mode)"),
_fail("fail","failure cutoff (0 = none, solution mode)"),
_time("time","time (in ms) cutoff (0 = none, solution mode)"),
_assets("assets","#portfolio assets (#engines)",0),
_slice("slice","portfolio slice (in #failures)",Search::Config::slice),
_restart("restart","restart sequence type",RM_NONE),
_r_base("restart-base","base for geometric restart sequence",
Search::Config::base),
_r_scale("restart-scale","scale factor for restart sequence",
Search::Config::slice),
_nogoods("nogoods","whether to use no-goods from restarts",false),
_nogoods_limit("nogoods-limit","depth limit for no-good extraction",
Search::Config::nogoods_limit),
_relax("relax","probability for relaxing variable", 0.0),
_interrupt("interrupt","whether to catch Ctrl-C (true) or not (false)",
true),
_mode("mode","how to execute script",SM_SOLUTION),
_samples("samples","how many samples (time mode)",1),
_iterations("iterations","iterations per sample (time mode)",1),
_print_last("print-last",
"whether to only print the last solution (solution mode)",
false),
_out_file("file-sol", "where to print solutions "
"(supports stdout, stdlog, stderr)","stdout"),
_log_file("file-stat", "where to print statistics "
"(supports stdout, stdlog, stderr)","stdout"),
_trace(0)
#ifdef GECODE_HAS_CPPROFILER
,
_profiler_id("cpprofiler-id", "use this execution id with CP-profiler", 0),
_profiler_port("cpprofiler-port", "connect to CP-profiler on this port",
Search::Config::cpprofiler_port),
_profiler_info("cpprofiler-info", "send solution information to CP-profiler", false)
#endif
{
_mode.add(SM_SOLUTION, "solution");
_mode.add(SM_TIME, "time");
_mode.add(SM_STAT, "stat");
_mode.add(SM_GIST, "gist");
_mode.add(SM_CPPROFILER, "cpprofiler");
_restart.add(RM_NONE,"none");
_restart.add(RM_CONSTANT,"constant");
_restart.add(RM_LINEAR,"linear");
_restart.add(RM_LUBY,"luby");
_restart.add(RM_GEOMETRIC,"geometric");
add(_model); add(_symmetry); add(_propagation); add(_ipl);
add(_branching); add(_decay); add(_seed); add(_step);
add(_search); add(_solutions); add(_threads); add(_c_d); add(_a_d);
add(_d_l);
add(_node); add(_fail); add(_time); add(_interrupt);
add(_assets); add(_slice);
add(_restart); add(_r_base); add(_r_scale);
add(_nogoods); add(_nogoods_limit);
add(_relax);
add(_mode); add(_iterations); add(_samples); add(_print_last);
add(_out_file); add(_log_file); add(_trace);
#ifdef GECODE_HAS_CPPROFILER
add(_profiler_id);
add(_profiler_port);
add(_profiler_info);
#endif
}
SizeOptions::SizeOptions(const char* e)
: Options(e), _size(0) {}
void
SizeOptions::help(void) {
Options::help();
std::cerr << "\t(unsigned int) default: " << size() << std::endl
<< "\t\twhich version/size for script" << std::endl;
}
void
SizeOptions::parse(int& argc, char* argv[]) {
Options::parse(argc,argv);
if (argc < 2)
return;
size(static_cast<unsigned int>(atoi(argv[1])));
}
InstanceOptions::InstanceOptions(const char* e)
: Options(e), _inst(NULL) {}
void
InstanceOptions::instance(const char* s) {
Driver::BaseOption::strdel(_inst);
_inst = Driver::BaseOption::strdup(s);
}
void
InstanceOptions::help(void) {
Options::help();
std::cerr << "\t(string) default: " << instance() << std::endl
<< "\t\twhich instance for script" << std::endl;
}
void
InstanceOptions::parse(int& argc, char* argv[]) {
Options::parse(argc,argv);
if (argc < 2)
return;
instance(argv[1]);
}
InstanceOptions::~InstanceOptions(void) {
Driver::BaseOption::strdel(_inst);
}
}
// STATISTICS: driver-any
Gecode::BaseOptions::BaseOptions
BaseOptions(const char *s)
Initialize options for script with name s.
Definition options.cpp:483
Gecode::BaseOptions::add
void add(Driver::BaseOption &o)
Add new option o.
Definition options.cpp:474
Gecode::BaseOptions::_name
const char * _name
Script name.
Definition driver.hh:335
Gecode::BaseOptions::~BaseOptions
virtual ~BaseOptions(void)
Destructor.
Definition options.cpp:571
Gecode::BaseOptions::fst
Driver::BaseOption * fst
First registered option.
Definition driver.hh:333
Gecode::BaseOptions::lst
Driver::BaseOption * lst
Last registered option.
Definition driver.hh:334
Gecode::BaseOptions::name
const char * name(void) const
Return name of script.
Definition options.hpp:166
Gecode::BaseOptions::help
virtual void help(void)
Print help text.
Definition options.cpp:494
Gecode::BaseOptions::parse
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc).
Definition options.cpp:548
Gecode::Driver::BaseOption
Base class for options.
Definition driver.hh:121
Gecode::Driver::BaseOption::strdel
static void strdel(const char *s)
Delete heap-allocated copy of string s.
Definition options.cpp:71
Gecode::Driver::BaseOption::stredup
static char * stredup(const char *s)
Create heap-allocated copy of string s with hyphen added.
Definition options.cpp:61
Gecode::Driver::BaseOption::eopt
const char * eopt
String for option (excluding hyphen).
Definition driver.hh:124
Gecode::Driver::BaseOption::~BaseOption
virtual ~BaseOption(void)
Destructor.
Definition options.cpp:102
Gecode::Driver::BaseOption::argument
char * argument(int argc, char *argv[]) const
Definition options.cpp:78
Gecode::Driver::BaseOption::strdup
static char * strdup(const char *s)
Create heap-allocated copy of string s.
Definition options.cpp:52
Gecode::Driver::BaseOption::exp
const char * exp
Short explanation.
Definition driver.hh:126
Gecode::Driver::BaseOption::iopt
const char * iopt
String for option (including hyphen).
Definition driver.hh:125
Gecode::Driver::BaseOption::BaseOption
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
Definition options.cpp:99
Gecode::Driver::BaseOption::next
BaseOption * next
Next option Check for option and return its argument.
Definition driver.hh:127
Gecode::Driver::BoolOption::cur
bool cur
Current value.
Definition driver.hh:271
Gecode::Driver::BoolOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:249
Gecode::Driver::BoolOption::help
virtual void help(void)
Print help text.
Definition options.cpp:281
Gecode::Driver::DoubleOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:232
Gecode::Driver::DoubleOption::cur
double cur
Current value.
Definition driver.hh:251
Gecode::Driver::DoubleOption::help
virtual void help(void)
Print help text.
Definition options.cpp:241
Gecode::Driver::IntOption::help
virtual void help(void)
Print help text.
Definition options.cpp:208
Gecode::Driver::IntOption::cur
int cur
Current value.
Definition driver.hh:211
Gecode::Driver::IntOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:199
Gecode::Driver::IplOption::cur
IntPropLevel cur
Current value.
Definition driver.hh:291
Gecode::Driver::IplOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:297
Gecode::Driver::IplOption::IplOption
IplOption(IntPropLevel ipl=IPL_DEF)
Initialize with default value ipl.
Definition options.cpp:292
Gecode::Driver::IplOption::help
virtual void help(void)
Print help text.
Definition options.cpp:331
Gecode::Driver::StringOption::Value
Option value.
Definition driver.hh:177
Gecode::Driver::StringOption::Value::help
const char * help
Optional help text.
Definition driver.hh:181
Gecode::Driver::StringOption::Value::next
Value * next
Next option value.
Definition driver.hh:182
Gecode::Driver::StringOption::Value::val
int val
Value for an option value.
Definition driver.hh:179
Gecode::Driver::StringOption::Value::opt
const char * opt
String for option value.
Definition driver.hh:180
Gecode::Driver::StringOption::~StringOption
virtual ~StringOption(void)
Destructor.
Definition options.cpp:186
Gecode::Driver::StringOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:152
Gecode::Driver::StringOption::cur
int cur
Current value.
Definition driver.hh:184
Gecode::Driver::StringOption::help
virtual void help(void)
Print help text.
Definition options.cpp:167
Gecode::Driver::StringOption::lst
Value * lst
Last option value.
Definition driver.hh:186
Gecode::Driver::StringOption::fst
Value * fst
First option value.
Definition driver.hh:185
Gecode::Driver::StringOption::add
void add(int v, const char *o, const char *h=NULL)
Add option value for value v, string o, and help text h.
Definition options.cpp:138
Gecode::Driver::StringValueOption::help
virtual void help(void)
Print help text.
Definition options.cpp:126
Gecode::Driver::StringValueOption::~StringValueOption
virtual ~StringValueOption(void)
Destructor.
Definition options.cpp:131
Gecode::Driver::StringValueOption::StringValueOption
StringValueOption(const char *o, const char *e, const char *v=NULL)
Initialize for option o and explanation e and default value v.
Definition options.cpp:109
Gecode::Driver::StringValueOption::value
const char * value(void) const
Return current option value.
Definition options.hpp:46
Gecode::Driver::StringValueOption::cur
const char * cur
Current value.
Definition driver.hh:153
Gecode::Driver::StringValueOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:118
Gecode::Driver::TraceOption::help
virtual void help(void)
Print help text.
Definition options.cpp:412
Gecode::Driver::TraceOption::cur
int cur
Current value.
Definition driver.hh:311
Gecode::Driver::TraceOption::TraceOption
TraceOption(int f=0)
Initialize with no tracing.
Definition options.cpp:353
Gecode::Driver::TraceOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:358
Gecode::Driver::UnsignedIntOption::parse
virtual int parse(int argc, char *argv[])
Parse option at first position and return number of parsed arguments.
Definition options.cpp:215
Gecode::Driver::UnsignedIntOption::cur
unsigned int cur
Current value.
Definition driver.hh:231
Gecode::Driver::UnsignedIntOption::help
virtual void help(void)
Print help text.
Definition options.cpp:224
Gecode::InstanceOptions::_inst
const char * _inst
Instance string.
Definition driver.hh:698
Gecode::InstanceOptions::parse
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc).
Definition options.cpp:700
Gecode::InstanceOptions::help
virtual void help(void)
Print help text.
Definition options.cpp:693
Gecode::InstanceOptions::instance
const char * instance(void) const
Return instance name.
Definition options.hpp:599
Gecode::InstanceOptions::~InstanceOptions
~InstanceOptions(void)
Destructor.
Definition options.cpp:707
Gecode::InstanceOptions::InstanceOptions
InstanceOptions(const char *s)
Initialize options for script with name s.
Definition options.cpp:683
Gecode::Options::_relax
Driver::DoubleOption _relax
Probability to relax variable.
Definition driver.hh:398
Gecode::Options::_log_file
Driver::StringValueOption _log_file
Where to print statistics.
Definition driver.hh:409
Gecode::Options::c_d
void c_d(unsigned int d)
Set default copy recomputation distance.
Definition options.hpp:301
Gecode::Options::_model
Driver::StringOption _model
General model options.
Definition driver.hh:370
Gecode::Options::_mode
Driver::StringOption _mode
Script mode to run.
Definition driver.hh:404
Gecode::Options::_decay
Driver::DoubleOption _decay
Decay option.
Definition driver.hh:375
Gecode::Options::_nogoods_limit
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
Definition driver.hh:397
Gecode::Options::a_d
void a_d(unsigned int d)
Set default adaptive recomputation distance.
Definition options.hpp:310
Gecode::Options::_nogoods
Driver::BoolOption _nogoods
Whether to use no-goods.
Definition driver.hh:396
Gecode::Options::_slice
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
Definition driver.hh:392
Gecode::Options::_trace
Driver::TraceOption _trace
Trace flags for tracing.
Definition driver.hh:410
Gecode::Options::_d_l
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Definition driver.hh:387
Gecode::Options::slice
void slice(unsigned int n)
Set default slice size in a portfolio.
Definition options.hpp:364
Gecode::Options::_assets
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
Definition driver.hh:391
Gecode::Options::_solutions
Driver::UnsignedIntOption _solutions
How many solutions.
Definition driver.hh:383
Gecode::Options::_iterations
Driver::UnsignedIntOption _iterations
How many iterations per sample.
Definition driver.hh:406
Gecode::Options::_search
Driver::StringOption _search
Search options.
Definition driver.hh:382
Gecode::Options::_propagation
Driver::StringOption _propagation
Propagation options.
Definition driver.hh:372
Gecode::Options::_ipl
Driver::IplOption _ipl
Integer propagation level.
Definition driver.hh:373
Gecode::Options::Options
Options(const char *s)
Initialize options for script with name s.
Definition options.cpp:576
Gecode::Options::_profiler_info
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
Definition driver.hh:415
Gecode::Options::_print_last
Driver::BoolOption _print_last
Print only last solution found.
Definition driver.hh:407
Gecode::Options::_c_d
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Definition driver.hh:385
Gecode::Options::nogoods_limit
void nogoods_limit(unsigned int l)
Set default nogoods depth limit.
Definition options.hpp:409
Gecode::Options::_threads
Driver::DoubleOption _threads
How many threads to use.
Definition driver.hh:384
Gecode::Options::_branching
Driver::StringOption _branching
Branching options.
Definition driver.hh:374
Gecode::Options::_restart
Driver::StringOption _restart
Restart method option.
Definition driver.hh:393
Gecode::Options::_seed
Driver::UnsignedIntOption _seed
Seed option.
Definition driver.hh:376
Gecode::Options::_time
Driver::UnsignedIntOption _time
Cutoff for time.
Definition driver.hh:390
Gecode::Options::_step
Driver::DoubleOption _step
Step option.
Definition driver.hh:377
Gecode::Options::_profiler_port
Driver::UnsignedIntOption _profiler_port
Connect to this port.
Definition driver.hh:414
Gecode::Options::_r_scale
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Definition driver.hh:395
Gecode::Options::_profiler_id
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Definition driver.hh:413
Gecode::Options::_interrupt
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Definition driver.hh:399
Gecode::Options::d_l
void d_l(unsigned int d)
Set default discrepancy limit for LDS.
Definition options.hpp:319
Gecode::Options::_a_d
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Definition driver.hh:386
Gecode::Options::_r_base
Driver::DoubleOption _r_base
Restart base.
Definition driver.hh:394
Gecode::Options::_symmetry
Driver::StringOption _symmetry
General symmetry options.
Definition driver.hh:371
Gecode::Options::_out_file
Driver::StringValueOption _out_file
Where to print solutions.
Definition driver.hh:408
Gecode::Options::_node
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Definition driver.hh:388
Gecode::Options::_samples
Driver::UnsignedIntOption _samples
How many samples.
Definition driver.hh:405
Gecode::Options::_fail
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Definition driver.hh:389
Gecode::Options::threads
void threads(double n)
Set number of parallel threads.
Definition options.hpp:292
Gecode::SizeOptions::size
unsigned int size(void) const
Return size.
Definition options.hpp:590
Gecode::SizeOptions::help
virtual void help(void)
Print help text.
Definition options.cpp:667
Gecode::SizeOptions::SizeOptions
SizeOptions(const char *s)
Initialize options for script with name s.
Definition options.cpp:663
Gecode::SizeOptions::_size
unsigned int _size
Size value.
Definition driver.hh:677
Gecode::SizeOptions::parse
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc).
Definition options.cpp:674
Gecode::Support::Thread::npu
static unsigned int npu(void)
Return number of processing units (1 if information not available).
Definition none.hpp:76
driver.hh
Gecode::heap
Heap heap
The single global heap.
Definition heap.cpp:44
Gecode::SM_STAT
@ SM_STAT
Print statistics for script.
Definition driver.hh:97
Gecode::SM_SOLUTION
@ SM_SOLUTION
Print solution and some statistics.
Definition driver.hh:95
Gecode::SM_GIST
@ SM_GIST
Run script in Gist.
Definition driver.hh:98
Gecode::SM_CPPROFILER
@ SM_CPPROFILER
Run script with CP-profiler.
Definition driver.hh:99
Gecode::SM_TIME
@ SM_TIME
Measure average runtime.
Definition driver.hh:96
Gecode::RM_CONSTANT
@ RM_CONSTANT
Restart with constant sequence.
Definition driver.hh:108
Gecode::RM_LINEAR
@ RM_LINEAR
Restart with linear sequence.
Definition driver.hh:109
Gecode::RM_LUBY
@ RM_LUBY
Restart with Luby sequence.
Definition driver.hh:110
Gecode::RM_NONE
@ RM_NONE
No restarts.
Definition driver.hh:107
Gecode::RM_GEOMETRIC
@ RM_GEOMETRIC
Restart with geometric sequence.
Definition driver.hh:111
Gecode::IntPropLevel
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
Gecode::IPL_BASIC
@ IPL_BASIC
Use basic propagation algorithm.
Definition int.hh:981
Gecode::IPL_DOM
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Definition int.hh:979
Gecode::IPL_VAL
@ IPL_VAL
Value propagation.
Definition int.hh:977
Gecode::IPL_ADVANCED
@ IPL_ADVANCED
Use advanced propagation algorithm.
Definition int.hh:982
Gecode::IPL_DEF
@ IPL_DEF
Simple propagation levels.
Definition int.hh:976
Gecode::IPL_BND
@ IPL_BND
Bounds propagation.
Definition int.hh:978
Gecode::TE_INIT
@ TE_INIT
Trace init events.
Definition recorder.hpp:43
Gecode::TE_POST
@ TE_POST
Trace propagator posting.
Definition recorder.hpp:52
Gecode::TE_COMMIT
@ TE_COMMIT
Trace commit operations by branchers.
Definition recorder.hpp:51
Gecode::TE_PRUNE
@ TE_PRUNE
Trace prune events.
Definition recorder.hpp:44
Gecode::TE_PROPAGATE
@ TE_PROPAGATE
Trace propagator executions.
Definition recorder.hpp:50
Gecode::TE_FIX
@ TE_FIX
Trace fixpoint events.
Definition recorder.hpp:45
Gecode::TE_FAIL
@ TE_FAIL
Trace fail events.
Definition recorder.hpp:46
Gecode::TE_DONE
@ TE_DONE
Trace done events.
Definition recorder.hpp:47
Gecode::Driver
Script commandline driver.
Gecode::Search
Search engines
Gecode
Gecode toplevel namespace
Gecode::vbd
IntPropLevel vbd(IntPropLevel ipl)
Extract value, bounds, or domain propagation from propagation level.
Definition ipl.hpp:37
std
Definition flatzinc.cpp:52
GECODE_VERSION
#define GECODE_VERSION
Definition config.hpp:107
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56