Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
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 * This file is part of Gecode, the generic constraint
14 * development environment:
15 * http://www.gecode.org
16 *
17 * Permission is hereby granted, free of charge, to any person obtaining
18 * a copy of this software and associated documentation files (the
19 * "Software"), to deal in the Software without restriction, including
20 * without limitation the rights to use, copy, modify, merge, publish,
21 * distribute, sublicense, and/or sell copies of the Software, and to
22 * permit persons to whom the Software is furnished to do so, subject to
23 * the following conditions:
24 *
25 * The above copyright notice and this permission notice shall be
26 * included in all copies or substantial portions of the Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 *
36 */
37
38#ifndef __GECODE_FLATZINC_HH__
39#define __GECODE_FLATZINC_HH__
40
41#include <iostream>
42
43#include <gecode/kernel.hh>
44#include <gecode/int.hh>
45#ifdef GECODE_HAS_SET_VARS
46#include <gecode/set.hh>
47#endif
48#ifdef GECODE_HAS_FLOAT_VARS
49#include <gecode/float.hh>
50#endif
51#include <map>
52
53/*
54 * Support for DLLs under Windows
55 *
56 */
57
58#if !defined(GECODE_STATIC_LIBS) && \
59 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
60
61#ifdef GECODE_BUILD_FLATZINC
62#define GECODE_FLATZINC_EXPORT __declspec( dllexport )
63#else
64#define GECODE_FLATZINC_EXPORT __declspec( dllimport )
65#endif
66
67#else
68
69#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
70
71#define GECODE_FLATZINC_EXPORT __attribute__ ((visibility("default")))
72
73#else
74
75#define GECODE_FLATZINC_EXPORT
76
77#endif
78#endif
79
80// Configure auto-linking
81#ifndef GECODE_BUILD_FLATZINC
82#define GECODE_LIBRARY_NAME "FlatZinc"
84#endif
85
86#include <gecode/driver.hh>
87
91
101namespace Gecode { namespace FlatZinc {
102
108 private:
110 std::vector<std::string> iv_names;
112 std::vector<std::string> bv_names;
113#ifdef GECODE_HAS_FLOAT_VARS
115 std::vector<std::string> fv_names;
116#endif
117#ifdef GECODE_HAS_SET_VARS
119 std::vector<std::string> sv_names;
120#endif
121 AST::Array* _output;
122 void printElem(std::ostream& out,
123 AST::Node* ai,
124 const Gecode::IntVarArray& iv,
125 const Gecode::BoolVarArray& bv
127 ,
128 const Gecode::SetVarArray& sv
129#endif
131 ,
132 const Gecode::FloatVarArray& fv
133#endif
134 ) const;
135 void printElemDiff(std::ostream& out,
136 AST::Node* ai,
137 const Gecode::IntVarArray& iv1,
138 const Gecode::IntVarArray& iv2,
139 const Gecode::BoolVarArray& bv1,
140 const Gecode::BoolVarArray& bv2
142 ,
143 const Gecode::SetVarArray& sv1,
144 const Gecode::SetVarArray& sv2
145#endif
147 ,
148 const Gecode::FloatVarArray& fv1,
149 const Gecode::FloatVarArray& fv2
150#endif
151 ) const;
152 public:
153 Printer(void) : _output(NULL) {}
154 void init(AST::Array* output);
155
156 void print(std::ostream& out,
157 const Gecode::IntVarArray& iv,
158 const Gecode::BoolVarArray& bv
160 ,
161 const Gecode::SetVarArray& sv
162#endif
164 ,
165 const Gecode::FloatVarArray& fv
166#endif
167 ) const;
168
169 void printDiff(std::ostream& out,
170 const Gecode::IntVarArray& iv1, const Gecode::IntVarArray& iv2,
171 const Gecode::BoolVarArray& bv1, const Gecode::BoolVarArray& bv2
173 ,
174 const Gecode::SetVarArray& sv1, const Gecode::SetVarArray& sv2
175#endif
177 ,
178 const Gecode::FloatVarArray& fv1,
179 const Gecode::FloatVarArray& fv2
180#endif
181 ) const;
182
183
184 ~Printer(void);
185
186 void addIntVarName(const std::string& n);
187 const std::string& intVarName(int i) const { return iv_names[i]; }
188 void addBoolVarName(const std::string& n);
189 const std::string& boolVarName(int i) const { return bv_names[i]; }
190#ifdef GECODE_HAS_FLOAT_VARS
191 void addFloatVarName(const std::string& n);
192 const std::string& floatVarName(int i) const { return fv_names[i]; }
193#endif
194#ifdef GECODE_HAS_SET_VARS
195 void addSetVarName(const std::string& n);
196 const std::string& setVarName(int i) const { return sv_names[i]; }
197#endif
198
199 void shrinkElement(AST::Node* node,
200 std::map<int,int>& iv, std::map<int,int>& bv,
201 std::map<int,int>& sv, std::map<int,int>& fv);
202
203 void shrinkArrays(Space& home,
204 int& optVar, bool optVarIsInt,
208 ,
210#endif
212 ,
214#endif
215 );
216
217 private:
218 Printer(const Printer&);
219 Printer& operator=(const Printer&);
220 };
221
227 protected:
229
250
252
256
257#ifdef GECODE_HAS_CPPROFILER
258
262
263#endif
264
266 public:
268 FlatZincOptions(const char* s)
269 : Gecode::BaseOptions(s),
270 _solutions("n","number of solutions (0 = all, -1 = one/best)",-1),
271 _allSolutions("a", "return all solutions (equal to -n 0)"),
272 _threads("p","number of threads (0 = #processing units)",
273 Gecode::Search::Config::threads),
274 _free("f", "free search, no need to follow search-specification"),
275 _decay("decay","decay factor",0.99),
276 _c_d("c-d","recomputation commit distance",Gecode::Search::Config::c_d),
277 _a_d("a-d","recomputation adaption distance",Gecode::Search::Config::a_d),
278 _node("node","node cutoff (0 = none, solution mode)"),
279 _fail("fail","failure cutoff (0 = none, solution mode)"),
280 _time("time","time (in ms) cutoff (0 = none, solution mode)"),
281 _time_limit("t","time (in ms) cutoff (0 = none, solution mode)"),
282 _seed("r","random seed",0),
283 _restart("restart","restart sequence type",RM_NONE),
284 _r_base("restart-base","base for geometric restart sequence",1.5),
285 _r_scale("restart-scale","scale factor for restart sequence",250),
286 _nogoods("nogoods","whether to use no-goods from restarts",false),
287 _nogoods_limit("nogoods-limit","depth limit for no-good extraction",
288 Search::Config::nogoods_limit),
289 _interrupt("interrupt","whether to catch Ctrl-C (true) or not (false)",
290 true),
291 _step("step","step distance for float optimization",0.0),
292 _mode("mode","how to execute script",Gecode::SM_SOLUTION),
293 _stat("s","emit statistics"),
294 _output("o","file to send output to")
295
296#ifdef GECODE_HAS_CPPROFILER
297 ,
298 _profiler_id("cpprofiler-id", "use this execution id with cpprofiler", 0),
299 _profiler_port("cpprofiler-port", "connect to cpprofiler on this port", 6565),
300 _profiler_info("cpprofiler-info", "send solution information to cpprofiler", false)
301
302#endif
303 {
304 _mode.add(Gecode::SM_SOLUTION, "solution");
305 _mode.add(Gecode::SM_STAT, "stat");
306 _mode.add(Gecode::SM_GIST, "gist");
307 _mode.add(Gecode::SM_CPPROFILER, "cpprofiler");
308 _restart.add(RM_NONE,"none");
309 _restart.add(RM_CONSTANT,"constant");
310 _restart.add(RM_LINEAR,"linear");
311 _restart.add(RM_LUBY,"luby");
312 _restart.add(RM_GEOMETRIC,"geometric");
313
316 add(_free);
317 add(_decay);
319 add(_seed);
320 add(_step);
323 add(_mode); add(_stat);
324 add(_output);
325#ifdef GECODE_HAS_CPPROFILER
329#endif
330 }
331
332 void parse(int& argc, char* argv[]) {
334 if (_allSolutions.value() && _solutions.value()==-1) {
335 _solutions.value(0);
336 }
337 if (_time_limit.value()) {
339 }
340 if (_stat.value())
342 }
343
344 virtual void help(void) {
345 std::cerr << "Gecode FlatZinc interpreter" << std::endl
346 << " - Supported FlatZinc version: " << GECODE_FLATZINC_VERSION
347 << std::endl << std::endl;
349 }
350
351 int solutions(void) const { return _solutions.value(); }
352 bool allSolutions(void) const { return _allSolutions.value(); }
353 double threads(void) const { return _threads.value(); }
354 bool free(void) const { return _free.value(); }
355 unsigned int c_d(void) const { return _c_d.value(); }
356 unsigned int a_d(void) const { return _a_d.value(); }
357 unsigned int node(void) const { return _node.value(); }
358 unsigned int fail(void) const { return _fail.value(); }
359 unsigned int time(void) const { return _time.value(); }
360 int seed(void) const { return _seed.value(); }
361 double step(void) const { return _step.value(); }
362 const char* output(void) const { return _output.value(); }
363
365 return static_cast<Gecode::ScriptMode>(_mode.value());
366 }
367
368 double decay(void) const { return _decay.value(); }
369 RestartMode restart(void) const {
370 return static_cast<RestartMode>(_restart.value());
371 }
373 _restart.value(rm);
374 }
375 double restart_base(void) const { return _r_base.value(); }
376 void restart_base(double d) { _r_base.value(d); }
377 unsigned int restart_scale(void) const { return _r_scale.value(); }
378 void restart_scale(int i) { _r_scale.value(i); }
379 bool nogoods(void) const { return _nogoods.value(); }
380 unsigned int nogoods_limit(void) const { return _nogoods_limit.value(); }
381 bool interrupt(void) const { return _interrupt.value(); }
382
383#ifdef GECODE_HAS_CPPROFILER
384
385 int profiler_id(void) const { return _profiler_id.value(); }
386 unsigned int profiler_port(void) const { return _profiler_port.value(); }
387 bool profiler_info(void) const { return _profiler_info.value(); }
388
389#endif
390
392 };
393
395 public:
397 BranchInformation(void);
401 void init(void);
403 void add(BrancherGroup bg,
404 const std::string& rel0,
405 const std::string& rel1,
406 const std::vector<std::string>& n);
408 void print(const Brancher& b,
409 unsigned int a, int i, int n, std::ostream& o) const;
410#ifdef GECODE_HAS_FLOAT_VARS
412 void print(const Brancher& b,
413 unsigned int a, int i, const FloatNumBranch& nl,
414 std::ostream& o) const;
415#endif
416 };
417
420 extern Rnd defrnd;
421
423
429 public:
430 enum Meth {
431 SAT, //< Solve as satisfaction problem
432 MIN, //< Solve as minimization problem
433 MAX //< Solve as maximization problem
434 };
435 protected:
446
451
454
456 unsigned int _lns;
457
460
463
466
469 private:
471 template<template<class> class Engine>
472 void
473 runEngine(std::ostream& out, const Printer& p,
474 const FlatZincOptions& opt, Gecode::Support::Timer& t_total);
476 template<template<class> class Engine,
477 template<class, template<class> class> class Meta>
478 void
479 runMeta(std::ostream& out, const Printer& p,
480 const FlatZincOptions& opt, Gecode::Support::Timer& t_total);
481 void
482 branchWithPlugin(AST::Node* ann);
483 public:
488
491
493 std::vector<bool> iv_introduced;
495 int* iv_boolalias;
501 std::vector<bool> bv_introduced;
502#ifdef GECODE_HAS_SET_VARS
508 std::vector<bool> sv_introduced;
509#endif
510#ifdef GECODE_HAS_FLOAT_VARS
516 std::vector<bool> fv_introduced;
519#endif
521 bool needAuxVars;
523 FlatZincSpace(Rnd& random = defrnd);
524
526 ~FlatZincSpace(void);
527
529 void init(int intVars, int boolVars, int setVars, int floatVars);
530
532 void newIntVar(IntVarSpec* vs);
534 void aliasBool2Int(int iv, int bv);
536 int aliasBool2Int(int iv);
538 void newBoolVar(BoolVarSpec* vs);
540 void newSetVar(SetVarSpec* vs);
542 void newFloatVar(FloatVarSpec* vs);
543
545 void postConstraints(std::vector<ConExpr*>& ces);
546
548 void solve(AST::Array* annotation);
550 void minimize(int var, bool isInt, AST::Array* annotation);
552 void maximize(int var, bool isInt, AST::Array* annotation);
553
555 void run(std::ostream& out, const Printer& p,
556 const FlatZincOptions& opt, Gecode::Support::Timer& t_total);
557
559 void print(std::ostream& out, const Printer& p) const;
560#ifdef GECODE_HAS_CPPROFILER
562 std::string getDomains(const Printer& p) const;
563#endif
566 void compare(const Space& s, std::ostream& out) const;
569 void compare(const FlatZincSpace& s, std::ostream& out,
570 const Printer& p) const;
571
580 void shrinkArrays(Printer& p);
581
583 Meth method(void) const;
584
586 int optVar(void) const;
588 bool optVarIsInt(void) const;
589
599 void createBranchers(Printer& p, AST::Node* ann,
600 FlatZincOptions& opt, bool ignoreUnknown,
601 std::ostream& err = std::cerr);
602
604 AST::Array* solveAnnotations(void) const;
605
608
610 virtual void constrain(const Space& s);
612 virtual Gecode::Space* copy(void);
614 virtual bool slave(const MetaInfo& mi);
615
617
618
619 IntArgs arg2intargs(AST::Node* arg, int offset = 0);
621 IntSharedArray arg2intsharedarray(AST::Node* arg, int offset = 0);
623 IntArgs arg2boolargs(AST::Node* arg, int offset = 0);
625 IntSharedArray arg2boolsharedarray(AST::Node* arg, int offset = 0);
627 IntSet arg2intset(AST::Node* n);
629 IntSetArgs arg2intsetargs(AST::Node* arg, int offset = 0);
631 IntVarArgs arg2intvarargs(AST::Node* arg, int offset = 0);
633 BoolVarArgs arg2boolvarargs(AST::Node* arg, int offset = 0, int siv=-1);
635 BoolVar arg2BoolVar(AST::Node* n);
637 IntVar arg2IntVar(AST::Node* n);
639 TupleSet arg2tupleset(const IntArgs& a, int noOfVars);
641 bool isBoolArray(AST::Node* b, int& singleInt);
642#ifdef GECODE_HAS_SET_VARS
644 SetVar arg2SetVar(AST::Node* n);
646 SetVarArgs arg2setvarargs(AST::Node* arg, int offset = 0, int doffset = 0,
647 const IntSet& od=IntSet::empty);
648#endif
649#ifdef GECODE_HAS_FLOAT_VARS
651 FloatValArgs arg2floatargs(AST::Node* arg, int offset = 0);
653 FloatVar arg2FloatVar(AST::Node* n);
655 FloatVarArgs arg2floatvarargs(AST::Node* arg, int offset = 0);
656#endif
658 IntPropLevel ann2ipl(AST::Node* ann);
660 DFA getSharedDFA(DFA& a);
662 };
663
666 private:
667 const std::string msg;
668 public:
669 Error(const std::string& where, const std::string& what)
670 : msg(where+": "+what) {}
671 const std::string& toString(void) const { return msg; }
672 };
673
680 FlatZincSpace* parse(const std::string& fileName,
681 Printer& p, std::ostream& err = std::cerr,
682 FlatZincSpace* fzs=NULL, Rnd& rnd=defrnd);
683
690 FlatZincSpace* parse(std::istream& is,
691 Printer& p, std::ostream& err = std::cerr,
692 FlatZincSpace* fzs=NULL, Rnd& rnd=defrnd);
693
694}}
695
696#endif
697
698// STATISTICS: flatzinc-any
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.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Base class for script options.
Definition driver.hh:331
void add(Driver::BaseOption &o)
Add new option o.
Definition options.cpp:474
virtual void help(void)
Print help text.
Definition options.cpp:494
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition options.cpp:548
Passing Boolean variables.
Definition int.hh:712
Boolean variable array.
Definition int.hh:808
Boolean integer variables.
Definition int.hh:512
Group of branchers.
Definition core.hpp:799
Base-class for branchers.
Definition core.hpp:1442
Deterministic finite automaton (DFA)
Definition int.hh:2049
Boolean option.
Definition driver.hh:269
void value(bool v)
Set default value to v.
Definition options.hpp:124
void value(double v)
Set default value to v.
Definition options.hpp:108
Integer option.
Definition driver.hh:209
void value(int v)
Set default value to v.
Definition options.hpp:74
String-valued option (integer value defined by strings)
Definition driver.hh:174
void value(int v)
Set default value to v.
Definition options.hpp:58
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:138
String-valued option.
Definition driver.hh:151
void value(const char *v)
Set default value to v.
Definition options.cpp:113
Unsigned integer option.
Definition driver.hh:229
void value(unsigned int v)
Set default value to v.
Definition options.hpp:91
A node in a FlatZinc abstract syntax tree.
Definition ast.hh:67
void init(void)
Initialise for use.
Definition flatzinc.cpp:315
void print(const Brancher &b, unsigned int a, int i, int n, std::ostream &o) const
Output branch information.
Definition flatzinc.cpp:328
void add(BrancherGroup bg, const std::string &rel0, const std::string &rel1, const std::vector< std::string > &n)
Add new brancher information.
Definition flatzinc.cpp:321
Exception class for FlatZinc errors
Definition flatzinc.hh:665
Error(const std::string &where, const std::string &what)
Definition flatzinc.hh:669
const std::string & toString(void) const
Definition flatzinc.hh:671
Options for running FlatZinc models
Definition flatzinc.hh:226
Gecode::Driver::BoolOption _interrupt
Whether to catch SIGINT.
Definition flatzinc.hh:247
Gecode::Driver::BoolOption _nogoods
Whether to use no-goods.
Definition flatzinc.hh:245
Gecode::Driver::BoolOption _allSolutions
Return all solutions.
Definition flatzinc.hh:231
Gecode::Driver::BoolOption _stat
Emit statistics.
Definition flatzinc.hh:254
unsigned int time(void) const
Script mode to run.
Definition flatzinc.hh:359
void allSolutions(bool b)
Script mode to run.
Definition flatzinc.hh:391
bool allSolutions(void) const
Script mode to run.
Definition flatzinc.hh:352
unsigned int fail(void) const
Script mode to run.
Definition flatzinc.hh:358
Gecode::Driver::BoolOption _free
Use free search.
Definition flatzinc.hh:233
FlatZincOptions(const char *s)
Constructor.
Definition flatzinc.hh:268
int seed(void) const
Script mode to run.
Definition flatzinc.hh:360
double decay(void) const
Script mode to run.
Definition flatzinc.hh:368
Gecode::Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Definition flatzinc.hh:259
unsigned int nogoods_limit(void) const
Script mode to run.
Definition flatzinc.hh:380
Gecode::Driver::UnsignedIntOption _nogoods_limit
Depth limit for extracting no-goods.
Definition flatzinc.hh:246
const char * output(void) const
Script mode to run.
Definition flatzinc.hh:362
RestartMode restart(void) const
Script mode to run.
Definition flatzinc.hh:369
Gecode::Driver::UnsignedIntOption _r_scale
Restart scale factor.
Definition flatzinc.hh:244
double restart_base(void) const
Script mode to run.
Definition flatzinc.hh:375
virtual void help(void)
Script mode to run.
Definition flatzinc.hh:344
int solutions(void) const
Script mode to run.
Definition flatzinc.hh:351
Gecode::Driver::UnsignedIntOption _time_limit
Cutoff for time (for compatibility with flatzinc command line)
Definition flatzinc.hh:240
Gecode::Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Definition flatzinc.hh:237
bool nogoods(void) const
Script mode to run.
Definition flatzinc.hh:379
double step(void) const
Script mode to run.
Definition flatzinc.hh:361
Gecode::Driver::DoubleOption _step
Step option.
Definition flatzinc.hh:248
Gecode::ScriptMode mode(void) const
Script mode to run.
Definition flatzinc.hh:364
bool interrupt(void) const
Script mode to run.
Definition flatzinc.hh:381
Gecode::Driver::StringValueOption _output
Output file.
Definition flatzinc.hh:255
void parse(int &argc, char *argv[])
Script mode to run.
Definition flatzinc.hh:332
unsigned int profiler_port(void) const
Script mode to run.
Definition flatzinc.hh:386
Gecode::Driver::BoolOption _profiler_info
Whether solution information should be sent to the CP-profiler.
Definition flatzinc.hh:261
void restart(RestartMode rm)
Script mode to run.
Definition flatzinc.hh:372
Gecode::Driver::DoubleOption _r_base
Restart base.
Definition flatzinc.hh:243
Gecode::Driver::UnsignedIntOption _profiler_port
Connect to this port.
Definition flatzinc.hh:260
Gecode::Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Definition flatzinc.hh:235
int profiler_id(void) const
Script mode to run.
Definition flatzinc.hh:385
void restart_scale(int i)
Script mode to run.
Definition flatzinc.hh:378
Gecode::Driver::StringOption _mode
Script mode to run.
Definition flatzinc.hh:253
unsigned int restart_scale(void) const
Script mode to run.
Definition flatzinc.hh:377
unsigned int a_d(void) const
Script mode to run.
Definition flatzinc.hh:356
unsigned int c_d(void) const
Script mode to run.
Definition flatzinc.hh:355
bool profiler_info(void) const
Script mode to run.
Definition flatzinc.hh:387
Gecode::Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Definition flatzinc.hh:236
Gecode::Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Definition flatzinc.hh:238
unsigned int node(void) const
Script mode to run.
Definition flatzinc.hh:357
bool free(void) const
Script mode to run.
Definition flatzinc.hh:354
Gecode::Driver::DoubleOption _threads
How many threads to use.
Definition flatzinc.hh:232
Gecode::Driver::IntOption _seed
Random seed.
Definition flatzinc.hh:241
Gecode::Driver::IntOption _solutions
How many solutions.
Definition flatzinc.hh:230
Gecode::Driver::DoubleOption _decay
Decay option.
Definition flatzinc.hh:234
double threads(void) const
Script mode to run.
Definition flatzinc.hh:353
Gecode::Driver::UnsignedIntOption _time
Cutoff for time.
Definition flatzinc.hh:239
Gecode::Driver::StringOption _restart
Restart method option.
Definition flatzinc.hh:242
void restart_base(double d)
Script mode to run.
Definition flatzinc.hh:376
A space that can be initialized with a FlatZinc model.
Definition flatzinc.hh:428
unsigned int _lns
Percentage of variables to keep in LNS (or 0 for no LNS)
Definition flatzinc.hh:456
Rnd _random
Random number generator.
Definition flatzinc.hh:462
AST::Array * _solveAnnotations
Annotations on the solve item.
Definition flatzinc.hh:465
int _optVar
Index of the variable to optimize.
Definition flatzinc.hh:448
bool _optVarIsInt
Whether variable to optimize is integer (or float)
Definition flatzinc.hh:450
FlatZincSpaceInitData * _initData
Initialisation data (only used for posting constraints)
Definition flatzinc.hh:437
int floatVarCount
Number of float variables.
Definition flatzinc.hh:443
int boolVarCount
Number of Boolean variables.
Definition flatzinc.hh:441
int setVarCount
Number of set variables.
Definition flatzinc.hh:445
IntSharedArray _lnsInitialSolution
Initial solution to start the LNS (or NULL for no LNS)
Definition flatzinc.hh:459
Meth _method
Whether to solve as satisfaction or optimization problem.
Definition flatzinc.hh:453
int intVarCount
Number of integer variables.
Definition flatzinc.hh:439
Output support class for FlatZinc interpreter.
Definition flatzinc.hh:107
const std::string & setVarName(int i) const
Definition flatzinc.hh:196
const std::string & boolVarName(int i) const
Definition flatzinc.hh:189
const std::string & intVarName(int i) const
Definition flatzinc.hh:187
const std::string & floatVarName(int i) const
Definition flatzinc.hh:192
Value description class for branching.
Definition float.hh:1462
Passing float arguments.
Definition float.hh:950
Passing float variables.
Definition float.hh:979
Float variable array.
Definition float.hh:1030
Float variables.
Definition float.hh:870
Passing integer arguments.
Definition int.hh:628
Integer sets.
Definition int.hh:174
Passing integer variables.
Definition int.hh:656
Integer variable array.
Definition int.hh:763
Integer variables.
Definition int.hh:371
Random number generator.
Definition rnd.hpp:42
Passing set variables.
Definition set.hh:488
Set variable array
Definition set.hh:570
Set variables
Definition set.hh:127
The shared handle.
Computation spaces.
Definition core.hpp:1742
Class represeting a set of tuples.
Definition int.hh:2191
#define GECODE_FLATZINC_EXPORT
Definition flatzinc.hh:75
ScriptMode
Different modes for executing scripts.
Definition driver.hh:94
RestartMode
Different modes for restart-based search.
Definition driver.hh:106
@ SM_STAT
Print statistics for script.
Definition driver.hh:97
@ SM_SOLUTION
Print solution and some statistics.
Definition driver.hh:95
@ SM_GIST
Run script in Gist.
Definition driver.hh:98
@ SM_CPPROFILER
Run script with CP-profiler.
Definition driver.hh:99
@ RM_CONSTANT
Restart with constant sequence.
Definition driver.hh:108
@ RM_LINEAR
Restart with linear sequence.
Definition driver.hh:109
@ RM_LUBY
Restart with Luby sequence.
Definition driver.hh:110
@ RM_NONE
No restarts.
Definition driver.hh:107
@ RM_GEOMETRIC
Restart with geometric sequence.
Definition driver.hh:111
double FloatNum
Floating point number base type.
Definition float.hh:106
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
void print(const Search::Statistics &stat, bool restart)
Print statistics.
Definition job-shop.cpp:606
void solve(const JobShopOptions &opt)
Solver.
Definition job-shop.cpp:618
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.
GECODE_FLATZINC_EXPORT Rnd defrnd
Uninitialized default random number generator.
Gecode toplevel namespace
#define GECODE_HAS_FLOAT_VARS
Definition config.hpp:35
#define GECODE_HAS_SET_VARS
Definition config.hpp:56
#define GECODE_FLATZINC_VERSION
Definition config.hpp:17
#define GECODE_VTABLE_EXPORT
Definition support.hh:72