script.hpp
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 <iostream>
#include <iomanip>
#include <fstream>
#include <cstring>
#ifndef GECODE_THREADS_WINDOWS
#include <csignal>
#endif
namespace Gecode { namespace Driver {
class CombinedStop : public Search::Stop {
private:
Search::NodeStop* ns;
Search::FailStop* fs;
Search::TimeStop* ts;
GECODE_DRIVER_EXPORT
static bool sigint;
CombinedStop(unsigned int node, unsigned int fail, unsigned int time)
: ns((node > 0) ? new Search::NodeStop(node) : NULL),
fs((fail > 0) ? new Search::FailStop(fail) : NULL),
ts((time > 0) ? new Search::TimeStop(time) : NULL) {
sigint = false;
}
public:
enum {
SR_NODE = 1 << 0,
SR_FAIL = 1 << 1,
SR_TIME = 1 << 2,
SR_INT = 1 << 3
};
virtual bool stop(const Search::Statistics& s, const Search::Options& o) {
return
sigint ||
((ns != NULL) && ns->stop(s,o)) ||
((fs != NULL) && fs->stop(s,o)) ||
((ts != NULL) && ts->stop(s,o));
}
int reason(const Search::Statistics& s, const Search::Options& o) {
return
(((ns != NULL) && ns->stop(s,o)) ? SR_NODE : 0) |
(((fs != NULL) && fs->stop(s,o)) ? SR_FAIL : 0) |
(((ts != NULL) && ts->stop(s,o)) ? SR_TIME : 0) |
(sigint ? SR_INT : 0);
}
static Search::Stop*
create(unsigned int node, unsigned int fail, unsigned int time,
bool intr) {
if ( (!intr) && (node == 0) && (fail == 0) && (time == 0))
return NULL;
else
return new CombinedStop(node,fail,time);
}
#ifdef GECODE_THREADS_WINDOWS
static BOOL interrupt(DWORD t) throw() {
if (t == CTRL_C_EVENT) {
sigint = true;
installCtrlHandler(false,true);
return true;
}
return false;
}
#else
static void
interrupt(int) {
sigint = true;
installCtrlHandler(false,true);
}
#endif
static void installCtrlHandler(bool install, bool force=false) {
if (force || !sigint) {
#ifdef GECODE_THREADS_WINDOWS
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) interrupt, install);
#else
std::signal(SIGINT, install ? interrupt : SIG_DFL);
#endif
}
}
~CombinedStop(void) {
delete ns; delete fs; delete ts;
}
};
GECODE_DRIVER_EXPORT void
stop(Support::Timer& t, std::ostream& os);
GECODE_DRIVER_EXPORT double
am(double t[], unsigned int n);
GECODE_DRIVER_EXPORT double
dev(double t[], unsigned int n);
template<class Options>
inline Search::Cutoff*
createCutoff(const Options& o) {
switch (o.restart()) {
case RM_NONE:
return NULL;
case RM_CONSTANT:
return Search::Cutoff::constant(o.restart_scale());
case RM_LINEAR:
return Search::Cutoff::linear(o.restart_scale());
case RM_LUBY:
return Search::Cutoff::luby(o.restart_scale());
case RM_GEOMETRIC:
return Search::Cutoff::geometric(o.restart_scale(),o.restart_base());
default: GECODE_NEVER;
}
return NULL;
}
#ifdef GECODE_HAS_GIST
template<class Engine>
class GistEngine {
public:
static void explore(Space* root, const Gist::Options& opt) {
(void) Gist::dfs(root, opt);
}
};
template<typename S>
class GistEngine<DFS<S> > {
public:
static void explore(S* root, const Gist::Options& opt) {
(void) Gist::dfs(root, opt);
}
};
template<typename S>
class GistEngine<LDS<S> > {
public:
static void explore(S* root, const Gist::Options& opt) {
(void) Gist::dfs(root, opt);
}
};
template<typename S>
class GistEngine<BAB<S> > {
public:
static void explore(S* root, const Gist::Options& opt) {
(void) Gist::bab(root, opt);
}
};
#endif
#ifdef GECODE_HAS_CPPROFILER
template<class BaseSpace>
class ScriptGetInfo : public CPProfilerSearchTracer::GetInfo {
public:
ScriptGetInfo(void);
virtual std::string getInfo(const Space& home) const;
};
#endif
template<class BaseSpace>
forceinline
ScriptBase<BaseSpace>::ScriptBase(const Options& opt)
: BaseSpace(opt) {}
template<class BaseSpace>
forceinline
ScriptBase<BaseSpace>::ScriptBase(ScriptBase& e)
: BaseSpace(e) {}
template<class BaseSpace>
void
ScriptBase<BaseSpace>::print(std::ostream&) const {}
template<class BaseSpace>
void
ScriptBase<BaseSpace>::compare(const Space&, std::ostream&) const {}
template<class BaseSpace>
std::ostream&
ScriptBase<BaseSpace>::select_ostream(const char* sn, std::ofstream& ofs) {
if (strcmp(sn, "stdout") == 0) {
return std::cout;
} else if (strcmp(sn, "stdlog") == 0) {
return std::clog;
} else if (strcmp(sn, "stderr") == 0) {
return std::cerr;
} else {
ofs.open(sn);
return ofs;
}
}
#ifdef GECODE_HAS_CPPROFILER
template<class BaseSpace>
ScriptGetInfo<BaseSpace>::ScriptGetInfo(void) {}
template<class BaseSpace>
std::string
ScriptGetInfo<BaseSpace>::getInfo(const Space& home) const {
std::stringstream ss;
if (const ScriptBase<BaseSpace>* sb
= dynamic_cast<const ScriptBase<BaseSpace>*>(&home))
sb->print(ss);
return ss.str();
}
#endif
template<class T, template<class> class E>
class EngineToMeta : public E<T> {
public:
EngineToMeta(T* s, const Search::Options& o) : E<T>(s,o) {}
};
template<class BaseSpace>
template<class Script, template<class> class Engine, class Options>
void
ScriptBase<BaseSpace>::run(const Options& o, Script* s) {
if ((o.restart() != RM_NONE) && (o.assets() > 0)) {
std::cerr << "Cannot use restarts and portfolio..." << std::endl;
exit(EXIT_FAILURE);
}
if (o.restart() != RM_NONE) {
runMeta<Script,Engine,Options,RBS>(o,s);
} else if (o.assets() > 0) {
runMeta<Script,Engine,Options,PBS>(o,s);
} else {
runMeta<Script,Engine,Options,EngineToMeta>(o,s);
}
}
template<class BaseSpace>
template<class Script, template<class> class Engine, class Options,
template<class, template<class> class> class Meta>
void
ScriptBase<BaseSpace>::runMeta(const Options& o, Script* s) {
using namespace std;
ofstream sol_file, log_file;
ostream& s_out = select_ostream(o.out_file(), sol_file);
ostream& l_out = select_ostream(o.log_file(), log_file);
Search::Options so;
try {
switch (o.mode()) {
case SM_GIST:
#ifdef GECODE_HAS_GIST
{
Gist::Print<Script> pi(o.name());
Gist::VarComparator<Script> vc(o.name());
Gist::Options opt;
opt.inspect.click(&pi);
opt.inspect.compare(&vc);
opt.clone = false;
opt.c_d = o.c_d();
opt.a_d = o.a_d();
for (unsigned int i=0; o.inspect.click(i) != NULL; i++)
opt.inspect.click(o.inspect.click(i));
for (unsigned int i=0; o.inspect.solution(i) != NULL; i++)
opt.inspect.solution(o.inspect.solution(i));
for (unsigned int i=0; o.inspect.move(i) != NULL; i++)
opt.inspect.move(o.inspect.move(i));
for (unsigned int i=0; o.inspect.compare(i) != NULL; i++)
opt.inspect.compare(o.inspect.compare(i));
if (s == NULL)
s = new Script(o);
(void) GistEngine<Engine<Script> >::explore(s, opt);
}
break;
// If Gist is not available, goto solution
#else
goto solution;
#endif
case SM_CPPROFILER:
#ifdef GECODE_HAS_CPPROFILER
{
CPProfilerSearchTracer::GetInfo* getInfo = nullptr;
if (o.profiler_info())
getInfo = new ScriptGetInfo<BaseSpace>;
so.tracer = new CPProfilerSearchTracer
(o.profiler_id(), o.name(), o.profiler_port(), getInfo);
}
/* FALL THROUGH */
#endif
case SM_SOLUTION:
#ifndef GECODE_HAS_GIST
solution:
#endif
{
l_out << o.name() << endl;
Support::Timer t;
int i = static_cast<int>(o.solutions());
t.start();
if (s == NULL)
s = new Script(o);
unsigned int n_p = PropagatorGroup::all.size(*s);
unsigned int n_b = BrancherGroup::all.size(*s);
so.threads = o.threads();
so.c_d = o.c_d();
so.a_d = o.a_d();
so.d_l = o.d_l();
so.assets = o.assets();
so.slice = o.slice();
so.stop = CombinedStop::create(o.node(),o.fail(), o.time(),
o.interrupt());
so.cutoff = createCutoff(o);
so.clone = false;
so.nogoods_limit = o.nogoods() ? o.nogoods_limit() : 0U;
if (o.interrupt())
CombinedStop::installCtrlHandler(true);
{
Meta<Script,Engine> e(s,so);
if (o.print_last()) {
Script* px = NULL;
do {
Script* ex = e.next();
if (ex == NULL) {
if (px != NULL) {
px->print(s_out);
delete px;
}
break;
} else {
delete px;
px = ex;
}
} while (--i != 0);
} else {
do {
Script* ex = e.next();
if (ex == NULL)
break;
ex->print(s_out);
delete ex;
} while (--i != 0);
}
if (o.interrupt())
CombinedStop::installCtrlHandler(false);
Search::Statistics stat = e.statistics();
s_out << endl;
if (e.stopped()) {
l_out << "Search engine stopped..." << endl
<< "\treason: ";
int r = static_cast<CombinedStop*>(so.stop)->reason(stat,so);
if (r & CombinedStop::SR_INT)
l_out << "user interrupt " << endl;
else {
if (r & CombinedStop::SR_NODE)
l_out << "node ";
if (r & CombinedStop::SR_FAIL)
l_out << "fail ";
if (r & CombinedStop::SR_TIME)
l_out << "time ";
l_out << "limit reached" << endl << endl;
}
}
l_out << "Initial" << endl
<< "\tpropagators: " << n_p << endl
<< "\tbranchers: " << n_b << endl
<< endl
<< "Summary" << endl
<< "\truntime: ";
stop(t, l_out);
l_out << endl
<< "\tsolutions: "
<< ::abs(static_cast<int>(o.solutions()) - i) << endl
<< "\tpropagations: " << stat.propagate << endl
<< "\tnodes: " << stat.node << endl
<< "\tfailures: " << stat.fail << endl
<< "\trestarts: " << stat.restart << endl
<< "\tno-goods: " << stat.nogood << endl
<< "\tpeak depth: " << stat.depth << endl
#ifdef GECODE_PEAKHEAP
<< "\tpeak memory: "
<< static_cast<int>((heap.peak()+1023) / 1024) << " KB"
<< endl
#endif
<< endl;
}
delete so.stop;
delete so.tracer;
}
break;
case SM_STAT:
{
l_out << o.name() << endl;
Support::Timer t;
int i = static_cast<int>(o.solutions());
t.start();
if (s == NULL)
s = new Script(o);
unsigned int n_p = PropagatorGroup::all.size(*s);
unsigned int n_b = BrancherGroup::all.size(*s);
so.clone = false;
so.threads = o.threads();
so.assets = o.assets();
so.slice = o.slice();
so.c_d = o.c_d();
so.a_d = o.a_d();
so.d_l = o.d_l();
so.stop = CombinedStop::create(o.node(),o.fail(), o.time(),
o.interrupt());
so.cutoff = createCutoff(o);
so.nogoods_limit = o.nogoods() ? o.nogoods_limit() : 0U;
if (o.interrupt())
CombinedStop::installCtrlHandler(true);
{
Meta<Script,Engine> e(s,so);
do {
Script* ex = e.next();
if (ex == NULL)
break;
delete ex;
} while (--i != 0);
if (o.interrupt())
CombinedStop::installCtrlHandler(false);
Search::Statistics stat = e.statistics();
l_out << endl
<< "\tpropagators: " << n_p << endl
<< "\tbranchers: " << n_b << endl
<< "\truntime: ";
stop(t, l_out);
l_out << endl
<< "\tsolutions: "
<< ::abs(static_cast<int>(o.solutions()) - i) << endl
<< "\tpropagations: " << stat.propagate << endl
<< "\tnodes: " << stat.node << endl
<< "\tfailures: " << stat.fail << endl
<< "\trestarts: " << stat.restart << endl
<< "\tno-goods: " << stat.nogood << endl
<< "\tpeak depth: " << stat.depth << endl
#ifdef GECODE_PEAKHEAP
<< "\tpeak memory: "
<< static_cast<int>((heap.peak()+1023) / 1024) << " KB"
<< endl
#endif
<< endl;
}
delete so.stop;
}
break;
case SM_TIME:
{
l_out << o.name() << endl;
Support::Timer t;
double* ts = new double[o.samples()];
bool stopped = false;
for (unsigned int ns = o.samples(); !stopped && ns--; ) {
t.start();
for (unsigned int k = o.iterations(); !stopped && k--; ) {
unsigned int i = o.solutions();
Script* s1 = new Script(o);
Search::Options sok;
sok.clone = false;
sok.threads = o.threads();
sok.assets = o.assets();
sok.slice = o.slice();
sok.c_d = o.c_d();
sok.a_d = o.a_d();
sok.d_l = o.d_l();
sok.stop = CombinedStop::create(o.node(),o.fail(), o.time(),
false);
sok.cutoff = createCutoff(o);
sok.nogoods_limit = o.nogoods() ? o.nogoods_limit() : 0U;
{
Meta<Script,Engine> e(s1,sok);
do {
Script* ex = e.next();
if (ex == NULL)
break;
delete ex;
} while (--i != 0);
if (e.stopped())
stopped = true;
}
delete sok.stop;
}
ts[ns] = t.stop() / o.iterations();
}
if (stopped) {
l_out << "\tSTOPPED" << endl;
} else {
double m = am(ts,o.samples());
double d = dev(ts,o.samples()) * 100.0;
l_out << "\truntime: "
<< setw(20) << right
<< showpoint << fixed
<< setprecision(6) << m << "ms"
<< setprecision(2) << " (" << d << "% deviation)"
<< endl;
}
delete [] ts;
}
break;
}
} catch (Exception& e) {
cerr << "Exception: " << e.what() << "." << endl
<< "Stopping..." << endl;
if (sol_file.is_open())
sol_file.close();
if (log_file.is_open())
log_file.close();
exit(EXIT_FAILURE);
}
if (sol_file.is_open())
sol_file.close();
if (log_file.is_open())
log_file.close();
}
}}
// STATISTICS: driver-any
Gecode::BAB
Depth-first branch-and-bound search engine.
Definition search.hh:1070
Gecode::CPProfilerSearchTracer::GetInfo
Class to send solution information to CPProfiler.
Definition search.hh:423
Gecode::CPProfilerSearchTracer
Class to record search trace info for CPProfiler.
Definition search.hh:420
Gecode::DFS
Depth-first search engine.
Definition search.hh:1036
Gecode::Driver::CombinedStop::~CombinedStop
~CombinedStop(void)
Destructor.
Definition script.hpp:126
Gecode::Driver::CombinedStop::installCtrlHandler
static void installCtrlHandler(bool install, bool force=false)
Install handler for catching Ctrl-C.
Definition script.hpp:116
Gecode::Driver::CombinedStop::stop
virtual bool stop(const Search::Statistics &s, const Search::Options &o)
Test whether search must be stopped.
Definition script.hpp:73
Gecode::Driver::CombinedStop::create
static Search::Stop * create(unsigned int node, unsigned int fail, unsigned int time, bool intr)
Create appropriate stop-object.
Definition script.hpp:90
Gecode::Driver::CombinedStop::interrupt
static void interrupt(int)
Handler for catching Ctrl-C.
Definition script.hpp:110
Gecode::Driver::CombinedStop::SR_INT
@ SR_INT
Interrupted by user.
Definition script.hpp:70
Gecode::Driver::CombinedStop::SR_NODE
@ SR_NODE
Node limit reached.
Definition script.hpp:67
Gecode::Driver::CombinedStop::SR_FAIL
@ SR_FAIL
Fail limit reached.
Definition script.hpp:68
Gecode::Driver::CombinedStop::SR_TIME
@ SR_TIME
Time limit reached.
Definition script.hpp:69
Gecode::Driver::CombinedStop::reason
int reason(const Search::Statistics &s, const Search::Options &o)
Report reason why search has been stopped.
Definition script.hpp:81
Gecode::Driver::EngineToMeta::EngineToMeta
EngineToMeta(T *s, const Search::Options &o)
Definition script.hpp:284
Gecode::Driver::GistEngine< BAB< S > >::explore
static void explore(S *root, const Gist::Options &opt)
Definition script.hpp:206
Gecode::Driver::GistEngine< DFS< S > >::explore
static void explore(S *root, const Gist::Options &opt)
Definition script.hpp:188
Gecode::Driver::GistEngine< LDS< S > >::explore
static void explore(S *root, const Gist::Options &opt)
Definition script.hpp:197
Gecode::Driver::GistEngine
Traits class for search engines.
Definition script.hpp:177
Gecode::Driver::GistEngine::explore
static void explore(Space *root, const Gist::Options &opt)
Definition script.hpp:179
Gecode::Driver::ScriptBase
Parametric base-class for scripts.
Definition driver.hh:729
Gecode::Driver::ScriptBase::run
static void run(const Options &opt, Script *s=NULL)
Definition script.hpp:290
Gecode::Driver::ScriptBase::compare
virtual void compare(const Space &home, std::ostream &os) const
Compare with s.
Definition script.hpp:243
Gecode::Driver::ScriptBase::print
virtual void print(std::ostream &os) const
Print a solution to os.
Definition script.hpp:239
Gecode::Driver::ScriptBase::select_ostream
static std::ostream & select_ostream(const char *sn, std::ofstream &ofs)
Choose output stream according to sn.
Definition script.hpp:247
Gecode::Driver::ScriptBase::ScriptBase
ScriptBase(const Options &opt)
Constructor.
Definition script.hpp:229
Gecode::Driver::ScriptGetInfo::ScriptGetInfo
ScriptGetInfo(void)
Initialize.
Definition script.hpp:263
Gecode::Driver::ScriptGetInfo::getInfo
virtual std::string getInfo(const Space &home) const
Return info for a space (which must be a script).
Definition script.hpp:267
Gecode::Gist::Options
Options for Gist
Definition gist.hh:234
Gecode::Gist::Print
An inspector for printing simple text output.
Definition gist.hh:188
Gecode::Gist::VarComparator
A simple comparator.
Definition gist.hh:211
Gecode::LDS
Limited discrepancy search engine.
Definition search.hh:1108
Gecode::Options
Options for scripts
Definition driver.hh:366
Gecode::Options::restart
void restart(RestartMode r)
Set default restart mode.
Definition options.hpp:373
Gecode::Options::assets
void assets(unsigned int n)
Set default number of assets in a portfolio.
Definition options.hpp:355
Gecode::Options::restart_scale
void restart_scale(unsigned int scale)
Set default restart scale factor.
Definition options.hpp:391
Gecode::Options::restart_base
void restart_base(double base)
Set default restart base.
Definition options.hpp:382
Gecode::Search::Cutoff
Base class for cutoff generators for restart-based meta engine.
Definition search.hh:472
Gecode::Search::Cutoff::linear
static Cutoff * linear(unsigned long int scale=Config::slice)
Create generator for linear sequence scaled by scale.
Definition cutoff.cpp:152
Gecode::Search::Cutoff::geometric
static Cutoff * geometric(unsigned long int scale=Config::slice, double base=Config::base)
Definition cutoff.cpp:160
Gecode::Search::Cutoff::constant
static Cutoff * constant(unsigned long int scale=Config::slice)
Create generator for constant sequence with constant s.
Definition cutoff.cpp:148
Gecode::Search::Cutoff::luby
static Cutoff * luby(unsigned long int scale=Config::slice)
Create generator for luby sequence with scale-factor scale.
Definition cutoff.cpp:156
Gecode::Search::FailStop
Stop-object based on number of failures
Definition search.hh:852
Gecode::Search::NodeStop
Stop-object based on number of nodes
Definition search.hh:829
Gecode::Search::Options
Search engine options
Definition search.hh:746
Gecode::Search::Options::c_d
unsigned int c_d
Create a clone after every c_d commits (commit distance).
Definition search.hh:753
Gecode::Search::Options::clone
bool clone
Whether engines create a clone when being initialized.
Definition search.hh:749
Gecode::Search::Options::d_l
unsigned int d_l
Discrepancy limit (for LDS).
Definition search.hh:757
Gecode::Search::Options::cutoff
Cutoff * cutoff
Cutoff for restart-based search.
Definition search.hh:767
Gecode::Search::Options::a_d
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance).
Definition search.hh:755
Gecode::Search::Options::stop
Stop * stop
Stop object for stopping search.
Definition search.hh:765
Gecode::Search::Options::tracer
SearchTracer * tracer
Tracer object for tracing search.
Definition search.hh:769
Gecode::Search::Options::assets
unsigned int assets
Number of assets (engines) in a portfolio.
Definition search.hh:759
Gecode::Search::Options::slice
unsigned int slice
Size of a slice in a portfolio (in number of failures).
Definition search.hh:761
Gecode::Search::Options::nogoods_limit
unsigned int nogoods_limit
Depth limit for extraction of no-goods.
Definition search.hh:763
Gecode::Search::Options::threads
double threads
Number of threads to use.
Definition search.hh:751
Gecode::Search::Statistics
Search engine statistics
Definition search.hh:147
Gecode::Search::Stop
Base-class for Stop-object.
Definition search.hh:799
Gecode::Search::Stop::node
static Stop * node(unsigned long int l)
Stop if node limit l has been exceeded.
Definition stop.cpp:43
Gecode::Search::Stop::time
static Stop * time(unsigned long int l)
Stop if time limit l (in milliseconds) has been exceeded.
Definition stop.cpp:51
Gecode::Search::Stop::fail
static Stop * fail(unsigned long int l)
Stop if failure limit l has been exceeded.
Definition stop.cpp:47
Gecode::Search::TimeStop
Stop-object based on time
Definition search.hh:871
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Support::Timer
Timer
Definition timer.hpp:51
GECODE_DRIVER_EXPORT
#define GECODE_DRIVER_EXPORT
Definition driver.hh:61
pi
const int * pi[]
Definition photo.cpp:14262
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_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::Script
Driver::ScriptBase< Driver::IgnoreStepOption< Space > > Script
Base-class for scripts.
Definition driver.hh:801
Gecode::Gist::bab
int bab(Space *root, const Gist::Options &opt=Gist::Options::def)
Create a new stand-alone Gist for branch-and-bound search of root.
Definition gist.hpp:208
Gecode::Gist::dfs
int dfs(Space *root, const Gist::Options &opt=Gist::Options::def)
Create a new stand-alone Gist for root.
Definition gist.hpp:203
Gecode::Driver
Script commandline driver.
Gecode::Driver::dev
double dev(double t[], unsigned int n)
Compute deviation of n elements in t.
Definition script.cpp:84
Gecode::Driver::stop
void stop(Support::Timer &timer, std::ostream &os)
Get time since start of timer and print user friendly time information.
Definition script.cpp:42
Gecode::Driver::createCutoff
Search::Cutoff * createCutoff(const Options &o)
Create cutoff object from options.
Definition script.hpp:153
Gecode::Driver::am
double am(double t[], unsigned int n)
Compute arithmetic mean of n elements in t.
Definition script.cpp:74
Gecode
Gecode toplevel namespace
Test::Int::Basic::i
Gecode::IntArgs i({1, 2, 3, 4})
Test::Int::Distinct::d
Gecode::IntSet d(v, 7)
Test::Int::Dom::r
const int r[4][2]
Definition dom.cpp:152
std
Definition flatzinc.cpp:52
forceinline
#define forceinline
Definition config.hpp:187
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56