Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
flatzinc.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Contributing authors:
7  * Gabriel Hjort Blindell <gabriel.hjort.blindell@gmail.com>
8  *
9  * Copyright:
10  * Guido Tack, 2007-2012
11  * Gabriel Hjort Blindell, 2012
12  *
13  * Last modified:
14  * $Date$ by $Author$
15  * $Revision$
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #ifndef __GECODE_FLATZINC_HH__
43 #define __GECODE_FLATZINC_HH__
44 
45 #include <iostream>
46 
47 #include <gecode/kernel.hh>
48 #include <gecode/int.hh>
49 #ifdef GECODE_HAS_SET_VARS
50 #include <gecode/set.hh>
51 #endif
52 #ifdef GECODE_HAS_FLOAT_VARS
53 #include <gecode/float.hh>
54 #endif
55 #include <map>
56 
57 /*
58  * Support for DLLs under Windows
59  *
60  */
61 
62 #if !defined(GECODE_STATIC_LIBS) && \
63  (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
64 
65 #ifdef GECODE_BUILD_FLATZINC
66 #define GECODE_FLATZINC_EXPORT __declspec( dllexport )
67 #else
68 #define GECODE_FLATZINC_EXPORT __declspec( dllimport )
69 #endif
70 
71 #else
72 
73 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
74 
75 #define GECODE_FLATZINC_EXPORT __attribute__ ((visibility("default")))
76 
77 #else
78 
79 #define GECODE_FLATZINC_EXPORT
80 
81 #endif
82 #endif
83 
84 // Configure auto-linking
85 #ifndef GECODE_BUILD_FLATZINC
86 #define GECODE_LIBRARY_NAME "FlatZinc"
88 #endif
89 
90 #include <gecode/driver.hh>
91 
93 #include <gecode/flatzinc/ast.hh>
95 
105 namespace Gecode { namespace FlatZinc {
106 
112  private:
114  std::vector<std::string> iv_names;
116  std::vector<std::string> bv_names;
117 #ifdef GECODE_HAS_FLOAT_VARS
118  std::vector<std::string> fv_names;
120 #endif
121 #ifdef GECODE_HAS_SET_VARS
122  std::vector<std::string> sv_names;
124 #endif
125  AST::Array* _output;
126  void printElem(std::ostream& out,
127  AST::Node* ai,
128  const Gecode::IntVarArray& iv,
129  const Gecode::BoolVarArray& bv
130 #ifdef GECODE_HAS_SET_VARS
131  ,
132  const Gecode::SetVarArray& sv
133 #endif
135  ,
136  const Gecode::FloatVarArray& fv
137 #endif
138  ) const;
139  void printElemDiff(std::ostream& out,
140  AST::Node* ai,
141  const Gecode::IntVarArray& iv1,
142  const Gecode::IntVarArray& iv2,
143  const Gecode::BoolVarArray& bv1,
144  const Gecode::BoolVarArray& bv2
145 #ifdef GECODE_HAS_SET_VARS
146  ,
147  const Gecode::SetVarArray& sv1,
148  const Gecode::SetVarArray& sv2
149 #endif
150 #ifdef GECODE_HAS_FLOAT_VARS
151  ,
152  const Gecode::FloatVarArray& fv1,
153  const Gecode::FloatVarArray& fv2
154 #endif
155  ) const;
156  public:
157  Printer(void) : _output(NULL) {}
158  void init(AST::Array* output);
159 
160  void print(std::ostream& out,
161  const Gecode::IntVarArray& iv,
162  const Gecode::BoolVarArray& bv
163 #ifdef GECODE_HAS_SET_VARS
164  ,
165  const Gecode::SetVarArray& sv
166 #endif
167 #ifdef GECODE_HAS_FLOAT_VARS
168  ,
169  const Gecode::FloatVarArray& fv
170 #endif
171  ) const;
172 
173  void printDiff(std::ostream& out,
174  const Gecode::IntVarArray& iv1, const Gecode::IntVarArray& iv2,
175  const Gecode::BoolVarArray& bv1, const Gecode::BoolVarArray& bv2
176 #ifdef GECODE_HAS_SET_VARS
177  ,
178  const Gecode::SetVarArray& sv1, const Gecode::SetVarArray& sv2
179 #endif
180 #ifdef GECODE_HAS_FLOAT_VARS
181  ,
182  const Gecode::FloatVarArray& fv1,
183  const Gecode::FloatVarArray& fv2
184 #endif
185  ) const;
186 
187 
188  ~Printer(void);
189 
190  void addIntVarName(const std::string& n);
191  const std::string& intVarName(int i) const { return iv_names[i]; }
192  void addBoolVarName(const std::string& n);
193  const std::string& boolVarName(int i) const { return bv_names[i]; }
194 #ifdef GECODE_HAS_FLOAT_VARS
195  void addFloatVarName(const std::string& n);
196  const std::string& floatVarName(int i) const { return fv_names[i]; }
197 #endif
198 #ifdef GECODE_HAS_SET_VARS
199  void addSetVarName(const std::string& n);
200  const std::string& setVarName(int i) const { return sv_names[i]; }
201 #endif
202 
203  void shrinkElement(AST::Node* node,
204  std::map<int,int>& iv, std::map<int,int>& bv,
205  std::map<int,int>& sv, std::map<int,int>& fv);
206 
207  void shrinkArrays(Space& home,
208  int& optVar, bool optVarIsInt,
211 #ifdef GECODE_HAS_SET_VARS
212  ,
214 #endif
215 #ifdef GECODE_HAS_FLOAT_VARS
216  ,
218 #endif
219  );
220 
221  private:
222  Printer(const Printer&);
223  Printer& operator=(const Printer&);
224  };
225 
231  protected:
233 
252 
253 
255 
259 
260 #ifdef GECODE_HAS_CPPROFILER
261 
265 
266 #endif
267 
269  public:
271  FlatZincOptions(const char* s)
272  : Gecode::BaseOptions(s),
273  _solutions("n","number of solutions (0 = all, -1 = one/best)",-1),
274  _allSolutions("a", "return all solutions (equal to -n 0)"),
275  _threads("p","number of threads (0 = #processing units)",
276  Gecode::Search::Config::threads),
277  _free("f", "free search, no need to follow search-specification"),
278  _decay("decay","decay factor",0.99),
279  _c_d("c-d","recomputation commit distance",Gecode::Search::Config::c_d),
280  _a_d("a-d","recomputation adaption distance",Gecode::Search::Config::a_d),
281  _node("node","node cutoff (0 = none, solution mode)"),
282  _fail("fail","failure cutoff (0 = none, solution mode)"),
283  _time("time","time (in ms) cutoff (0 = none, solution mode)"),
284  _seed("r","random seed",0),
285  _restart("restart","restart sequence type",RM_NONE),
286  _r_base("restart-base","base for geometric restart sequence",1.5),
287  _r_scale("restart-scale","scale factor for restart sequence",250),
288  _nogoods("nogoods","whether to use no-goods from restarts",false),
289  _nogoods_limit("nogoods-limit","depth limit for no-good extraction",
290  Search::Config::nogoods_limit),
291  _interrupt("interrupt","whether to catch Ctrl-C (true) or not (false)",
292  true),
293  _step("step","step distance for float optimization",0.0),
294  _mode("mode","how to execute script",Gecode::SM_SOLUTION),
295  _stat("s","emit statistics"),
296  _output("o","file to send output to")
297 
298 #ifdef GECODE_HAS_CPPROFILER
299  ,
300  _profiler_id("cpprofiler-id", "use this execution id with cpprofiler", 0),
301  _profiler_port("cpprofiler-port", "connect to cpprofiler on this port", 6565),
302  _profiler_info("cpprofiler-info", "send solution information to cpprofiler", false)
303 
304 #endif
305  {
306  _mode.add(Gecode::SM_SOLUTION, "solution");
307  _mode.add(Gecode::SM_STAT, "stat");
308  _mode.add(Gecode::SM_GIST, "gist");
309  _mode.add(Gecode::SM_CPPROFILER, "cpprofiler");
310  _restart.add(RM_NONE,"none");
311  _restart.add(RM_CONSTANT,"constant");
312  _restart.add(RM_LINEAR,"linear");
313  _restart.add(RM_LUBY,"luby");
314  _restart.add(RM_GEOMETRIC,"geometric");
315 
316  add(_solutions); add(_threads); add(_c_d); add(_a_d);
317  add(_allSolutions);
318  add(_free);
319  add(_decay);
320  add(_node); add(_fail); add(_time); add(_interrupt);
321  add(_seed);
322  add(_step);
323  add(_restart); add(_r_base); add(_r_scale);
324  add(_nogoods); add(_nogoods_limit);
325  add(_mode); add(_stat);
326  add(_output);
327 #ifdef GECODE_HAS_CPPROFILER
328  add(_profiler_id);
329  add(_profiler_port);
330  add(_profiler_info);
331 #endif
332  }
333 
334  void parse(int& argc, char* argv[]) {
335  Gecode::BaseOptions::parse(argc,argv);
336  if (_allSolutions.value() && _solutions.value()==-1) {
337  _solutions.value(0);
338  }
339  if (_stat.value())
340  _mode.value(Gecode::SM_STAT);
341  }
342 
343  virtual void help(void) {
344  std::cerr << "Gecode FlatZinc interpreter" << std::endl
345  << " - Supported FlatZinc version: " << GECODE_FLATZINC_VERSION
346  << std::endl << std::endl;
348  }
349 
350  int solutions(void) const { return _solutions.value(); }
351  bool allSolutions(void) const { return _allSolutions.value(); }
352  double threads(void) const { return _threads.value(); }
353  bool free(void) const { return _free.value(); }
354  unsigned int c_d(void) const { return _c_d.value(); }
355  unsigned int a_d(void) const { return _a_d.value(); }
356  unsigned int node(void) const { return _node.value(); }
357  unsigned int fail(void) const { return _fail.value(); }
358  unsigned int time(void) const { return _time.value(); }
359  int seed(void) const { return _seed.value(); }
360  double step(void) const { return _step.value(); }
361  const char* output(void) const { return _output.value(); }
362 
363  Gecode::ScriptMode mode(void) const {
364  return static_cast<Gecode::ScriptMode>(_mode.value());
365  }
366 
367  double decay(void) const { return _decay.value(); }
368  RestartMode restart(void) const {
369  return static_cast<RestartMode>(_restart.value());
370  }
371  double restart_base(void) const { return _r_base.value(); }
372  unsigned int restart_scale(void) const { return _r_scale.value(); }
373  bool nogoods(void) const { return _nogoods.value(); }
374  unsigned int nogoods_limit(void) const { return _nogoods_limit.value(); }
375  bool interrupt(void) const { return _interrupt.value(); }
376 
377 #ifdef GECODE_HAS_CPPROFILER
378 
379  int profiler_id(void) const { return _profiler_id.value(); }
380  unsigned int profiler_port(void) const { return _profiler_port.value(); }
381  bool profiler_info(void) const { return _profiler_info.value(); }
382 
383 #endif
384 
385  void allSolutions(bool b) { _allSolutions.value(b); }
386  };
387 
389  public:
391  BranchInformation(void);
395  void init(void);
397  void add(BrancherGroup bg,
398  const std::string& rel0,
399  const std::string& rel1,
400  const std::vector<std::string>& n);
402  void print(const Brancher& b,
403  unsigned int a, int i, int n, std::ostream& o) const;
404 #ifdef GECODE_HAS_FLOAT_VARS
405  void print(const Brancher& b,
407  unsigned int a, int i, const FloatNumBranch& nl,
408  std::ostream& o) const;
409 #endif
410  };
411 
414  extern Rnd defrnd;
415 
416  class FlatZincSpaceInitData;
417 
423  public:
424  enum Meth {
425  SAT, //< Solve as satisfaction problem
426  MIN, //< Solve as minimization problem
427  MAX //< Solve as maximization problem
428  };
429  protected:
440 
442  int _optVar;
445 
448 
450  unsigned int _lns;
451 
454 
457 
460 
463  private:
465  template<template<class> class Engine>
466  void
467  runEngine(std::ostream& out, const Printer& p,
468  const FlatZincOptions& opt, Gecode::Support::Timer& t_total);
470  template<template<class> class Engine,
471  template<class, template<class> class> class Meta>
472  void
473  runMeta(std::ostream& out, const Printer& p,
474  const FlatZincOptions& opt, Gecode::Support::Timer& t_total);
475  void
476  branchWithPlugin(AST::Node* ann);
477  public:
482 
485 
487  std::vector<bool> iv_introduced;
489  int* iv_boolalias;
495  std::vector<bool> bv_introduced;
496 #ifdef GECODE_HAS_SET_VARS
502  std::vector<bool> sv_introduced;
503 #endif
504 #ifdef GECODE_HAS_FLOAT_VARS
510  std::vector<bool> fv_introduced;
513 #endif
514  bool needAuxVars;
517  FlatZincSpace(Rnd& random = defrnd);
518 
520  ~FlatZincSpace(void);
521 
523  void init(int intVars, int boolVars, int setVars, int floatVars);
524 
526  void newIntVar(IntVarSpec* vs);
528  void aliasBool2Int(int iv, int bv);
530  int aliasBool2Int(int iv);
532  void newBoolVar(BoolVarSpec* vs);
534  void newSetVar(SetVarSpec* vs);
536  void newFloatVar(FloatVarSpec* vs);
537 
539  void postConstraints(std::vector<ConExpr*>& ces);
540 
542  void solve(AST::Array* annotation);
544  void minimize(int var, bool isInt, AST::Array* annotation);
546  void maximize(int var, bool isInt, AST::Array* annotation);
547 
549  void run(std::ostream& out, const Printer& p,
550  const FlatZincOptions& opt, Gecode::Support::Timer& t_total);
551 
553  void print(std::ostream& out, const Printer& p) const;
554 #ifdef GECODE_HAS_CPPROFILER
555  std::string getDomains(const Printer& p) const;
557 #endif
558  void compare(const Space& s, std::ostream& out) const;
563  void compare(const FlatZincSpace& s, std::ostream& out,
564  const Printer& p) const;
565 
574  void shrinkArrays(Printer& p);
575 
577  Meth method(void) const;
578 
580  int optVar(void) const;
582  bool optVarIsInt(void) const;
583 
593  void createBranchers(Printer& p, AST::Node* ann,
594  int seed, double decay,
595  bool ignoreUnknown,
596  std::ostream& err = std::cerr);
597 
599  AST::Array* solveAnnotations(void) const;
600 
602  BranchInformation branchInfo;
603 
605  virtual void constrain(const Space& s);
607  virtual Gecode::Space* copy(void);
609  virtual bool slave(const MetaInfo& mi);
610 
612 
613  IntArgs arg2intargs(AST::Node* arg, int offset = 0);
616  IntSharedArray arg2intsharedarray(AST::Node* arg, int offset = 0);
618  IntArgs arg2boolargs(AST::Node* arg, int offset = 0);
620  IntSharedArray arg2boolsharedarray(AST::Node* arg, int offset = 0);
622  IntSet arg2intset(AST::Node* n);
624  IntSetArgs arg2intsetargs(AST::Node* arg, int offset = 0);
626  IntVarArgs arg2intvarargs(AST::Node* arg, int offset = 0);
628  BoolVarArgs arg2boolvarargs(AST::Node* arg, int offset = 0, int siv=-1);
630  BoolVar arg2BoolVar(AST::Node* n);
632  IntVar arg2IntVar(AST::Node* n);
634  TupleSet arg2tupleset(AST::Node* n, int noOfVars);
636  bool isBoolArray(AST::Node* b, int& singleInt);
637 #ifdef GECODE_HAS_SET_VARS
638  SetVar arg2SetVar(AST::Node* n);
641  SetVarArgs arg2setvarargs(AST::Node* arg, int offset = 0, int doffset = 0,
642  const IntSet& od=IntSet::empty);
643 #endif
644 #ifdef GECODE_HAS_FLOAT_VARS
645  FloatValArgs arg2floatargs(AST::Node* arg, int offset = 0);
648  FloatVar arg2FloatVar(AST::Node* n);
650  FloatVarArgs arg2floatvarargs(AST::Node* arg, int offset = 0);
651 #endif
652  IntPropLevel ann2ipl(AST::Node* ann);
655  DFA getSharedDFA(DFA& a);
657  };
658 
661  private:
662  const std::string msg;
663  public:
664  Error(const std::string& where, const std::string& what)
665  : msg(where+": "+what) {}
666  const std::string& toString(void) const { return msg; }
667  };
668 
675  FlatZincSpace* parse(const std::string& fileName,
676  Printer& p, std::ostream& err = std::cerr,
677  FlatZincSpace* fzs=NULL, Rnd& rnd=defrnd);
678 
685  FlatZincSpace* parse(std::istream& is,
686  Printer& p, std::ostream& err = std::cerr,
687  FlatZincSpace* fzs=NULL, Rnd& rnd=defrnd);
688 
689 }}
690 
691 #endif
692 
693 // STATISTICS: flatzinc-any
#define GECODE_FLATZINC_VERSION
Definition: config.hpp:17
Restart with linear sequence.
Definition: driver.hh:113
const std::string & toString(void) const
Definition: flatzinc.hh:666
Gecode::Driver::IntOption _solutions
How many solutions.
Definition: flatzinc.hh:234
int floatVarCount
Number of float variables.
Definition: flatzinc.hh:437
void value(int v)
Set default value to v.
Definition: options.hpp:62
const Gecode::FloatNum step
Definition: arithmetic.cpp:789
Passing float arguments.
Definition: float.hh:954
Options for running FlatZinc models
Definition: flatzinc.hh:230
RestartMode restart(void) const
Definition: flatzinc.hh:368
The shared handle.
Gecode::Driver::UnsignedIntOption _time
Cutoff for time.
Definition: flatzinc.hh:243
Gecode::Driver::BoolOption _allSolutions
Return all solutions.
Definition: flatzinc.hh:235
void value(double v)
Set default value to v.
Definition: options.hpp:112
ScriptMode
Different modes for executing scripts.
Definition: driver.hh:98
Gecode::Driver::UnsignedIntOption _r_scale
Restart scale factor.
Definition: flatzinc.hh:247
Meth _method
Whether to solve as satisfaction or optimization problem.
Definition: flatzinc.hh:447
Boolean option.
Definition: driver.hh:273
Group of branchers.
Definition: core.hpp:789
#define GECODE_FLATZINC_EXPORT
Definition: flatzinc.hh:79
Gecode::ScriptMode mode(void) const
Definition: flatzinc.hh:363
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.
Passing float variables.
Definition: float.hh:981
void add(int v, const char *o, const char *h=NULL)
Add option value for value v, string o, and help text h.
Definition: options.cpp:142
int boolVarCount
Number of Boolean variables.
Definition: flatzinc.hh:435
Gecode::Driver::StringOption _restart
Restart method option.
Definition: flatzinc.hh:245
Gecode::Driver::BoolOption _free
Use free search.
Definition: flatzinc.hh:237
Integer variable array.
Definition: int.hh:742
Restart with Luby sequence.
Definition: driver.hh:114
Gecode::Driver::UnsignedIntOption _nogoods_limit
Depth limit for extracting no-goods.
Definition: flatzinc.hh:249
bool profiler_info(void) const
Definition: flatzinc.hh:381
Definition: flatzinc.cpp:56
No restarts.
Definition: driver.hh:111
Gecode::Driver::BoolOption _stat
Emit statistics.
Definition: flatzinc.hh:257
RestartMode
Different modes for restart-based search.
Definition: driver.hh:110
Gecode::Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Definition: flatzinc.hh:240
Float variable array.
Definition: float.hh:1031
Computation spaces.
Definition: core.hpp:1668
String-valued option.
Definition: driver.hh:155
unsigned int profiler_port(void) const
Definition: flatzinc.hh:380
Gecode::Driver::DoubleOption _decay
Decay option.
Definition: flatzinc.hh:238
void value(unsigned int v)
Set default value to v.
Definition: options.hpp:95
const BoolInstr * bi[]
Definition: mm-bool.cpp:4173
void value(int v)
Set default value to v.
Definition: options.hpp:78
unsigned int nogoods_limit(void) const
Definition: flatzinc.hh:374
Gecode::Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Definition: flatzinc.hh:262
Deterministic finite automaton (DFA)
Definition: int.hh:2027
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Gecode::IntArgs i(4, 1, 2, 3, 4)
Base-class for branchers.
Definition: core.hpp:1368
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
#define GECODE_HAS_SET_VARS
Definition: config.hpp:53
Gecode::Driver::StringOption _mode
Script mode to run.
Definition: flatzinc.hh:256
Options opt
The options.
Definition: test.cpp:101
Gecode::Driver::BoolOption _profiler_info
Whether solution information should be sent to the CP-profiler.
Definition: flatzinc.hh:264
Print solution and some statistics.
Definition: driver.hh:99
Value description class for branching.
Definition: float.hh:1463
double threads(void) const
Definition: flatzinc.hh:352
Gecode::Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Definition: flatzinc.hh:242
int _optVar
Index of the variable to optimize.
Definition: flatzinc.hh:442
Output support class for FlatZinc interpreter.
Definition: flatzinc.hh:111
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Definition: search.hh:117
Gecode::Driver::UnsignedIntOption _profiler_port
Connect to this port.
Definition: flatzinc.hh:263
Base class for script options.
Definition: driver.hh:335
Gecode::Driver::DoubleOption _step
Step option.
Definition: flatzinc.hh:251
const std::string & floatVarName(int i) const
Definition: flatzinc.hh:196
Error(const std::string &where, const std::string &what)
Definition: flatzinc.hh:664
const char * output(void) const
Definition: flatzinc.hh:361
Unsigned integer option.
Definition: driver.hh:233
FlatZincSpaceInitData * _initData
Initialisation data (only used for posting constraints)
Definition: flatzinc.hh:431
Integer sets.
Definition: int.hh:174
unsigned int node(void) const
Definition: flatzinc.hh:356
const std::string & intVarName(int i) const
Definition: flatzinc.hh:191
Passing integer variables.
Definition: int.hh:637
const double threads
Number of threads to use.
Definition: search.hh:112
Passing integer arguments.
Definition: int.hh:608
Passing Boolean variables.
Definition: int.hh:691
Gecode::Driver::IntOption _seed
Random seed.
Definition: flatzinc.hh:244
virtual void help(void)
Print help text.
Definition: flatzinc.hh:343
bool _optVarIsInt
Whether variable to optimize is integer (or float)
Definition: flatzinc.hh:444
Boolean variable array.
Definition: int.hh:787
Boolean integer variables.
Definition: int.hh:492
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:544
Class represeting a set of tuples.
Definition: int.hh:2144
String-valued option (integer value defined by strings)
Definition: driver.hh:178
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:953
void print(std::basic_ostream< Char, Traits > &s, bool assigned, IL &lb, IU &ub, unsigned int cardMin, unsigned int cardMax)
Print set view.
Definition: print.hpp:67
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Gecode::Driver::BoolOption _interrupt
Whether to catch SIGINT.
Definition: flatzinc.hh:250
Passing set variables.
Definition: set.hh:492
Print statistics for script.
Definition: driver.hh:101
Run script with CP-profiler.
Definition: driver.hh:103
Gecode::Driver::DoubleOption _r_base
Restart base.
Definition: flatzinc.hh:246
Set variables
Definition: set.hh:131
void value(const char *v)
Set default value to v.
Definition: options.cpp:117
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
unsigned int fail(void) const
Definition: flatzinc.hh:357
Restart with geometric sequence.
Definition: driver.hh:115
Gecode::Driver::BoolOption _nogoods
Whether to use no-goods.
Definition: flatzinc.hh:248
Integer variables.
Definition: int.hh:351
Gecode::Driver::DoubleOption _threads
How many threads to use.
Definition: flatzinc.hh:236
Exception class for FlatZinc errors
Definition: flatzinc.hh:660
AST::Array * _solveAnnotations
Annotations on the solve item.
Definition: flatzinc.hh:459
unsigned int c_d(void) const
Definition: flatzinc.hh:354
Gecode::Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Definition: flatzinc.hh:239
Run script in Gist.
Definition: driver.hh:102
void value(bool v)
Set default value to v.
Definition: options.hpp:128
double restart_base(void) const
Definition: flatzinc.hh:371
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
Definition: search.hh:115
unsigned int time(void) const
Definition: flatzinc.hh:358
Float variables.
Definition: float.hh:874
Rnd _random
Random number generator.
Definition: flatzinc.hh:456
#define GECODE_HAS_FLOAT_VARS
Definition: config.hpp:32
A space that can be initialized with a FlatZinc model.
Definition: flatzinc.hh:422
unsigned int restart_scale(void) const
Definition: flatzinc.hh:372
Set variable array
Definition: set.hh:572
CompareStatus compare(I &i, J &j)
Check whether range iterator i is a subset of j, or whether they are disjoint.
const std::string & setVarName(int i) const
Definition: flatzinc.hh:200
Gecode::Driver::StringValueOption _output
Output file.
Definition: flatzinc.hh:258
Gecode toplevel namespace
int setVarCount
Number of set variables.
Definition: flatzinc.hh:439
int intVarCount
Number of integer variables.
Definition: flatzinc.hh:433
unsigned int a_d(void) const
Definition: flatzinc.hh:355
#define GECODE_VTABLE_EXPORT
Definition: support.hh:76
A node in a FlatZinc abstract syntax tree.
Definition: ast.hh:71
const unsigned int nogoods_limit
Depth limit for no-good generation during search.
Definition: search.hh:133
Gecode::Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Definition: flatzinc.hh:241
Random number generator.
Definition: rnd.hpp:46
unsigned int _lns
Percentage of variables to keep in LNS (or 0 for no LNS)
Definition: flatzinc.hh:450
double FloatNum
Floating point number base type.
Definition: float.hh:110
const std::string & boolVarName(int i) const
Definition: flatzinc.hh:193
FlatZincOptions(const char *s)
Constructor.
Definition: flatzinc.hh:271
Restart with constant sequence.
Definition: driver.hh:112
Integer option.
Definition: driver.hh:213
IntSharedArray _lnsInitialSolution
Initial solution to start the LNS (or NULL for no LNS)
Definition: flatzinc.hh:453
void parse(int &argc, char *argv[])
Definition: flatzinc.hh:334
virtual void help(void)
Print help text.
Definition: options.cpp:490
Rnd defrnd
Uninitialized default random number generator.
Definition: flatzinc.cpp:92