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" 132 char* argument(
int argc,
char* argv[])
const;
138 virtual int parse(
int argc,
char* argv[]) = 0;
140 virtual void help(
void) = 0;
144 static char* strdup(
const char* s);
146 static char* stredup(
const char* s);
148 static void strdel(
const char* s);
162 void value(
const char*
v);
164 const char* value(
void)
const;
166 virtual int parse(
int argc,
char* argv[]);
168 virtual void help(
void);
197 int value(
void)
const;
199 void add(
int v,
const char* o,
const char* h = NULL);
201 virtual int parse(
int argc,
char* argv[]);
203 virtual void help(
void);
218 IntOption(
const char* o,
const char* e,
int v=0);
222 int value(
void)
const;
224 virtual int parse(
int argc,
char* argv[]);
226 virtual void help(
void);
240 void value(
unsigned int v);
242 unsigned int value(
void)
const;
244 virtual int parse(
int argc,
char* argv[]);
246 virtual void help(
void);
260 void value(
double v);
262 double value(
void)
const;
264 virtual int parse(
int argc,
char* argv[]);
266 virtual void help(
void);
278 BoolOption(
const char* o,
const char* e,
bool v=
false);
282 bool value(
void)
const;
284 virtual int parse(
int argc,
char* argv[]);
286 virtual void help(
void);
304 virtual int parse(
int argc,
char* argv[]);
306 virtual void help(
void);
322 int value(
void)
const;
324 virtual int parse(
int argc,
char* argv[]);
326 virtual void help(
void);
344 virtual void help(
void);
355 void parse(
int& argc,
char* argv[]);
358 const char* name(
void)
const;
360 void name(
const char*);
416 #ifdef GECODE_HAS_CPPROFILER 433 void model(
int v,
const char* o,
const char* h = NULL);
435 int model(
void)
const;
438 void symmetry(
int v);
440 void symmetry(
int v,
const char* o,
const char* h = NULL);
442 int symmetry(
void)
const;
445 void propagation(
int v);
447 void propagation(
int v,
const char* o,
const char* h = NULL);
449 int propagation(
void)
const;
457 void branching(
int v);
459 void branching(
int v,
const char* o,
const char* h = NULL);
461 int branching(
void)
const;
464 void decay(
double d);
466 double decay(
void)
const;
469 void seed(
unsigned int s);
471 unsigned int seed(
void)
const;
476 double step(
void)
const;
484 void search(
int v,
const char* o,
const char* h = NULL);
486 int search(
void)
const;
499 void c_d(
unsigned int d);
501 unsigned int c_d(
void)
const;
504 void a_d(
unsigned int d);
506 unsigned int a_d(
void)
const;
509 void d_l(
unsigned int d);
511 unsigned int d_l(
void)
const;
514 void node(
unsigned int n);
516 unsigned int node(
void)
const;
519 void fail(
unsigned int n);
521 unsigned int fail(
void)
const;
524 void time(
unsigned int t);
526 unsigned int time(
void)
const;
529 void assets(
unsigned int n);
531 unsigned int assets(
void)
const;
534 void slice(
unsigned int n);
536 unsigned int slice(
void)
const;
544 void restart_base(
double base);
546 double restart_base(
void)
const;
549 void restart_scale(
unsigned int scale);
551 unsigned int restart_scale(
void)
const;
554 void nogoods(
bool b);
556 bool nogoods(
void)
const;
566 double relax(
void)
const;
569 void interrupt(
bool b);
571 bool interrupt(
void)
const;
582 void samples(
unsigned int s);
584 unsigned int samples(
void)
const;
587 void iterations(
unsigned int i);
589 unsigned int iterations(
void)
const;
592 void print_last(
bool p);
594 bool print_last(
void)
const;
597 void out_file(
const char*
f);
599 const char* out_file(
void)
const;
602 void log_file(
const char*
f);
604 const char* log_file(
void)
const;
609 int trace(
void)
const;
611 #ifdef GECODE_HAS_CPPROFILER 612 void profiler_id(
int i);
615 int profiler_id(
void)
const;
617 void profiler_port(
unsigned int p);
619 unsigned int profiler_port(
void)
const;
621 void profiler_info(
bool b);
623 bool profiler_info(
void)
const;
627 #ifdef GECODE_HAS_GIST 634 unsigned int n_click;
638 unsigned int n_solution;
646 unsigned int n_compare;
686 virtual void help(
void);
688 void parse(
int& argc,
char* argv[]);
691 void size(
unsigned int s);
693 unsigned int size(
void)
const;
707 virtual void help(
void);
709 void parse(
int& argc,
char* argv[]);
712 void instance(
const char* s);
714 const char* instance(
void)
const;
723 namespace Gecode {
namespace Driver {
732 template<
class BaseSpace>
740 virtual void print(std::ostream& os)
const;
742 virtual void compare(
const Space& home, std::ostream& os)
const;
744 static std::ostream& select_ostream(
const char* sn, std::ofstream& ofs);
754 template<
class Script,
template<
class>
class Engine,
class Options>
757 template<
class Script,
template<
class>
class Engine,
class Options,
758 template<
class,
template<
class>
class>
class Meta>
759 static void runMeta(const Options&
opt,
Script* s);
762 #ifdef GECODE_HAS_FLOAT_VARS 765 template<
class BaseSpace>
770 : BaseSpace(opt.
step()) {}
779 template<
class BaseSpace>
833 #ifdef GECODE_HAS_FLOAT_VARS 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
Helper class storing Gist inspectors.
Driver::UnsignedIntOption _iterations
How many iterations per sample.
Driver::DoubleOption _decay
Decay option.
unsigned int cur
Current value.
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.
GECODE_FLATZINC_EXPORT FlatZincSpace * parse(const std::string &fileName, Printer &p, std::ostream &err=std::cerr, FlatZincSpace *fzs=NULL, Rnd &rnd=defrnd)
Parse FlatZinc file fileName into fzs and return it.
Driver::StringOption _restart
Restart method option.
Driver::BoolOption _nogoods
Whether to use no-goods.
Class to ignore the step option value.
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Value * lst
Last option value.
Driver::UnsignedIntOption _profiler_port
Connect to this port.
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.
Driver::DoubleOption _r_base
Restart base.
Driver::ScriptBase< Driver::ExtractStepOption< FloatMaximizeSpace > > FloatMaximizeScript
Base-class for scripts for finding solution of highest float cost.
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
RestartMode
Different modes for restart-based search.
Abstract base class for inspectors.
Parametric base-class for scripts.
const char * iopt
String for option (including hyphen)
const char * eopt
String for option (excluding hyphen)
Driver::StringOption _model
General model options.
unsigned int _size
Size value.
Integer propagation level option.
IgnoreStepOption(BaseSpace &e)
Constructor used for cloning.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Driver::ScriptBase< Driver::IgnoreStepOption< IntLexMaximizeSpace > > IntLexMaximizeScript
Base-class for scripts for finding solution of lexically highest integer costs.
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.
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Simple propagation levels.
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.
const unsigned int d_l
Default discrepancy limit for LDS.
#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.
Driver::DoubleOption _relax
Probability to relax variable.
Driver::ScriptBase< Driver::IgnoreStepOption< IntLexMinimizeSpace > > IntLexMinimizeScript
Base-class for scripts for finding solution of lexically lowest integer costs.
Post propagator for SetVar SetOpType SetVar SetRelType r
String-valued option (integer value defined by strings)
IntPropLevel
Propagation levels for integer propagators.
void print(std::basic_ostream< Char, Traits > &s, bool assigned, IL &lb, IU &ub, unsigned int cardMin, unsigned int cardMax)
Print set view.
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
Driver::ScriptBase< Driver::IgnoreStepOption< IntMaximizeSpace > > IntMaximizeScript
Base-class for scripts for finding solution of highest integer cost.
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
const double base
Base for geometric restart sequence.
Print statistics for script.
Run script with CP-profiler.
Options for scripts with additional instance parameter
Driver::TraceOption _trace
Trace flags for tracing.
Restart with geometric sequence.
Driver::StringValueOption _out_file
Where to print solutions.
Driver::BaseOption * fst
First registered option.
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
const char * _inst
Instance string.
Driver::UnsignedIntOption _solutions
How many solutions.
Driver::StringOption _branching
Branching options.
IntPropLevel cur
Current value.
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)
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
CompareStatus compare(I &i, J &j)
Check whether range iterator i is a subset of j, or whether they are disjoint.
Driver::IplOption _ipl
Integer propagation 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.
const unsigned int slice
Size of a slice in a portfolio and scale factor for restarts(in number of failures) ...
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.
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
virtual void help(void)
Print help text.