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*);
377 void model(
int v,
const char* o,
const char* h = NULL);
379 int model(
void)
const;
382 void symmetry(
int v);
384 void symmetry(
int v,
const char* o,
const char* h = NULL);
386 int symmetry(
void)
const;
389 void propagation(
int v);
391 void propagation(
int v,
const char* o,
const char* h = NULL);
393 int propagation(
void)
const;
401 void branching(
int v);
403 void branching(
int v,
const char* o,
const char* h = NULL);
405 int branching(
void)
const;
408 void decay(
double d);
410 double decay(
void)
const;
413 void seed(
unsigned int s);
415 unsigned int seed(
void)
const;
420 double step(
void)
const;
428 void search(
int v,
const char* o,
const char* h = NULL);
430 int search(
void)
const;
443 void c_d(
unsigned int d);
445 unsigned int c_d(
void)
const;
448 void a_d(
unsigned int d);
450 unsigned int a_d(
void)
const;
453 void node(
unsigned int n);
455 unsigned int node(
void)
const;
458 void fail(
unsigned int n);
460 unsigned int fail(
void)
const;
463 void time(
unsigned int t);
465 unsigned int time(
void)
const;
473 void restart_base(
double base);
475 double restart_base(
void)
const;
478 void restart_scale(
unsigned int scale);
480 unsigned int restart_scale(
void)
const;
483 void nogoods(
bool b);
485 bool nogoods(
void)
const;
493 void interrupt(
bool b);
495 bool interrupt(
void)
const;
506 void samples(
unsigned int s);
508 unsigned int samples(
void)
const;
511 void iterations(
unsigned int i);
513 unsigned int iterations(
void)
const;
516 void print_last(
bool p);
518 bool print_last(
void)
const;
521 void out_file(
const char* f);
523 const char* out_file(
void)
const;
526 void log_file(
const char* f);
528 const char* log_file(
void)
const;
531 #ifdef GECODE_HAS_GIST
538 unsigned int n_click;
542 unsigned int n_solution;
550 unsigned int n_compare;
586 virtual void help(
void);
588 void parse(
int& argc,
char* argv[]);
591 void size(
unsigned int s);
593 unsigned int size(
void)
const;
607 virtual void help(
void);
609 void parse(
int& argc,
char* argv[]);
612 void instance(
const char* s);
614 const char* instance(
void)
const;
623 namespace Gecode {
namespace Driver {
632 template<
class BaseSpace>
640 virtual void print(std::ostream& os)
const;
642 virtual void compare(
const Space& home, std::ostream& os)
const;
644 static std::ostream&
select_ostream(
const char* name, std::ofstream& ofs);
654 template<
class Script,
template<
class>
class Engine,
class Options>
657 template<
class Script,
template<
class>
class Engine,
class Options,
658 template<
template<
class>
class,
class>
class Meta>
659 static void runMeta(const Options&
opt,
Script* s);
664 #ifdef GECODE_HAS_FLOAT_VARS
667 template<
class BaseSpace>
672 : BaseSpace(opt.
step()) {}
675 : BaseSpace(share,e) {}
681 template<
class BaseSpace>
688 : BaseSpace(share,e) {}
707 typedef Driver::ScriptBase<Driver::IgnoreStepOption<Space> >
734 #ifdef GECODE_HAS_FLOAT_VARS
Driver::ScriptBase< Driver::IgnoreStepOption< MaximizeSpace > > MaximizeScript
Base-class for scripts for finding solution of highest integer cost.
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Restart with linear sequence.
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Options for scripts with additional size parameter
const Gecode::FloatNum step
Driver::ScriptBase< Driver::IgnoreStepOption< MinimizeSpace > > MinimizeScript
Base-class for scripts for finding solution of lowest integer cost.
Driver::UnsignedIntOption _iterations
How many iterations per sample.
IntConLevel
Consistency levels for integer propagators.
Driver::DoubleOption _decay
Decay option.
unsigned int cur
Current value.
static std::ostream & select_ostream(const char *name, std::ofstream &ofs)
Choose output stream according to name.
Driver::DoubleOption _step
Step option.
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.
Class to ignore the step option value.
Value * lst
Last option value.
Array with arbitrary number of elements.
Restart with Luby sequence.
Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > > IntMinimizeScript
Base-class for scripts for finding solution of lowest integer cost.
IgnoreStepOption(bool share, BaseSpace &e)
Constructor used for cloning.
Driver::DoubleOption _r_base
Restart base.
Driver::ScriptBase< Driver::ExtractStepOption< FloatMaximizeSpace > > FloatMaximizeScript
Base-class for scripts for finding solution of highest float cost.
virtual void compare(const Space &home, std::ostream &os) const
Compare with s.
RestartMode
Different modes for restart-based search.
Abstract base class for inspectors.
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.
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::ScriptBase< Driver::ExtractStepOption< FloatMinimizeSpace > > FloatMinimizeScript
Base-class for scripts for finding solution of lowest float cost.
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.
Driver::StringOption _propagation
Propagation options.
Base class for script options.
virtual void print(std::ostream &os) const
Print a solution to os.
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)
struct Gecode::@519::NNF::@60::@61 b
For binary nodes (and, or, eqv)
Driver::ScriptBase< Driver::IgnoreStepOption< IntMaximizeSpace > > IntMaximizeScript
Base-class for scripts for finding solution of highest integer cost.
Print statistics for script.
Options for scripts with additional instance parameter
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.
static void run(const Options &opt, Script *s=NULL)
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.
ScriptBase(const Options &opt)
Constructor.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
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.
Gecode toplevel namespace
Driver::UnsignedIntOption _seed
Seed option.
IgnoreStepOption(const Options &)
Constructor.
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Restart with constant sequence.
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Driver::ScriptBase< Driver::IgnoreStepOption< Space > > Script
Base-class for scripts.
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
int solutions(TestSpace *c, Gecode::Search::Options &o, int maxNbSol=-1)
Find number of solutions.
virtual void help(void)
Print help text.