Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
script.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2004
8  *
9  * Last modified:
10  * $Date$ by $Author$
11  * $Revision$
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  *
18  * Permission is hereby granted, free of charge, to any person obtaining
19  * a copy of this software and associated documentation files (the
20  * "Software"), to deal in the Software without restriction, including
21  * without limitation the rights to use, copy, modify, merge, publish,
22  * distribute, sublicense, and/or sell copies of the Software, and to
23  * permit persons to whom the Software is furnished to do so, subject to
24  * the following conditions:
25  *
26  * The above copyright notice and this permission notice shall be
27  * included in all copies or substantial portions of the Software.
28  *
29  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
33  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
34  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
35  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36  *
37  */
38 
39 #include <iostream>
40 #include <iomanip>
41 #include <fstream>
42 #include <cstring>
43 
44 #ifndef GECODE_THREADS_WINDOWS
45 #include <csignal>
46 #endif
47 
48 namespace Gecode { namespace Driver {
49 
54  class CombinedStop : public Search::Stop {
55  private:
56  Search::NodeStop* ns;
57  Search::FailStop* fs;
58  Search::TimeStop* ts;
60  static bool sigint;
61  CombinedStop(unsigned int node, unsigned int fail, unsigned int time)
63  : ns((node > 0) ? new Search::NodeStop(node) : NULL),
64  fs((fail > 0) ? new Search::FailStop(fail) : NULL),
65  ts((time > 0) ? new Search::TimeStop(time) : NULL) {
66  sigint = false;
67  }
68  public:
70  enum {
71  SR_NODE = 1 << 0,
72  SR_FAIL = 1 << 1,
73  SR_TIME = 1 << 2,
74  SR_INT = 1 << 3
75  };
77  virtual bool stop(const Search::Statistics& s, const Search::Options& o) {
78  return
79  sigint ||
80  ((ns != NULL) && ns->stop(s,o)) ||
81  ((fs != NULL) && fs->stop(s,o)) ||
82  ((ts != NULL) && ts->stop(s,o));
83  }
85  int reason(const Search::Statistics& s, const Search::Options& o) {
86  return
87  (((ns != NULL) && ns->stop(s,o)) ? SR_NODE : 0) |
88  (((fs != NULL) && fs->stop(s,o)) ? SR_FAIL : 0) |
89  (((ts != NULL) && ts->stop(s,o)) ? SR_TIME : 0) |
90  (sigint ? SR_INT : 0);
91  }
93  static Search::Stop*
94  create(unsigned int node, unsigned int fail, unsigned int time,
95  bool intr) {
96  if ( (!intr) && (node == 0) && (fail == 0) && (time == 0))
97  return NULL;
98  else
99  return new CombinedStop(node,fail,time);
100  }
101 #ifdef GECODE_THREADS_WINDOWS
102  static BOOL interrupt(DWORD t) {
104  if (t == CTRL_C_EVENT) {
105  sigint = true;
106  installCtrlHandler(false,true);
107  return true;
108  }
109  return false;
110  }
111 #else
112  static void
114  interrupt(int) {
115  sigint = true;
116  installCtrlHandler(false,true);
117  }
118 #endif
119  static void installCtrlHandler(bool install, bool force=false) {
121  if (force || !sigint) {
122 #ifdef GECODE_THREADS_WINDOWS
123  SetConsoleCtrlHandler( (PHANDLER_ROUTINE) interrupt, install);
124 #else
125  std::signal(SIGINT, install ? interrupt : SIG_DFL);
126 #endif
127  }
128  }
131  delete ns; delete fs; delete ts;
132  }
133  };
134 
140  stop(Support::Timer& t, std::ostream& os);
141 
145  GECODE_DRIVER_EXPORT double
146  am(double t[], unsigned int n);
147 
151  GECODE_DRIVER_EXPORT double
152  dev(double t[], unsigned int n);
153 
155  template<class Options>
156  inline Search::Cutoff*
157  createCutoff(const Options& o) {
158  switch (o.restart()) {
159  case RM_NONE:
160  return NULL;
161  case RM_CONSTANT:
163  case RM_LINEAR:
165  case RM_LUBY:
167  case RM_GEOMETRIC:
169  default: GECODE_NEVER;
170  }
171  return NULL;
172  }
173 
174 
175 #ifdef GECODE_HAS_GIST
176 
180  template<class Engine>
181  class GistEngine {
182  public:
183  static void explore(Space* root, const Gist::Options& opt) {
184  (void) Gist::dfs(root, opt);
185  }
186  };
187 
189  template<typename S>
190  class GistEngine<DFS<S> > {
191  public:
192  static void explore(S* root, const Gist::Options& opt) {
193  (void) Gist::dfs(root, opt);
194  }
195  };
196 
198  template<typename S>
199  class GistEngine<LDS<S> > {
200  public:
201  static void explore(S* root, const Gist::Options& opt) {
202  (void) Gist::dfs(root, opt);
203  }
204  };
205 
207  template<typename S>
208  class GistEngine<BAB<S> > {
209  public:
210  static void explore(S* root, const Gist::Options& opt) {
211  (void) Gist::bab(root, opt);
212  }
213  };
214 
215 #endif
216 
217 #ifdef GECODE_HAS_CPPROFILER
218 
220  template<class BaseSpace>
222  public:
224  ScriptGetInfo(void);
226  virtual std::string getInfo(const Space& home) const;
227  };
228 
229 #endif
230 
231  template<class BaseSpace>
234  : BaseSpace(opt) {}
235 
236  template<class BaseSpace>
239  : BaseSpace(e) {}
240 
241  template<class BaseSpace>
242  void
243  ScriptBase<BaseSpace>::print(std::ostream&) const {}
244 
245  template<class BaseSpace>
246  void
247  ScriptBase<BaseSpace>::compare(const Space&, std::ostream&) const {}
248 
249  template<class BaseSpace>
250  std::ostream&
251  ScriptBase<BaseSpace>::select_ostream(const char* sn, std::ofstream& ofs) {
252  if (strcmp(sn, "stdout") == 0) {
253  return std::cout;
254  } else if (strcmp(sn, "stdlog") == 0) {
255  return std::clog;
256  } else if (strcmp(sn, "stderr") == 0) {
257  return std::cerr;
258  } else {
259  ofs.open(sn);
260  return ofs;
261  }
262  }
263 
264 #ifdef GECODE_HAS_CPPROFILER
265 
266  template<class BaseSpace>
268 
269  template<class BaseSpace>
270  std::string
272  std::stringstream ss;
273  if (const ScriptBase<BaseSpace>* sb
274  = dynamic_cast<const ScriptBase<BaseSpace>*>(&home))
275  sb->print(ss);
276  return ss.str();
277  }
278 
279 #endif
280 
281 
285  template<class T, template<class> class E>
286  class EngineToMeta : public E<T> {
287  public:
288  EngineToMeta(T* s, const Search::Options& o) : E<T>(s,o) {}
289  };
290 
291  template<class BaseSpace>
292  template<class Script, template<class> class Engine, class Options>
293  void
295  if ((o.restart() != RM_NONE) && (o.assets() > 0)) {
296  std::cerr << "Cannot use restarts and portfolio..." << std::endl;
297  exit(EXIT_FAILURE);
298  }
299  if (o.restart() != RM_NONE) {
300  runMeta<Script,Engine,Options,RBS>(o,s);
301  } else if (o.assets() > 0) {
302  runMeta<Script,Engine,Options,PBS>(o,s);
303  } else {
304  runMeta<Script,Engine,Options,EngineToMeta>(o,s);
305  }
306  }
307 
308  template<class BaseSpace>
309  template<class Script, template<class> class Engine, class Options,
310  template<class, template<class> class> class Meta>
311  void
312  ScriptBase<BaseSpace>::runMeta(const Options& o, Script* s) {
313  using namespace std;
314 
315  ofstream sol_file, log_file;
316 
317  ostream& s_out = select_ostream(o.out_file(), sol_file);
318  ostream& l_out = select_ostream(o.log_file(), log_file);
319 
320  Search::Options so;
321 
322  try {
323  switch (o.mode()) {
324  case SM_GIST:
325 #ifdef GECODE_HAS_GIST
326  {
327  Gist::Print<Script> pi(o.name());
328  Gist::VarComparator<Script> vc(o.name());
330  opt.inspect.click(&pi);
331  opt.inspect.compare(&vc);
332  opt.clone = false;
333  opt.c_d = o.c_d();
334  opt.a_d = o.a_d();
335  for (unsigned int i=0; o.inspect.click(i) != NULL; i++)
336  opt.inspect.click(o.inspect.click(i));
337  for (unsigned int i=0; o.inspect.solution(i) != NULL; i++)
338  opt.inspect.solution(o.inspect.solution(i));
339  for (unsigned int i=0; o.inspect.move(i) != NULL; i++)
340  opt.inspect.move(o.inspect.move(i));
341  for (unsigned int i=0; o.inspect.compare(i) != NULL; i++)
342  opt.inspect.compare(o.inspect.compare(i));
343  if (s == NULL)
344  s = new Script(o);
345  (void) GistEngine<Engine<Script> >::explore(s, opt);
346  }
347  break;
348  // If Gist is not available, goto solution
349 #else
350  goto solution;
351 #endif
352  case SM_CPPROFILER:
353 #ifdef GECODE_HAS_CPPROFILER
354  {
355  CPProfilerSearchTracer::GetInfo* getInfo = nullptr;
356  if (o.profiler_info())
357  getInfo = new ScriptGetInfo<BaseSpace>;
358  so.tracer = new CPProfilerSearchTracer
359  (o.profiler_id(), o.name(), o.profiler_port(), getInfo);
360  }
361  /* FALL THROUGH */
362 #endif
363  case SM_SOLUTION:
364 #ifndef GECODE_HAS_GIST
365  solution:
366 #endif
367  {
368  l_out << o.name() << endl;
370  int i = static_cast<int>(o.solutions());
371  t.start();
372  if (s == NULL)
373  s = new Script(o);
374  unsigned int n_p = PropagatorGroup::all.size(*s);
375  unsigned int n_b = BrancherGroup::all.size(*s);
376  so.threads = o.threads();
377  so.c_d = o.c_d();
378  so.a_d = o.a_d();
379  so.d_l = o.d_l();
380  so.assets = o.assets();
381  so.slice = o.slice();
382  so.stop = CombinedStop::create(o.node(),o.fail(), o.time(),
383  o.interrupt());
384  so.cutoff = createCutoff(o);
385  so.clone = false;
386  so.nogoods_limit = o.nogoods() ? o.nogoods_limit() : 0U;
387  if (o.interrupt())
389  {
390  Meta<Script,Engine> e(s,so);
391  if (o.print_last()) {
392  Script* px = NULL;
393  do {
394  Script* ex = e.next();
395  if (ex == NULL) {
396  if (px != NULL) {
397  px->print(s_out);
398  delete px;
399  }
400  break;
401  } else {
402  delete px;
403  px = ex;
404  }
405  } while (--i != 0);
406  } else {
407  do {
408  Script* ex = e.next();
409  if (ex == NULL)
410  break;
411  ex->print(s_out);
412  delete ex;
413  } while (--i != 0);
414  }
415  if (o.interrupt())
417  Search::Statistics stat = e.statistics();
418  s_out << endl;
419  if (e.stopped()) {
420  l_out << "Search engine stopped..." << endl
421  << "\treason: ";
422  int r = static_cast<CombinedStop*>(so.stop)->reason(stat,so);
423  if (r & CombinedStop::SR_INT)
424  l_out << "user interrupt " << endl;
425  else {
426  if (r & CombinedStop::SR_NODE)
427  l_out << "node ";
428  if (r & CombinedStop::SR_FAIL)
429  l_out << "fail ";
430  if (r & CombinedStop::SR_TIME)
431  l_out << "time ";
432  l_out << "limit reached" << endl << endl;
433  }
434  }
435  l_out << "Initial" << endl
436  << "\tpropagators: " << n_p << endl
437  << "\tbranchers: " << n_b << endl
438  << endl
439  << "Summary" << endl
440  << "\truntime: ";
441  stop(t, l_out);
442  l_out << endl
443  << "\tsolutions: "
444  << ::abs(static_cast<int>(o.solutions()) - i) << endl
445  << "\tpropagations: " << stat.propagate << endl
446  << "\tnodes: " << stat.node << endl
447  << "\tfailures: " << stat.fail << endl
448  << "\trestarts: " << stat.restart << endl
449  << "\tno-goods: " << stat.nogood << endl
450  << "\tpeak depth: " << stat.depth << endl
451 #ifdef GECODE_PEAKHEAP
452  << "\tpeak memory: "
453  << static_cast<int>((heap.peak()+1023) / 1024) << " KB"
454  << endl
455 #endif
456  << endl;
457  }
458  delete so.stop;
459  delete so.tracer;
460  }
461  break;
462  case SM_STAT:
463  {
464  l_out << o.name() << endl;
466  int i = static_cast<int>(o.solutions());
467  t.start();
468  if (s == NULL)
469  s = new Script(o);
470  unsigned int n_p = PropagatorGroup::all.size(*s);
471  unsigned int n_b = BrancherGroup::all.size(*s);
472 
473  so.clone = false;
474  so.threads = o.threads();
475  so.assets = o.assets();
476  so.slice = o.slice();
477  so.c_d = o.c_d();
478  so.a_d = o.a_d();
479  so.d_l = o.d_l();
480  so.stop = CombinedStop::create(o.node(),o.fail(), o.time(),
481  o.interrupt());
482  so.cutoff = createCutoff(o);
483  so.nogoods_limit = o.nogoods() ? o.nogoods_limit() : 0U;
484  if (o.interrupt())
486  {
487  Meta<Script,Engine> e(s,so);
488  do {
489  Script* ex = e.next();
490  if (ex == NULL)
491  break;
492  delete ex;
493  } while (--i != 0);
494  if (o.interrupt())
496  Search::Statistics stat = e.statistics();
497  l_out << endl
498  << "\tpropagators: " << n_p << endl
499  << "\tbranchers: " << n_b << endl
500  << "\truntime: ";
501  stop(t, l_out);
502  l_out << endl
503  << "\tsolutions: "
504  << ::abs(static_cast<int>(o.solutions()) - i) << endl
505  << "\tpropagations: " << stat.propagate << endl
506  << "\tnodes: " << stat.node << endl
507  << "\tfailures: " << stat.fail << endl
508  << "\trestarts: " << stat.restart << endl
509  << "\tno-goods: " << stat.nogood << endl
510  << "\tpeak depth: " << stat.depth << endl
511 #ifdef GECODE_PEAKHEAP
512  << "\tpeak memory: "
513  << static_cast<int>((heap.peak()+1023) / 1024) << " KB"
514  << endl
515 #endif
516  << endl;
517  }
518  delete so.stop;
519  }
520  break;
521  case SM_TIME:
522  {
523  l_out << o.name() << endl;
525  double* ts = new double[o.samples()];
526  bool stopped = false;
527  for (unsigned int ns = o.samples(); !stopped && ns--; ) {
528  t.start();
529  for (unsigned int k = o.iterations(); !stopped && k--; ) {
530  unsigned int i = o.solutions();
531  Script* s1 = new Script(o);
532  Search::Options so;
533  so.clone = false;
534  so.threads = o.threads();
535  so.assets = o.assets();
536  so.slice = o.slice();
537  so.c_d = o.c_d();
538  so.a_d = o.a_d();
539  so.d_l = o.d_l();
540  so.stop = CombinedStop::create(o.node(),o.fail(), o.time(),
541  false);
542  so.cutoff = createCutoff(o);
543  so.nogoods_limit = o.nogoods() ? o.nogoods_limit() : 0U;
544  {
545  Meta<Script,Engine> e(s1,so);
546  do {
547  Script* ex = e.next();
548  if (ex == NULL)
549  break;
550  delete ex;
551  } while (--i != 0);
552  if (e.stopped())
553  stopped = true;
554  }
555  delete so.stop;
556  }
557  ts[ns] = t.stop() / o.iterations();
558  }
559  if (stopped) {
560  l_out << "\tSTOPPED" << endl;
561  } else {
562  double m = am(ts,o.samples());
563  double d = dev(ts,o.samples()) * 100.0;
564  l_out << "\truntime: "
565  << setw(20) << right
566  << showpoint << fixed
567  << setprecision(6) << m << "ms"
568  << setprecision(2) << " (" << d << "% deviation)"
569  << endl;
570  }
571  delete [] ts;
572  }
573  break;
574  }
575  } catch (Exception& e) {
576  cerr << "Exception: " << e.what() << "." << endl
577  << "Stopping..." << endl;
578  if (sol_file.is_open())
579  sol_file.close();
580  if (log_file.is_open())
581  log_file.close();
582  exit(EXIT_FAILURE);
583  }
584  if (sol_file.is_open())
585  sol_file.close();
586  if (log_file.is_open())
587  log_file.close();
588  }
589 
590 }}
591 
592 // STATISTICS: driver-any
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Definition: search.hh:757
Restart with linear sequence.
Definition: driver.hh:113
NodeType t
Type of node.
Definition: bool-expr.cpp:234
unsigned int nogoods_limit
Depth limit for extraction of no-goods.
Definition: search.hh:765
Limited discrepancy search engine.
Definition: search.hh:1111
static BrancherGroup all
Group of all branchers.
Definition: core.hpp:837
Search engine statistics
Definition: search.hh:149
Class to send solution information to CPProfiler.
Definition: search.hh:425
Stop-object based on number of nodes
Definition: search.hh:831
unsigned int c_d
Create a clone after every c_d commits (commit distance)
Definition: search.hh:755
Search engine options
Definition: search.hh:748
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:45
static PropagatorGroup all
Group of all propagators.
Definition: core.hpp:779
void stop(Support::Timer &timer, std::ostream &os)
Get time since start of timer and print user friendly time information.
Definition: script.cpp:46
Traits class for search engines.
Definition: script.hpp:181
virtual void print(std::ostream &os) const
Print a solution to os.
Definition: script.hpp:243
static void interrupt(int)
Handler for catching Ctrl-C.
Definition: script.hpp:114
unsigned int slice
Size of a slice in a portfolio (in number of failures)
Definition: search.hh:763
virtual void inspect(const Space &node)
Use the print method of the template class S to print a space.
Definition: gist.hpp:145
unsigned long int fail
Number of failed nodes in search tree.
Definition: search.hh:152
unsigned long int nogood
Number of no-goods posted.
Definition: search.hh:160
unsigned long int depth
Maximum depth of search stack.
Definition: search.hh:156
Restart with Luby sequence.
Definition: driver.hh:114
Definition: flatzinc.cpp:56
No restarts.
Definition: driver.hh:111
Base class for cutoff generators for restart-based meta engine.
Definition: search.hh:474
Class to record search trace info for CPProfiler.
Definition: search.hh:422
static Stop * fail(unsigned long int l)
Stop if failure limit l has been exceeded.
Definition: stop.cpp:51
unsigned long int propagate
Number of propagator executions.
Definition: core.hpp:1620
#define forceinline
Definition: config.hpp:182
Search::Cutoff * createCutoff(const Options &o)
Create cutoff object from options.
Definition: script.hpp:157
Computation spaces.
Definition: core.hpp:1668
unsigned int d_l
Discrepancy limit (for LDS)
Definition: search.hh:759
Parametric base-class for scripts.
Definition: driver.hh:733
unsigned int size(Space &home) const
Return number of propagators in a group.
Definition: core.cpp:920
virtual void compare(const Space &home, std::ostream &os) const
Compare with s.
Definition: script.hpp:247
static Stop * node(unsigned long int l)
Stop if node limit l has been exceeded.
Definition: stop.cpp:47
Gecode::IntSet d(v, 7)
static void explore(S *root, const Gist::Options &opt)
Definition: script.hpp:201
void start(void)
Start timer.
Definition: timer.hpp:70
Cutoff * cutoff
Cutoff for restart-based search.
Definition: search.hh:769
double threads
Number of threads to use.
Definition: search.hh:753
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
Options opt
The options.
Definition: test.cpp:101
int dfs(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for root.
Definition: gist.hpp:207
Print solution and some statistics.
Definition: driver.hh:99
Depth-first branch-and-bound search engine.
Definition: search.hh:1073
ScriptGetInfo(void)
Initialize.
Definition: script.hpp:267
static void installCtrlHandler(bool install, bool force=false)
Install handler for catching Ctrl-C.
Definition: script.hpp:120
static Search::Stop * create(unsigned int node, unsigned int fail, unsigned int time, bool intr)
Create appropriate stop-object.
Definition: script.hpp:94
Stop object based on nodes, failures, and time.
Definition: script.hpp:54
static void explore(S *root, const Gist::Options &opt)
Definition: script.hpp:192
virtual const char * what(void) const
Return information.
Definition: exception.cpp:59
unsigned int size(Space &home) const
Return number of branchers in a group.
Definition: core.cpp:998
double am(double t[], unsigned int n)
Compute arithmetic mean of n elements in t.
Definition: script.cpp:78
Measure average runtime.
Definition: driver.hh:100
Wrapper class to add engine template argument.
Definition: script.hpp:286
EngineToMeta(T *s, const Search::Options &o)
Definition: script.hpp:288
int reason(const Search::Statistics &s, const Search::Options &o)
Report reason why search has been stopped.
Definition: script.hpp:85
void restart_scale(unsigned int scale)
Set default restart scale factor.
Definition: options.hpp:395
bool clone
Whether engines create a clone when being initialized.
Definition: search.hh:751
virtual bool stop(const Statistics &s, const Options &o)
Return true if failure limit is exceeded.
Definition: stop.cpp:75
const int * pi[]
Definition: photo.cpp:14266
#define GECODE_DRIVER_EXPORT
Definition: driver.hh:65
static Stop * time(unsigned long int l)
Stop if time limit l (in milliseconds) has been exceeded.
Definition: stop.cpp:55
A simple comparator.
Definition: gist.hh:215
static Cutoff * geometric(unsigned long int scale=Config::slice, double base=Config::base)
Definition: cutoff.cpp:164
unsigned int assets
Number of assets (engines) in a portfolio.
Definition: search.hh:761
double stop(void)
Get time since start of timer.
Definition: timer.hpp:80
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:769
double dev(double t[], unsigned int n)
Compute deviation of n elements in t.
Definition: script.cpp:88
~CombinedStop(void)
Destructor.
Definition: script.hpp:130
void assets(unsigned int n)
Set default number of assets in a portfolio.
Definition: options.hpp:359
Exception: Base-class for exceptions
Definition: exception.hpp:46
Print statistics for script.
Definition: driver.hh:101
Run script with CP-profiler.
Definition: driver.hh:103
Restart with geometric sequence.
Definition: driver.hh:115
static Cutoff * linear(unsigned long int scale=Config::slice)
Create generator for linear sequence scaled by scale.
Definition: cutoff.cpp:156
static Cutoff * luby(unsigned long int scale=Config::slice)
Create generator for luby sequence with scale-factor scale.
Definition: cutoff.cpp:160
Heap heap
The single global heap.
Definition: heap.cpp:48
virtual bool stop(const Statistics &s, const Options &o)
Return true if node limit is exceeded.
Definition: stop.cpp:65
static void run(const Options &opt, Script *s=NULL)
Definition: script.hpp:294
void restart_base(double base)
Set default restart base.
Definition: options.hpp:386
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
Definition: gist.hpp:212
Run script in Gist.
Definition: driver.hh:102
ScriptBase(const Options &opt)
Constructor.
Definition: script.hpp:233
unsigned long int restart
Number of restarts.
Definition: search.hh:158
Class to send solution information to CPProfiler for a script.
Definition: script.hpp:221
static Cutoff * constant(unsigned long int scale=Config::slice)
Create generator for constant sequence with constant s.
Definition: cutoff.cpp:152
Stop * stop
Stop object for stopping search.
Definition: search.hh:767
int explore(Space *root, bool bab, const Options &opt)
Create a new stand-alone Gist for root using bab.
Definition: gist.cpp:106
Gecode toplevel namespace
static std::ostream & select_ostream(const char *sn, std::ofstream &ofs)
Choose output stream according to sn.
Definition: script.hpp:251
unsigned long int node
Number of nodes expanded.
Definition: search.hh:154
An inspector for printing simple text output.
Definition: gist.hh:192
Interrupted by user.
Definition: script.hpp:74
Stop-object based on time
Definition: search.hh:873
Base-class for Stop-object.
Definition: search.hh:801
virtual std::string getInfo(const Space &home) const
Return info for a space (which must be a script)
Definition: script.hpp:271
Options for Gist
Definition: gist.hh:238
void restart(RestartMode r)
Set default restart mode.
Definition: options.hpp:377
static void explore(S *root, const Gist::Options &opt)
Definition: script.hpp:210
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
virtual bool stop(const Statistics &s, const Options &o)
Return true if time limit is exceeded.
Definition: stop.cpp:85
Options for scripts
Definition: driver.hh:370
Restart with constant sequence.
Definition: driver.hh:112
Driver::ScriptBase< Driver::IgnoreStepOption< Space > > Script
Base-class for scripts.
Definition: driver.hh:805
Depth-first search engine.
Definition: search.hh:1039
Stop-object based on number of failures
Definition: search.hh:854
static void explore(Space *root, const Gist::Options &opt)
Definition: script.hpp:183
virtual bool stop(const Search::Statistics &s, const Search::Options &o)
Test whether search must be stopped.
Definition: script.hpp:77