34#ifndef __GECODE_DRIVER_HH__
35#define __GECODE_DRIVER_HH__
47#if !defined(GECODE_STATIC_LIBS) && \
48 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
50#ifdef GECODE_BUILD_DRIVER
51#define GECODE_DRIVER_EXPORT __declspec( dllexport )
53#define GECODE_DRIVER_EXPORT __declspec( dllimport )
58#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
59#define GECODE_DRIVER_EXPORT __attribute__ ((visibility("default")))
61#define GECODE_DRIVER_EXPORT
67#ifndef GECODE_BUILD_DRIVER
68#define GECODE_LIBRARY_NAME "Driver"
129 char* argument(
int argc,
char* argv[])
const;
134 virtual int parse(
int argc,
char* argv[]) = 0;
140 static char* strdup(
const char* s);
142 static char* stredup(
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 int parse(
int argc,
char* argv[]);
302 virtual void help(
void);
318 int value(
void)
const;
320 virtual int parse(
int argc,
char* argv[]);
322 virtual void help(
void);
340 virtual void help(
void);
351 void parse(
int& argc,
char* argv[]);
354 const char* name(
void)
const;
356 void name(
const char*);
412#ifdef GECODE_HAS_CPPROFILER
429 void model(
int v,
const char* o,
const char* h = NULL);
431 int model(
void)
const;
434 void symmetry(
int v);
436 void symmetry(
int v,
const char* o,
const char* h = NULL);
438 int symmetry(
void)
const;
441 void propagation(
int v);
443 void propagation(
int v,
const char* o,
const char* h = NULL);
445 int propagation(
void)
const;
453 void branching(
int v);
455 void branching(
int v,
const char* o,
const char* h = NULL);
457 int branching(
void)
const;
460 void decay(
double d);
462 double decay(
void)
const;
465 void seed(
unsigned int s);
467 unsigned int seed(
void)
const;
472 double step(
void)
const;
480 void search(
int v,
const char* o,
const char* h = NULL);
482 int search(
void)
const;
485 void solutions(
unsigned int n);
487 unsigned int solutions(
void)
const;
490 void threads(
double n);
492 double threads(
void)
const;
495 void c_d(
unsigned int d);
497 unsigned int c_d(
void)
const;
500 void a_d(
unsigned int d);
502 unsigned int a_d(
void)
const;
505 void d_l(
unsigned int d);
507 unsigned int d_l(
void)
const;
510 void node(
unsigned int n);
512 unsigned int node(
void)
const;
515 void fail(
unsigned int n);
517 unsigned int fail(
void)
const;
520 void time(
unsigned int t);
522 unsigned int time(
void)
const;
525 void assets(
unsigned int n);
527 unsigned int assets(
void)
const;
530 void slice(
unsigned int n);
532 unsigned int slice(
void)
const;
540 void restart_base(
double base);
542 double restart_base(
void)
const;
545 void restart_scale(
unsigned int scale);
547 unsigned int restart_scale(
void)
const;
550 void nogoods(
bool b);
552 bool nogoods(
void)
const;
555 void nogoods_limit(
unsigned int l);
557 unsigned int nogoods_limit(
void)
const;
560 void relax(
double d);
562 double relax(
void)
const;
565 void interrupt(
bool b);
567 bool interrupt(
void)
const;
578 void samples(
unsigned int s);
580 unsigned int samples(
void)
const;
583 void iterations(
unsigned int i);
585 unsigned int iterations(
void)
const;
588 void print_last(
bool p);
590 bool print_last(
void)
const;
593 void out_file(
const char* f);
595 const char* out_file(
void)
const;
598 void log_file(
const char* f);
600 const char* log_file(
void)
const;
605 int trace(
void)
const;
607#ifdef GECODE_HAS_CPPROFILER
609 void profiler_id(
int i);
611 int profiler_id(
void)
const;
613 void profiler_port(
unsigned int p);
615 unsigned int profiler_port(
void)
const;
617 void profiler_info(
bool b);
619 bool profiler_info(
void)
const;
623#ifdef GECODE_HAS_GIST
630 unsigned int n_click;
634 unsigned int n_solution;
642 unsigned int n_compare;
682 virtual void help(
void);
684 void parse(
int& argc,
char* argv[]);
687 void size(
unsigned int s);
689 unsigned int size(
void)
const;
703 virtual void help(
void);
705 void parse(
int& argc,
char* argv[]);
708 void instance(
const char* s);
710 const char* instance(
void)
const;
719namespace Gecode {
namespace Driver {
728 template<
class BaseSpace>
736 virtual void print(std::ostream& os)
const;
738 virtual void compare(
const Space& home, std::ostream& os)
const;
740 static std::ostream&
select_ostream(
const char* sn, std::ofstream& ofs);
750 template<
class Script,
template<
class>
class Engine,
class Options>
753 template<
class Script,
template<
class>
class Engine,
class Options,
754 template<
class,
template<
class>
class>
class Meta>
758#ifdef GECODE_HAS_FLOAT_VARS
761 template<
class BaseSpace>
766 : BaseSpace(opt.step()) {}
775 template<
class BaseSpace>
800 typedef Driver::ScriptBase<Driver::IgnoreStepOption<Space> >
829#ifdef GECODE_HAS_FLOAT_VARS
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
Base class for script options.
const char * _name
Script name.
Driver::BaseOption * fst
First registered option.
Driver::BaseOption * lst
Last registered option.
virtual void help(void)=0
Print help text.
const char * eopt
String for option (excluding hyphen)
const char * exp
Short explanation.
const char * iopt
String for option (including hyphen)
virtual int parse(int argc, char *argv[])=0
Parse option at first position and return number of parsed arguments.
BaseOption * next
Next option Check for option and return its argument.
Class to ignore the step option value.
IgnoreStepOption(BaseSpace &e)
Constructor used for cloning.
IgnoreStepOption(const Options &)
Constructor.
Integer propagation level option.
IntPropLevel cur
Current value.
Parametric base-class for scripts.
static void run(const Options &opt, Script *s=NULL)
virtual void compare(const Space &home, std::ostream &os) const
Compare with s.
virtual void print(std::ostream &os) const
Print a solution to os.
static std::ostream & select_ostream(const char *sn, std::ofstream &ofs)
Choose output stream according to sn.
ScriptBase(const Options &opt)
Constructor.
const char * help
Optional help text.
Value * next
Next option value.
int val
Value for an option value.
const char * opt
String for option value.
String-valued option (integer value defined by strings)
Value * lst
Last option value.
Value * fst
First option value.
const char * cur
Current value.
unsigned int cur
Current value.
Abstract base class for comparators.
Abstract base class for inspectors.
Options for scripts with additional instance parameter
const char * _inst
Instance string.
Helper class storing Gist inspectors.
Driver::DoubleOption _relax
Probability to relax variable.
Driver::StringValueOption _log_file
Where to print statistics.
Driver::StringOption _model
General model options.
Driver::StringOption _mode
Script mode to run.
Driver::DoubleOption _decay
Decay option.
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
Driver::BoolOption _nogoods
Whether to use no-goods.
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
Driver::TraceOption _trace
Trace flags for tracing.
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
Driver::UnsignedIntOption _solutions
How many solutions.
Driver::UnsignedIntOption _iterations
How many iterations per sample.
Driver::StringOption _search
Search options.
Driver::StringOption _propagation
Propagation options.
Driver::IplOption _ipl
Integer propagation level.
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
Driver::BoolOption _print_last
Print only last solution found.
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Driver::DoubleOption _threads
How many threads to use.
Driver::StringOption _branching
Branching options.
Driver::StringOption _restart
Restart method option.
Driver::UnsignedIntOption _seed
Seed option.
Driver::UnsignedIntOption _time
Cutoff for time.
Driver::DoubleOption _step
Step option.
Driver::UnsignedIntOption _profiler_port
Connect to this port.
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Driver::DoubleOption _r_base
Restart base.
Driver::StringOption _symmetry
General symmetry options.
Driver::StringValueOption _out_file
Where to print solutions.
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Driver::UnsignedIntOption _samples
How many samples.
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Options for scripts with additional size parameter
unsigned int _size
Size value.
Array with arbitrary number of elements.
#define GECODE_DRIVER_EXPORT
ScriptMode
Different modes for executing scripts.
RestartMode
Different modes for restart-based search.
@ SM_STAT
Print statistics for script.
@ SM_SOLUTION
Print solution and some statistics.
@ SM_GIST
Run script in Gist.
@ SM_CPPROFILER
Run script with CP-profiler.
@ SM_TIME
Measure average runtime.
@ RM_CONSTANT
Restart with constant sequence.
@ RM_LINEAR
Restart with linear sequence.
@ RM_LUBY
Restart with Luby sequence.
@ RM_GEOMETRIC
Restart with geometric sequence.
Driver::ScriptBase< Driver::IgnoreStepOption< IntMaximizeSpace > > IntMaximizeScript
Base-class for scripts for finding solution of highest integer cost.
Driver::ScriptBase< Driver::IgnoreStepOption< Space > > Script
Base-class for scripts.
Driver::ScriptBase< Driver::ExtractStepOption< FloatMinimizeSpace > > FloatMinimizeScript
Base-class for scripts for finding solution of lowest float cost.
Driver::ScriptBase< Driver::ExtractStepOption< FloatMaximizeSpace > > FloatMaximizeScript
Base-class for scripts for finding solution of highest float cost.
Driver::ScriptBase< Driver::IgnoreStepOption< IntLexMaximizeSpace > > IntLexMaximizeScript
Base-class for scripts for finding solution of lexically highest integer costs.
Driver::ScriptBase< Driver::IgnoreStepOption< IntLexMinimizeSpace > > IntLexMinimizeScript
Base-class for scripts for finding solution of lexically lowest integer costs.
Driver::ScriptBase< Driver::IgnoreStepOption< IntMinimizeSpace > > IntMinimizeScript
Base-class for scripts for finding solution of lowest integer cost.
GECODE_FLOAT_EXPORT void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te=(TE_INIT|TE_PRUNE|TE_FIX|TE_FAIL|TE_DONE), FloatTracer &t=StdFloatTracer::def)
Create a tracer for float variables.
IntPropLevel
Propagation levels for integer propagators.
Gecode toplevel namespace
GECODE_FLOAT_EXPORT void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)