38 #ifndef __GECODE_DRIVER_HH__
39 #define __GECODE_DRIVER_HH__
43 #ifdef GECODE_HAS_GIST
51 #if !defined(GECODE_STATIC_LIBS) && \
52 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
54 #ifdef GECODE_BUILD_DRIVER
55 #define GECODE_DRIVER_EXPORT __declspec( dllexport )
57 #define GECODE_DRIVER_EXPORT __declspec( dllimport )
62 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
63 #define GECODE_DRIVER_EXPORT __attribute__ ((visibility("default")))
65 #define GECODE_DRIVER_EXPORT
71 #ifndef GECODE_BUILD_DRIVER
72 #define GECODE_LIBRARY_NAME "Driver"
130 char* argument(
int argc,
char* argv[])
const;
136 virtual int parse(
int argc,
char* argv[]) = 0;
138 virtual void help(
void) = 0;
142 static char* strdup(
const char* s);
144 static void strdel(
const char* s);
158 void value(
const char*
v);
160 const char* value(
void)
const;
162 virtual int parse(
int argc,
char* argv[]);
164 virtual void help(
void);
193 int value(
void)
const;
195 void add(
int v,
const char* o,
const char* h = NULL);
197 virtual int parse(
int argc,
char* argv[]);
199 virtual void help(
void);
214 IntOption(
const char* o,
const char* e,
int v=0);
218 int value(
void)
const;
220 virtual int parse(
int argc,
char* argv[]);
222 virtual void help(
void);
236 void value(
unsigned int v);
238 unsigned int value(
void)
const;
240 virtual int parse(
int argc,
char* argv[]);
242 virtual void help(
void);
256 void value(
double v);
258 double value(
void)
const;
260 virtual int parse(
int argc,
char* argv[]);
262 virtual void help(
void);
274 BoolOption(
const char* o,
const char* e,
bool v=
false);
278 bool value(
void)
const;
280 virtual int parse(
int argc,
char* argv[]);
282 virtual void help(
void);
300 virtual void help(
void);
311 void parse(
int& argc,
char* argv[]);
314 const char* name(
void)
const;
316 void name(
const char*);
375 void model(
int v,
const char* o,
const char* h = NULL);
377 int model(
void)
const;
380 void symmetry(
int v);
382 void symmetry(
int v,
const char* o,
const char* h = NULL);
384 int symmetry(
void)
const;
387 void propagation(
int v);
389 void propagation(
int v,
const char* o,
const char* h = NULL);
391 int propagation(
void)
const;
399 void branching(
int v);
401 void branching(
int v,
const char* o,
const char* h = NULL);
403 int branching(
void)
const;
406 void decay(
double d);
408 double decay(
void)
const;
416 void search(
int v,
const char* o,
const char* h = NULL);
418 int search(
void)
const;
431 void c_d(
unsigned int d);
433 unsigned int c_d(
void)
const;
436 void a_d(
unsigned int d);
438 unsigned int a_d(
void)
const;
441 void node(
unsigned int n);
443 unsigned int node(
void)
const;
446 void fail(
unsigned int n);
448 unsigned int fail(
void)
const;
451 void time(
unsigned int t);
453 unsigned int time(
void)
const;
461 void restart_base(
double base);
463 double restart_base(
void)
const;
466 void restart_scale(
unsigned int scale);
468 unsigned int restart_scale(
void)
const;
471 void nogoods(
bool b);
473 bool nogoods(
void)
const;
481 void interrupt(
bool b);
483 bool interrupt(
void)
const;
494 void samples(
unsigned int s);
496 unsigned int samples(
void)
const;
499 void iterations(
unsigned int i);
501 unsigned int iterations(
void)
const;
504 void print_last(
bool p);
506 bool print_last(
void)
const;
509 void out_file(
const char* f);
511 const char* out_file(
void)
const;
514 void log_file(
const char* f);
516 const char* log_file(
void)
const;
519 #ifdef GECODE_HAS_GIST
526 unsigned int n_click;
530 unsigned int n_solution;
538 unsigned int n_compare;
574 virtual void help(
void);
576 void parse(
int& argc,
char* argv[]);
579 void size(
unsigned int s);
581 unsigned int size(
void)
const;
595 virtual void help(
void);
597 void parse(
int& argc,
char* argv[]);
600 void instance(
const char* s);
602 const char* instance(
void)
const;
621 template<
class BaseSpace>
628 : BaseSpace(share,e) {}
630 virtual void print(std::ostream& os)
const { (void) os; }
636 static std::ostream&
select_ostream(
const char* name, std::ofstream& ofs);
646 template<
class Script,
template<
class>
class Engine,
class Options>
649 template<
class Script,
template<
class>
class Engine,
class Options,
650 template<
template<
class>
class,
class>
class Meta>
651 static void runMeta(const Options&
opt,
Script* s);
688 #ifdef GECODE_HAS_FLOAT_VARS
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Restart with linear sequence.
Driver::BoolOption _interrupt
Whether to catch SIGINT.
virtual void compare(const Space &, std::ostream &os) const
Compare with s.
Options for scripts with additional size parameter
Driver::UnsignedIntOption _iterations
How many iterations per sample.
IntConLevel
Consistency levels for integer propagators.
Driver::ScriptBase< FloatMinimizeSpace > FloatMinimizeScript
Base-class for scripts for finding solution of lowest float cost.
Driver::DoubleOption _decay
Decay option.
unsigned int cur
Current value.
ScriptMode
Different modes for executing scripts.
const char * exp
Short explanation.
Value * next
Next option value.
const char * opt
String for option value.
Abstract base class for comparators.
Driver::DoubleOption _threads
How many threads to use.
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
Driver::StringOption _restart
Restart method option.
Driver::BoolOption _nogoods
Whether to use no-goods.
Driver::ScriptBase< Space > Script
Base-class for scripts.
Driver::ScriptBase< MinimizeSpace > MinimizeScript
Base-class for scripts for finding solution of lowest integer cost.
Value * lst
Last option value.
Array with arbitrary number of elements.
Restart with Luby sequence.
Driver::DoubleOption _r_base
Restart base.
RestartMode
Different modes for restart-based search.
Abstract base class for inspectors.
Driver::ScriptBase< MaximizeSpace > MaximizeScript
Base-class for scripts for finding solution of highest integer cost.
Parametric base-class for scripts.
GECODE_FLATZINC_EXPORT FlatZincSpace * parse(const std::string &fileName, Printer &p, std::ostream &err=std::cerr, FlatZincSpace *fzs=NULL, FznRnd *rnd=NULL)
Parse FlatZinc file fileName into fzs and return it.
static std::ostream & select_ostream(const char *name, std::ofstream &ofs)
Choose output stream according to name.
Driver::StringOption _model
General model options.
unsigned int _size
Size value.
int p
Number of positive literals for node type.
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::ScriptBase< FloatMaximizeSpace > FloatMaximizeScript
Base-class for scripts for finding solution of highest float cost.
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.
Driver::StringOption _propagation
Propagation options.
Base class for script options.
const char * _name
Script name.
unsigned int size(I &i)
Size of all ranges of range iterator i.
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.
#define GECODE_DRIVER_EXPORT
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.
String-valued option (integer value defined by strings)
Print statistics for script.
Options for scripts with additional instance parameter
ScriptBase(bool share, ScriptBase &e)
Constructor used for cloning.
Restart with geometric sequence.
const char * opt
String for option (including hyphen)
Driver::StringValueOption _out_file
Where to print solutions.
Driver::BaseOption * fst
First registered option.
virtual void print(std::ostream &os) const
Print a solution to os.
const char * _inst
Instance string.
Driver::UnsignedIntOption _solutions
How many solutions.
Driver::StringOption _branching
Branching options.
const char * cur
Current value.
Driver::BaseOption * lst
Last registered option.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
static void run(const Options &opt, Script *s=NULL)
CompareStatus compare(I &i, J &j)
Check whether range iterator i is a subset of j, or whether they are disjoint.
Driver::StringOption _icl
Integer consistency level.
Driver::ScriptBase< IntMaximizeSpace > IntMaximizeScript
Base-class for scripts for finding solution of highest integer cost.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Driver::ScriptBase< IntMinimizeSpace > IntMinimizeScript
Base-class for scripts for finding solution of lowest integer cost.
Restart with constant sequence.
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
int solutions(TestSpace *c, Gecode::Search::Options &o, int maxNbSol=-1)
Find number of solutions.
ScriptBase(void)
Default constructor.
virtual void help(void)
Print help text.