Generated on for Gecode by doxygen 1.17.0
int.hh
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.dev>
5 * Guido Tack <tack@gecode.dev>
6 *
7 * Contributing authors:
8 * Stefano Gualandi <stefano.gualandi@gmail.com>
9 * Mikael Zayenz Lagerkvist <lagerkvist@gecode.dev>
10 * David Rijsman <David.Rijsman@quintiq.com>
11 * Samuel Gagnon <samuel.gagnon92@gmail.com>
12 *
13 * Copyright:
14 * Stefano Gualandi, 2013
15 * Mikael Zayenz Lagerkvist, 2006, 2026
16 * David Rijsman, 2009
17 * Christian Schulte, 2002
18 * Guido Tack, 2004
19 * Samuel Gagnon, 2018
20 *
21 * This file is part of Gecode, the generic constraint
22 * development environment:
23 * http://www.gecode.dev
24 *
25 * Permission is hereby granted, free of charge, to any person obtaining
26 * a copy of this software and associated documentation files (the
27 * "Software"), to deal in the Software without restriction, including
28 * without limitation the rights to use, copy, modify, merge, publish,
29 * distribute, sublicense, and/or sell copies of the Software, and to
30 * permit persons to whom the Software is furnished to do so, subject to
31 * the following conditions:
32 *
33 * The above copyright notice and this permission notice shall be
34 * included in all copies or substantial portions of the Software.
35 *
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
40 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
41 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
42 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 *
44 */
45
46#ifndef GECODE_INT_HH
47#define GECODE_INT_HH
48
49#include <climits>
50#include <cfloat>
51
52#ifdef GECODE_HAS_FAULT_INJECTION
53#include <atomic>
54#endif
55
56#include <iostream>
57#include <vector>
58#include <unordered_map>
59#include <unordered_set>
60#include <functional>
61#include <utility>
62#include <initializer_list>
63
64#include <gecode/kernel.hh>
65#include <gecode/search.hh>
66#include <gecode/iter.hh>
67
68/*
69 * Configure linking
70 *
71 */
72#if !defined(GECODE_STATIC_LIBS) && \
73 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
74
75#ifdef GECODE_BUILD_INT
76#define GECODE_INT_EXPORT __declspec( dllexport )
77#else
78#define GECODE_INT_EXPORT __declspec( dllimport )
79#endif
80
81#else
82
83#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
84#define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
85#else
86#define GECODE_INT_EXPORT
87#endif
88
89#endif
90
91// Configure auto-linking
92#ifndef GECODE_BUILD_INT
93#define GECODE_LIBRARY_NAME "Int"
95#endif
96
107
109
110namespace Gecode { namespace Int {
111
119 namespace Limits {
121 const int max = INT_MAX - 1;
123 const int min = -max;
125 const int infinity = max + 1;
127 const long long int llmax = LLONG_MAX - 1;
129 const long long int llmin = -llmax;
131 const long long int llinfinity = llmax + 1;
133 bool valid(int n);
135 bool valid(long long int n);
137 void check(int n, const char* l);
139 void check(long long int n, const char* l);
141 void positive(int n, const char* l);
143 void positive(long long int n, const char* l);
145 void nonnegative(int n, const char* l);
147 void nonnegative(long long int n, const char* l);
149 bool overflow_add(int n, int m);
151 bool overflow_add(long long int n, long long int m);
153 bool overflow_sub(int n, int m);
155 bool overflow_sub(long long int n, long long int m);
157 bool overflow_mul(int n, int m);
159 bool overflow_mul(long long int n, long long int m);
160 }
161
162}}
163
164#include <gecode/int/limits.hpp>
165
166namespace Gecode {
167
168 class IntSetRanges;
169
170 template<class I> class IntSetInit;
171
179 class IntSet : public SharedHandle {
180 friend class IntSetRanges;
181 template<class I> friend class IntSetInit;
182 private:
184 class Range {
185 public:
186 int min, max;
187 };
188 class IntSetObject : public SharedHandle::Object {
189 public:
191 unsigned int size;
193 int n;
195 Range* r;
196#ifdef GECODE_HAS_FAULT_INJECTION
198 static std::atomic<int> fault_live_objects;
200 static void* operator new(size_t s);
202 static void operator delete(void* p);
203#endif
205 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
207 GECODE_INT_EXPORT bool in(int n) const;
209 GECODE_INT_EXPORT bool equal(const IntSetObject& so) const;
211 GECODE_INT_EXPORT virtual ~IntSetObject(void);
212 };
214 class MinInc;
216 GECODE_INT_EXPORT void normalize(Range* r, int n);
218 GECODE_INT_EXPORT void init(int n, int m);
220 GECODE_INT_EXPORT void init(const int r[], int n);
222 GECODE_INT_EXPORT void init(const int r[][2], int n);
223 public:
224#ifdef GECODE_HAS_FAULT_INJECTION
226 GECODE_INT_EXPORT static void fault_reset_allocations(void);
228 GECODE_INT_EXPORT static int fault_live_allocations(void);
229#endif
231
232
233 IntSet(void);
238 explicit IntSet(int n, int m);
240 explicit IntSet(const int r[], int n);
246 explicit IntSet(const int r[][2], int n);
248 template<class I>
249 explicit IntSet(I& i);
251 template<class I>
252 explicit IntSet(const I& i);
255 explicit IntSet(std::initializer_list<int> r);
262 explicit IntSet(std::initializer_list<std::pair<int,int>> r);
264
266
267
268 int ranges(void) const;
270 int min(int i) const;
272 int max(int i) const;
274 unsigned int width(int i) const;
276
278
279
280 bool in(int n) const;
282 unsigned int size(void) const;
284 unsigned int width(void) const;
286 int min(void) const;
288 int max(void) const;
290
292
293
294 bool operator ==(const IntSet& s) const;
296 bool operator !=(const IntSet& s) const;
298
300
301
304 };
305
312 private:
314 const IntSet::Range* i;
316 const IntSet::Range* e;
317 public:
319
320
321 IntSetRanges(void);
323 IntSetRanges(const IntSet& s);
325 void init(const IntSet& s);
327
329
330
331 bool operator ()(void) const;
333 void operator ++(void);
335
337
338
339 int min(void) const;
341 int max(void) const;
343 unsigned int width(void) const;
345 };
346
352 class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
353 public:
355
356
357 IntSetValues(void);
359 IntSetValues(const IntSet& s);
361 void init(const IntSet& s);
363 };
364
369 template<class Char, class Traits>
370 std::basic_ostream<Char,Traits>&
371 operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
372
373}
374
376
377#include <gecode/int/var-imp.hpp>
378
379namespace Gecode {
380
381 namespace Int {
382 class IntView;
383 }
384
390 class IntVar : public VarImpVar<Int::IntVarImp> {
391 friend class IntVarArray;
392 friend class IntVarArgs;
393 private:
401 void _init(Space& home, int min, int max);
408 void _init(Space& home, const IntSet& d);
409 public:
411
412
413 IntVar(void);
415 IntVar(const IntVar& y);
417 IntVar(const Int::IntView& y);
429 GECODE_INT_EXPORT IntVar(Space& home, int min, int max);
441 GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
443
445
446
447 int min(void) const;
449 int max(void) const;
451 int med(void) const;
459 int val(void) const;
460
462 unsigned int size(void) const;
464 unsigned int width(void) const;
466 unsigned int regret_min(void) const;
468 unsigned int regret_max(void) const;
470
472
473
474 bool range(void) const;
476 bool in(int n) const;
478
480 IntVar& operator =(const IntVar&) = default;
481 };
482
487 template<class Char, class Traits>
488 std::basic_ostream<Char,Traits>&
489 operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
490
496 public:
498
499
500 IntVarRanges(void);
502 IntVarRanges(const IntVar& x);
504 void init(const IntVar& x);
506 };
507
512 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
513 public:
515
516
517 IntVarValues(void);
519 IntVarValues(const IntVar& x);
521 void init(const IntVar& x);
523 };
524
525 namespace Int {
526 class BoolView;
527 }
528
534 class BoolVar : public VarImpVar<Int::BoolVarImp> {
535 friend class BoolVarArray;
536 friend class BoolVarArgs;
537 private:
545 void _init(Space& home, int min, int max);
546 public:
548
549
550 BoolVar(void);
552 BoolVar(const BoolVar& y);
554 BoolVar(const Int::BoolView& y);
566 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
568
570
571
572 int min(void) const;
574 int max(void) const;
576 int med(void) const;
584 int val(void) const;
585
587 unsigned int size(void) const;
589 unsigned int width(void) const;
591 unsigned int regret_min(void) const;
593 unsigned int regret_max(void) const;
595
597
598
599 bool range(void) const;
601 bool in(int n) const;
603
605
606
607 bool zero(void) const;
609 bool one(void) const;
611 bool none(void) const;
613
615 BoolVar& operator =(const BoolVar&) = default;
616 };
617
622 template<class Char, class Traits>
623 std::basic_ostream<Char,Traits>&
624 operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
625
626}
627
628
629#include <gecode/int/view.hpp>
631
632namespace Gecode {
633
641
643
645
646}
647
649
650namespace Gecode {
651
653 class IntArgs : public ArgArray<int> {
654 public:
656
657
658 IntArgs(void);
660 explicit IntArgs(int n);
662 IntArgs(const SharedArray<int>& x);
664 IntArgs(const std::vector<int>& x);
666 IntArgs(std::initializer_list<int> x);
668 template<class InputIterator>
669 IntArgs(InputIterator first, InputIterator last);
671 IntArgs(int n, const int* e);
673 IntArgs(const ArgArray<int>& a);
674
676 static IntArgs create(int n, int start, int inc=1);
678 };
679
681 class IntVarArgs : public VarArgArray<IntVar> {
682 public:
684
685
686 IntVarArgs(void);
688 explicit IntVarArgs(int n);
690 IntVarArgs(const IntVarArgs& a);
694 IntVarArgs(const std::vector<IntVar>& a);
696 IntVarArgs(std::initializer_list<IntVar> a);
698 template<class InputIterator>
699 IntVarArgs(InputIterator first, InputIterator last);
712 IntVarArgs(Space& home, int n, int min, int max);
725 IntVarArgs(Space& home, int n, const IntSet& s);
727 IntVarArgs& operator =(const IntVarArgs&) = default;
729 };
730
739 class BoolVarArgs : public VarArgArray<BoolVar> {
740 public:
742
743
744 BoolVarArgs(void);
746 explicit BoolVarArgs(int n);
748 BoolVarArgs(const BoolVarArgs& a);
752 BoolVarArgs(const std::vector<BoolVar>& a);
754 BoolVarArgs(std::initializer_list<BoolVar> a);
756 template<class InputIterator>
757 BoolVarArgs(InputIterator first, InputIterator last);
770 BoolVarArgs(Space& home, int n, int min, int max);
774 };
775
776
787
792 class IntVarArray : public VarArray<IntVar> {
793 public:
795
796
797 IntVarArray(void);
799 IntVarArray(Space& home, int n);
801 IntVarArray(const IntVarArray& a);
803 IntVarArray(Space& home, const IntVarArgs& a);
816 IntVarArray(Space& home, int n, int min, int max);
829 IntVarArray(Space& home, int n, const IntSet& s);
831
834 };
835
840 class BoolVarArray : public VarArray<BoolVar> {
841 public:
843
844
845 BoolVarArray(void);
847 BoolVarArray(Space& home, int n);
849 BoolVarArray(const BoolVarArray& a);
851 BoolVarArray(Space& home, const BoolVarArgs& a);
864 BoolVarArray(Space& home, int n, int min, int max);
866
869 };
870
871 namespace Int {
872 template<class Var> class OpenMaterialize;
873 }
874
875 template<class View> class OpenViewList;
876
922 template<class Var>
923 class OpenVarList : public LocalHandle {
924 template<class View> friend class OpenViewList;
925 friend class Int::OpenMaterialize<Var>;
926 private:
928 class Object;
930 explicit OpenVarList(Object* source);
931 public:
948 typedef std::function<Var(Space& home, int i)> Factory;
958 typedef std::function<void(Space& home, OpenVarList<Var> x, int i)>
963 OpenVarList(Space& home, Factory create,
969 void update(Space& home, OpenVarList<Var>& s);
971 int known_length(void) const;
973 Var operator [](int i) const;
975 IntVar length(void) const;
984 void append(Space& home, Var x);
992 void materialize(Space& home, int n);
1010 Var get(Space& home, int i);
1017 void close(Space& home);
1024 void subscribe(Space& home, Propagator& p);
1026 void cancel(Space& home, Propagator& p);
1028 void reschedule(Space& home, Propagator& p);
1029 };
1030
1031
1043 template<class View>
1044 class OpenViewList : public LocalHandle {
1045 private:
1046 typedef typename View::VarType Var;
1047 typedef typename OpenVarList<Var>::Object Object;
1048 public:
1050 OpenViewList(void);
1052 explicit OpenViewList(const OpenVarList<Var>& list);
1054 void update(Space& home, OpenViewList<View>& s);
1056 int known_length(void) const;
1058 View operator [](int i) const;
1060 Int::IntView length(void) const;
1062 void materialize(Space& home, int n);
1064 void subscribe(Space& home, Propagator& p);
1066 void cancel(Space& home, Propagator& p);
1068 void reschedule(Space& home, Propagator& p);
1069 };
1070
1071
1076 class OpenIntVarList : public OpenVarList<IntVar> {
1077 public:
1084 typedef std::function<IntSet(int i)> Domain;
1085 using OpenVarList<IntVar>::OpenVarList;
1089 OpenIntVarList(const OpenVarList<IntVar>& x);
1095 OpenIntVarList(Space& home, const IntSet& d,
1096 int max=Int::Limits::max);
1099 OpenIntVarList(Space& home, const IntSet& d, Transition t,
1100 int max=Int::Limits::max);
1103 OpenIntVarList(Space& home, Domain d,
1104 int max=Int::Limits::max);
1108 int max=Int::Limits::max);
1109 private:
1111 static Factory factory(Domain d);
1112 };
1113
1118 class OpenBoolVarList : public OpenVarList<BoolVar> {
1119 public:
1120 using OpenVarList<BoolVar>::OpenVarList;
1124 OpenBoolVarList(const OpenVarList<BoolVar>& x);
1131 int max=Int::Limits::max);
1132 };
1133
1134}
1135
1136#include <gecode/int/int-set-2.hpp>
1137
1138#include <gecode/int/array.hpp>
1139
1141
1142namespace Gecode {
1143
1171
1176 class Reify {
1177 protected:
1182 public:
1184 Reify(void);
1188 BoolVar var(void) const;
1190 ReifyMode mode(void) const;
1192 void var(BoolVar x);
1194 void mode(ReifyMode rm);
1195 };
1196
1201 Reify eqv(BoolVar x);
1202
1207 Reify imp(BoolVar x);
1208
1213 Reify pmi(BoolVar x);
1214
1215}
1216
1217#include <gecode/int/reify.hpp>
1218
1219namespace Gecode {
1220
1233
1236
1239
1240}
1241
1242#include <gecode/int/irt.hpp>
1243
1244namespace Gecode {
1245
1257
1287
1290
1293
1294}
1295
1296#include <gecode/int/ipl.hpp>
1297
1298namespace Gecode {
1299
1306 TT_FIXP, //< Task with fixed processing time
1307 TT_FIXS, //< Task with fixed start time
1308 TT_FIXE //< Task with fixed end time
1309 };
1310
1317
1319 template<>
1326
1327
1333
1335
1337 dom(Home home, IntVar x, int n,
1338 IntPropLevel ipl=IPL_DEF);
1341 dom(Home home, const IntVarArgs& x, int n,
1342 IntPropLevel ipl=IPL_DEF);
1343
1346 dom(Home home, IntVar x, int l, int m,
1347 IntPropLevel ipl=IPL_DEF);
1350 dom(Home home, const IntVarArgs& x, int l, int m,
1351 IntPropLevel ipl=IPL_DEF);
1352
1355 dom(Home home, IntVar x, const IntSet& s,
1356 IntPropLevel ipl=IPL_DEF);
1359 dom(Home home, const IntVarArgs& x, const IntSet& s,
1360 IntPropLevel ipl=IPL_DEF);
1361
1364 dom(Home home, IntVar x, int n, Reify r,
1365 IntPropLevel ipl=IPL_DEF);
1368 dom(Home home, IntVar x, int l, int m, Reify r,
1369 IntPropLevel ipl=IPL_DEF);
1372 dom(Home home, IntVar x, const IntSet& s, Reify r,
1373 IntPropLevel ipl=IPL_DEF);
1374
1377 dom(Home home, IntVar x, IntVar d,
1378 IntPropLevel ipl=IPL_DEF);
1381 dom(Home home, BoolVar x, BoolVar d,
1382 IntPropLevel ipl=IPL_DEF);
1385 dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
1386 IntPropLevel ipl=IPL_DEF);
1389 dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
1390 IntPropLevel ipl=IPL_DEF);
1392
1393
1405 rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
1406 IntPropLevel ipl=IPL_DEF);
1414 rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
1415 IntPropLevel ipl=IPL_DEF);
1420 rel(Home home, IntVar x, IntRelType irt, int c,
1421 IntPropLevel ipl=IPL_DEF);
1426 rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
1427 IntPropLevel ipl=IPL_DEF);
1435 rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
1436 IntPropLevel ipl=IPL_DEF);
1444 rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
1445 IntPropLevel ipl=IPL_DEF);
1461 rel(Home home, const IntVarArgs& x, IntRelType irt,
1462 IntPropLevel ipl=IPL_DEF);
1463
1472 rel(Home home, OpenIntVarList x, IntRelType irt,
1473 IntPropLevel ipl=IPL_DEF);
1489 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
1490 IntPropLevel ipl=IPL_DEF);
1505 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
1506 IntPropLevel ipl=IPL_DEF);
1521 rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
1522 IntPropLevel ipl=IPL_DEF);
1523
1532 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
1533 IntPropLevel ipl=IPL_DEF);
1538 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
1539 IntPropLevel ipl=IPL_DEF);
1544 rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
1545 IntPropLevel ipl=IPL_DEF);
1554 rel(Home home, BoolVar x, IntRelType irt, int n,
1555 IntPropLevel ipl=IPL_DEF);
1564 rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
1565 IntPropLevel ipl=IPL_DEF);
1574 rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
1575 IntPropLevel ipl=IPL_DEF);
1589 rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
1590 IntPropLevel ipl=IPL_DEF);
1604 rel(Home home, const BoolVarArgs& x, IntRelType irt, const IntArgs& y,
1605 IntPropLevel ipl=IPL_DEF);
1619 rel(Home home, const IntArgs& x, IntRelType irt, const BoolVarArgs& y,
1620 IntPropLevel ipl=IPL_DEF);
1632 rel(Home home, const BoolVarArgs& x, IntRelType irt,
1633 IntPropLevel ipl=IPL_DEF);
1640 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
1641 IntPropLevel ipl=IPL_DEF);
1651 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
1652 IntPropLevel ipl=IPL_DEF);
1663 rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
1664 IntPropLevel ipl=IPL_DEF);
1678 rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
1679 IntPropLevel ipl=IPL_DEF);
1691 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
1707 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
1708 int n, IntPropLevel ipl=IPL_DEF);
1719 ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
1720 IntPropLevel ipl=IPL_DEF);
1728 ite(Home home, BoolVar b, BoolVar x, BoolVar y, BoolVar z,
1729 IntPropLevel ipl=IPL_DEF);
1730
1731
1744 precede(Home home, const IntVarArgs& x, int s, int t,
1746
1757 precede(Home home, OpenIntVarList x, int s, int t,
1758 IntPropLevel ipl=IPL_DEF);
1767 precede(Home home, const IntVarArgs& x, const IntArgs& c,
1769
1778 precede(Home home, OpenIntVarList x, const IntArgs& c,
1779 IntPropLevel ipl=IPL_DEF);
1780
1781
1787
1789 member(Home home, const IntVarArgs& x, IntVar y,
1790 IntPropLevel ipl=IPL_DEF);
1793 member(Home home, const BoolVarArgs& x, BoolVar y,
1794 IntPropLevel ipl=IPL_DEF);
1797 member(Home home, const IntVarArgs& x, IntVar y, Reify r,
1798 IntPropLevel ipl=IPL_DEF);
1801 member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
1802 IntPropLevel ipl=IPL_DEF);
1804
1805
1810
1812
1820 element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
1821 IntPropLevel ipl=IPL_DEF);
1828 element(Home home, IntSharedArray n, IntVar x0, int offset, IntVar x1,
1829 IntPropLevel ipl=IPL_DEF);
1836 element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
1837 IntPropLevel ipl=IPL_DEF);
1844 element(Home home, IntSharedArray n, IntVar x0, int offset, BoolVar x1,
1845 IntPropLevel ipl=IPL_DEF);
1852 element(Home home, IntSharedArray n, IntVar x0, int x1,
1853 IntPropLevel ipl=IPL_DEF);
1860 element(Home home, IntSharedArray n, IntVar x0, int offset, int x1,
1861 IntPropLevel ipl=IPL_DEF);
1868 element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
1869 IntPropLevel ipl=IPL_DEF);
1876 element(Home home, const IntVarArgs& x, IntVar y0, int offset, IntVar y1,
1877 IntPropLevel ipl=IPL_DEF);
1884 element(Home home, const IntVarArgs& x, IntVar y0, int y1,
1885 IntPropLevel ipl=IPL_DEF);
1892 element(Home home, const IntVarArgs& x, IntVar y0, int offset, int y1,
1893 IntPropLevel ipl=IPL_DEF);
1896 element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
1897 IntPropLevel ipl=IPL_DEF);
1900 element(Home home, const BoolVarArgs& x, IntVar y0, int offset, BoolVar y1,
1901 IntPropLevel ipl=IPL_DEF);
1904 element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
1905 IntPropLevel ipl=IPL_DEF);
1908 element(Home home, const BoolVarArgs& x, IntVar y0, int offset, int y1,
1909 IntPropLevel ipl=IPL_DEF);
1910
1924 element(Home home, IntSharedArray a,
1925 IntVar x, int w, IntVar y, int h, IntVar z,
1926 IntPropLevel ipl=IPL_DEF);
1941 element(Home home, IntSharedArray a,
1942 IntVar x, int xoff, int w, IntVar y, int yoff, int h, IntVar z,
1943 IntPropLevel ipl=IPL_DEF);
1957 element(Home home, IntSharedArray a,
1958 IntVar x, int w, IntVar y, int h, BoolVar z,
1959 IntPropLevel ipl=IPL_DEF);
1974 element(Home home, IntSharedArray a,
1975 IntVar x, int xoff, int w, IntVar y, int yoff, int h, BoolVar z,
1976 IntPropLevel ipl=IPL_DEF);
1993 element(Home home, const IntVarArgs& a,
1994 IntVar x, int w, IntVar y, int h, IntVar z,
1995 IntPropLevel ipl=IPL_DEF);
2013 element(Home home, const IntVarArgs& a,
2014 IntVar x, int xoff, int w, IntVar y, int yoff, int h, IntVar z,
2015 IntPropLevel ipl=IPL_DEF);
2029 element(Home home, const BoolVarArgs& a,
2030 IntVar x, int w, IntVar y, int h, BoolVar z,
2031 IntPropLevel ipl=IPL_DEF);
2046 element(Home home, const BoolVarArgs& a,
2047 IntVar x, int xoff, int w, IntVar y, int yoff, int h, BoolVar z,
2048 IntPropLevel ipl=IPL_DEF);
2050
2051
2057
2090 inter_distance(Home home, const IntVarArgs& x, int p,
2091 IntPropLevel ipl=IPL_DEF);
2116 inter_distance(Home home, const IntVarArgs& x, IntVar p,
2117 IntPropLevel ipl=IPL_DEF);
2119
2120
2125
2127
2136 distinct(Home home, const IntVarArgs& x,
2137 IntPropLevel ipl=IPL_DEF);
2138
2149 IntPropLevel ipl=IPL_DEF);
2163 distinct(Home home, const IntArgs& n, const IntVarArgs& x,
2164 IntPropLevel ipl=IPL_DEF);
2180 distinct(Home home, const BoolVarArgs& b, const IntVarArgs& x,
2181 IntPropLevel ipl=IPL_DEF);
2195 distinct(Home home, const IntVarArgs& x, int c,
2196 IntPropLevel ipl=IPL_DEF);
2198
2199
2204
2206
2218 channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
2219 IntPropLevel ipl=IPL_DEF);
2220
2235 channel(Home home, const IntVarArgs& x, int xoff,
2236 const IntVarArgs& y, int yoff,
2237 IntPropLevel ipl=IPL_DEF);
2238
2241 channel(Home home, BoolVar x0, IntVar x1,
2242 IntPropLevel ipl=IPL_DEF);
2244 void
2245 channel(Home home, IntVar x0, BoolVar x1,
2246 IntPropLevel ipl=IPL_DEF);
2253 channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
2254 IntPropLevel ipl=IPL_DEF);
2256
2257}
2258
2259#include <gecode/int/channel.hpp>
2260
2261namespace Gecode {
2262
2271
2280 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
2281 IntPropLevel ipl=IPL_DEF);
2282
2295 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
2296 const IntVarArgs& z,
2297 IntPropLevel ipl=IPL_DEF);
2299
2300
2313
2315
2320 count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
2321 IntPropLevel ipl=IPL_DEF);
2327 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
2328 IntPropLevel ipl=IPL_DEF);
2337 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
2338 IntPropLevel ipl=IPL_DEF);
2347 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
2348 IntPropLevel ipl=IPL_DEF);
2354 count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
2355 IntPropLevel ipl=IPL_DEF);
2361 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
2362 IntPropLevel ipl=IPL_DEF);
2371 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
2372 IntPropLevel ipl=IPL_DEF);
2381 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
2382 IntPropLevel ipl=IPL_DEF);
2383
2398 count(Home home, const IntVarArgs& x, const IntVarArgs& c,
2399 IntPropLevel ipl=IPL_DEF);
2400
2415 count(Home home, const IntVarArgs& x, const IntSetArgs& c,
2416 IntPropLevel ipl=IPL_DEF);
2417
2435 count(Home home, const IntVarArgs& x,
2436 const IntVarArgs& c, const IntArgs& v,
2437 IntPropLevel ipl=IPL_DEF);
2438
2456 count(Home home, const IntVarArgs& x,
2457 const IntSetArgs& c, const IntArgs& v,
2458 IntPropLevel ipl=IPL_DEF);
2459
2477 count(Home home, const IntVarArgs& x,
2478 const IntSet& c, const IntArgs& v,
2479 IntPropLevel ipl=IPL_DEF);
2480
2482
2492
2494
2498 nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
2499 IntPropLevel ipl=IPL_DEF);
2504 nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
2505 IntPropLevel ipl=IPL_DEF);
2510 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
2511 IntPropLevel ipl=IPL_DEF);
2516 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
2517 IntPropLevel ipl=IPL_DEF);
2519
2524
2526
2541 sequence(Home home, const IntVarArgs& x, const IntSet& s,
2542 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2543
2559 sequence(Home home, const BoolVarArgs& x, const IntSet& s,
2560 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2561
2573 sequence(Home home, OpenIntVarList x, const IntSet& s,
2574 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2575
2589 sliding_sum(Home home, OpenIntVarList x,
2590 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2591
2593
2605
2620 class DFA : public SharedHandle {
2621 private:
2623 class DFAI;
2626 bool equal(const DFA& d) const;
2627 public:
2630 public:
2635 Transition(void);
2637 Transition(int i_state0, int symbol0, int o_state0);
2638 };
2639
2641 private:
2643 const Transition* c_trans;
2645 const Transition* e_trans;
2646 public:
2648 Transitions(const DFA& d);
2650 Transitions(const DFA& d, int n);
2652 bool operator ()(void) const;
2654 void operator ++(void);
2656 int i_state(void) const;
2658 int symbol(void) const;
2660 int o_state(void) const;
2661 };
2662
2663 class Symbols {
2664 private:
2666 const Transition* c_trans;
2668 const Transition* e_trans;
2669 public:
2671 Symbols(const DFA& d);
2673 bool operator ()(void) const;
2675 void operator ++(void);
2677 int val(void) const;
2678 };
2679
2691 void init(int s, Transition t[], int f[], bool minimize=true);
2692 public:
2693 friend class Transitions;
2695 DFA(void);
2708 DFA(int s, Transition t[], int f[], bool minimize=true);
2719 DFA(int s, std::initializer_list<Transition> t,
2720 std::initializer_list<int> f, bool minimize=true);
2732 static DFA nfa(int s, Transition t[], int f[]);
2741 static DFA nfa(int s, std::initializer_list<Transition> t,
2742 std::initializer_list<int> f);
2744 DFA(const DFA& d);
2747 bool operator ==(const DFA& d) const;
2749 bool operator !=(const DFA& d) const;
2751 int n_states(void) const;
2753 int n_transitions(void) const;
2755 unsigned int n_symbols(void) const;
2757 unsigned int max_degree(void) const;
2759 int final_fst(void) const;
2761 int final_lst(void) const;
2763 int symbol_min(void) const;
2765 int symbol_max(void) const;
2767 std::size_t hash(void) const;
2768 };
2769
2770}
2771
2773
2774namespace Gecode { namespace Int { namespace Extensional {
2775
2776 class TupleSetAccess;
2777
2778}}}
2779
2780namespace Gecode {
2781
2795 EPK_AUTO,
2796 EPK_DENSE,
2797 EPK_SPARSE,
2798 EPK_DENSE_COMPRESSED
2799 };
2800
2801 static constexpr ExtensionalPropKind EPK_AUTO =
2804 static constexpr ExtensionalPropKind EPK_DENSE =
2807 static constexpr ExtensionalPropKind EPK_SPARSE =
2810 static constexpr ExtensionalPropKind EPK_DENSE_COMPRESSED =
2812
2821 class TupleSet : public SharedHandle {
2823 public:
2828 typedef int* Tuple;
2833 public:
2834 unsigned int widx;
2836 };
2837
2838 class Range {
2839 public:
2841 int min;
2843 int max;
2847 unsigned int width(void) const;
2854 const BitSetData* supports(unsigned int n_words, int n) const;
2855 };
2856 protected:
2859 public:
2861 unsigned int n;
2865 unsigned int* base;
2867 unsigned int start(int n) const;
2868 };
2869
2874 protected:
2876 static const int n_initial_free = 1024;
2877 public:
2886 public:
2890 unsigned int n_words;
2896 int min;
2898 int max;
2900 std::size_t key;
2902 int* td;
2908 unsigned int* range_base;
2914 unsigned int sparse_n_vals;
2916 unsigned int* sparse_offsets;
2918 unsigned int* sparse_tuples;
2920 unsigned int* sparse_tv;
2922 unsigned int* compressed_offsets;
2927
2929 Tuple add(void);
2931 Tuple get(int i) const;
2933 static void set(BitSetData* d, unsigned int n);
2935 static bool get(const BitSetData* d, unsigned int n);
2937 unsigned int tuple2idx(Tuple t) const;
2939 const Range* fst(int i) const;
2941 const Range* lst(int i) const;
2944 void finalize(void);
2947 void finalize(ExtensionalPropKind epk);
2950 void resize(void);
2952 void clear_support(void);
2957 ExtensionalPropKind epk, bool dense_possible,
2958 bool sparse_possible, bool compressed_possible,
2959 bool support_bits_sparse, unsigned long long dense_bytes) const;
2961 bool finalized(void) const;
2963 bool failed(void) const;
2965 bool terminal(void) const;
2966
2968 Data(int a);
2971 virtual ~Data(void);
2972 };
2973
2975 Data& data(void) const;
2977 Data& raw(void) const;
2980 void _add(const IntArgs& t);
2983 bool equal(const TupleSet& t) const;
2984 public:
2986
2987
2988 TupleSet(void);
2991 TupleSet(int a);
2994 void init(int a);
2997 TupleSet(const TupleSet& t);
3000 TupleSet& operator =(const TupleSet& t);
3003 TupleSet(int a, const DFA& dfa);
3006 TupleSet(int a, const DFA& dfa, ExtensionalPropKind epk);
3008 operator bool(void) const;
3010 bool operator ==(const TupleSet& t) const;
3012 bool operator !=(const TupleSet& t) const;
3014
3016
3017
3018 TupleSet& add(const IntArgs& t);
3020 bool finalized(void) const;
3027 bool failed(void) const;
3029 void finalize(void);
3031
3039 void finalize(ExtensionalPropKind epk);
3041
3043
3044
3045 int arity(void) const;
3047 int tuples(void) const;
3049 unsigned int words(void) const;
3051 Tuple operator [](int i) const;
3053 int min(void) const;
3055 int max(void) const;
3057 std::size_t hash(void) const;
3060 private:
3062 unsigned int sparse_values(void) const;
3064 const unsigned int* sparse_tuple_value_ids(void) const;
3066 const unsigned int* sparse_support_offsets(void) const;
3068 bool support_id(int p, int n, unsigned int& gid) const;
3070 bool sparse_support(int p, int n,
3071 const unsigned int*& b,
3072 const unsigned int*& e,
3073 unsigned int& gid) const;
3075 bool dense_compressed_support(int p, int n,
3076 const CSupportWord*& b,
3077 const CSupportWord*& e) const;
3078 public:
3080
3082
3083
3084 const Range* fst(int i) const;
3086 const Range* lst(int i) const;
3088 class Ranges {
3089 protected:
3091 const Range* c;
3093 const Range* l;
3094 public:
3096
3097
3098 Ranges(const TupleSet& ts, int i);
3100
3102
3103
3104 bool operator ()(void) const;
3106 void operator ++(void);
3108
3110
3111
3112 int min(void) const;
3114 int max(void) const;
3116 unsigned int width(void) const;
3118 };
3119
3120 };
3121
3122 namespace Int { namespace Extensional {
3123
3126 public:
3128 static unsigned int sparse_values(const TupleSet& ts);
3130 static const unsigned int* sparse_tuple_value_ids(const TupleSet& ts);
3132 static const unsigned int* sparse_support_offsets(const TupleSet& ts);
3134 static bool support_id(const TupleSet& ts, int p, int n,
3135 unsigned int& gid);
3137 static bool sparse_support(const TupleSet& ts, int p, int n,
3138 const unsigned int*& b,
3139 const unsigned int*& e,
3140 unsigned int& gid);
3142 static bool dense_compressed_support(const TupleSet& ts, int p, int n,
3143 const TupleSet::CSupportWord*& b,
3144 const TupleSet::CSupportWord*& e);
3145 };
3146
3147 }}
3148
3149}
3150
3152
3153namespace Gecode {
3154
3168 extensional(Home home, const IntVarArgs& x, DFA d,
3169 IntPropLevel ipl=IPL_DEF);
3170
3184 extensional(Home home, const BoolVarArgs& x, DFA d,
3185 IntPropLevel ipl=IPL_DEF);
3186
3199 extensional(Home home, OpenIntVarList x, DFA d,
3200 IntPropLevel ipl=IPL_DEF);
3201
3212 extensional(Home home, OpenBoolVarList x, DFA d,
3213 IntPropLevel ipl=IPL_DEF);
3214
3225 void
3226 extensional(Home home, const IntVarArgs& x, const TupleSet& t,
3227 IntPropLevel ipl=IPL_DEF);
3228
3242 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
3243 IntPropLevel ipl=IPL_DEF);
3244
3255 void
3256 extensional(Home home, const IntVarArgs& x, const TupleSet& t, Reify r,
3257 IntPropLevel ipl=IPL_DEF);
3258
3272 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
3273 Reify r,
3274 IntPropLevel ipl=IPL_DEF);
3275
3286 void
3287 extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
3288 IntPropLevel ipl=IPL_DEF);
3289
3303 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
3304 IntPropLevel ipl=IPL_DEF);
3305
3316 void
3317 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, Reify r,
3318 IntPropLevel ipl=IPL_DEF);
3319
3333 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
3334 Reify r,
3335 IntPropLevel ipl=IPL_DEF);
3336
3337}
3338
3340
3341namespace Gecode {
3342
3343
3349
3356 class IntDistance : public SharedHandle {
3357 protected:
3360 public:
3361 const int n;
3363 const std::function<int(int,int)> function;
3364 Data(int n, const IntArgs& matrix);
3365 Data(int n, std::function<int(int,int)> function);
3366 virtual ~Data(void);
3367 };
3368 public:
3375 GECODE_INT_EXPORT IntDistance(int n, const IntArgs& matrix);
3387 GECODE_INT_EXPORT IntDistance(int n, std::function<int(int,int)> function);
3389 int size(void) const;
3391 int operator ()(int a, int b) const;
3392 };
3393
3396 MDP_DECOMPOSED,
3397 MDP_SINGLE
3398 };
3399
3400 static constexpr MinDistancePropKind MDP_DECOMPOSED =
3403 static constexpr MinDistancePropKind MDP_SINGLE =
3405
3431 minimum_distance(Home home, const IntVarArgs& x, IntVar z,
3432 const IntDistance& d, IntPropLevel ipl=IPL_DEF,
3433 MinDistancePropKind kind=MDP_SINGLE);
3448 minimum_distance(Home home, const IntVarArgs& x, IntVar z,
3449 const IntDistance& d, const IntArgs& r,
3450 IntPropLevel ipl=IPL_DEF, MinDistancePropKind kind=MDP_SINGLE);
3452
3453}
3454
3456
3457namespace Gecode {
3458
3463
3465
3471 min(Home home, IntVar x0, IntVar x1, IntVar x2,
3472 IntPropLevel ipl=IPL_DEF);
3481 min(Home home, const IntVarArgs& x, IntVar y,
3482 IntPropLevel ipl=IPL_DEF);
3483
3493 min(Home home, OpenIntVarList x, IntVar y,
3494 IntPropLevel ipl=IPL_DEF);
3501 max(Home home, IntVar x0, IntVar x1, IntVar x2,
3502 IntPropLevel ipl=IPL_DEF);
3511 max(Home home, const IntVarArgs& x, IntVar y,
3512 IntPropLevel ipl=IPL_DEF);
3513
3523 max(Home home, OpenIntVarList x, IntVar y,
3524 IntPropLevel ipl=IPL_DEF);
3525
3536 argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
3537 IntPropLevel ipl=IPL_DEF);
3548 argmin(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
3549 IntPropLevel ipl=IPL_DEF);
3560 argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
3561 IntPropLevel ipl=IPL_DEF);
3572 argmax(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
3573 IntPropLevel ipl=IPL_DEF);
3584 argmin(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
3585 IntPropLevel ipl=IPL_DEF);
3596 argmin(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
3597 IntPropLevel ipl=IPL_DEF);
3608 argmax(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
3609 IntPropLevel ipl=IPL_DEF);
3620 argmax(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
3621 IntPropLevel ipl=IPL_DEF);
3622
3629 abs(Home home, IntVar x0, IntVar x1,
3630 IntPropLevel ipl=IPL_DEF);
3631
3638 mult(Home home, IntVar x0, IntVar x1, IntVar x2,
3639 IntPropLevel ipl=IPL_DEF);
3640
3649 gcd(Home home, IntVar x0, IntVar x1, IntVar x2,
3650 IntPropLevel ipl=IPL_DEF);
3651
3661 gcd(Home home, IntVar x0, IntVar x1, IntVar x2, Reify r,
3662 IntPropLevel ipl=IPL_DEF);
3663
3673 divides(Home home, IntVar divisor, IntVar dividend, Reify r,
3674 IntPropLevel ipl=IPL_DEF);
3675
3684 product(Home home, const IntVarArgs& x, IntVar y,
3685 IntPropLevel ipl=IPL_DEF);
3686
3695 product(Home home, const IntVarArgs& x, IntVar y, Reify r,
3696 IntPropLevel ipl=IPL_DEF);
3697
3710 product_mod(Home home, const IntVarArgs& x, int m, IntVar y,
3711 IntPropLevel ipl=IPL_DEF);
3712
3725 product_mod(Home home, const IntVarArgs& x, int m, IntVar y, Reify r,
3726 IntPropLevel ipl=IPL_DEF);
3727
3738 product_mod(Home home, const IntVarArgs& x, IntVar m, IntVar y,
3739 IntPropLevel ipl=IPL_DEF);
3740
3752 product_mod(Home home, const IntVarArgs& x, IntVar m, IntVar y, Reify r,
3753 IntPropLevel ipl=IPL_DEF);
3754
3760 divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
3761 IntPropLevel ipl=IPL_DEF);
3762
3768 div(Home home, IntVar x0, IntVar x1, IntVar x2,
3769 IntPropLevel ipl=IPL_DEF);
3770
3776 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
3777 IntPropLevel ipl=IPL_DEF);
3778
3785 sqr(Home home, IntVar x0, IntVar x1,
3786 IntPropLevel ipl=IPL_DEF);
3787
3794 sqrt(Home home, IntVar x0, IntVar x1,
3795 IntPropLevel ipl=IPL_DEF);
3796
3806 pow(Home home, IntVar x0, int n, IntVar x1,
3807 IntPropLevel ipl=IPL_DEF);
3808
3818 nroot(Home home, IntVar x0, int n, IntVar x1,
3819 IntPropLevel ipl=IPL_DEF);
3820
3822
3859 linear(Home home, const IntVarArgs& x,
3860 IntRelType irt, int c,
3861 IntPropLevel ipl=IPL_DEF);
3866 linear(Home home, const IntVarArgs& x,
3867 IntRelType irt, IntVar y,
3868 IntPropLevel ipl=IPL_DEF);
3873 linear(Home home, const IntVarArgs& x,
3874 IntRelType irt, int c, Reify r,
3875 IntPropLevel ipl=IPL_DEF);
3880 linear(Home home, const IntVarArgs& x,
3881 IntRelType irt, IntVar y, Reify r,
3882 IntPropLevel ipl=IPL_DEF);
3890 linear(Home home, const IntArgs& a, const IntVarArgs& x,
3891 IntRelType irt, int c,
3892 IntPropLevel ipl=IPL_DEF);
3900 linear(Home home, const IntArgs& a, const IntVarArgs& x,
3901 IntRelType irt, IntVar y,
3902 IntPropLevel ipl=IPL_DEF);
3910 linear(Home home, const IntArgs& a, const IntVarArgs& x,
3911 IntRelType irt, int c, Reify r,
3912 IntPropLevel ipl=IPL_DEF);
3920 linear(Home home, const IntArgs& a, const IntVarArgs& x,
3921 IntRelType irt, IntVar y, Reify r,
3922 IntPropLevel ipl=IPL_DEF);
3923
3924
3953 linear(Home home, const BoolVarArgs& x,
3954 IntRelType irt, int c,
3955 IntPropLevel ipl=IPL_DEF);
3960 linear(Home home, const BoolVarArgs& x,
3961 IntRelType irt, int c, Reify r,
3962 IntPropLevel ipl=IPL_DEF);
3967 linear(Home home, const BoolVarArgs& x,
3968 IntRelType irt, IntVar y,
3969 IntPropLevel ipl=IPL_DEF);
3974 linear(Home home, const BoolVarArgs& x,
3975 IntRelType irt, IntVar y, Reify r,
3976 IntPropLevel ipl=IPL_DEF);
3984 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
3985 IntRelType irt, int c,
3986 IntPropLevel ipl=IPL_DEF);
3994 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
3995 IntRelType irt, int c, Reify r,
3996 IntPropLevel ipl=IPL_DEF);
4004 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
4005 IntRelType irt, IntVar y,
4006 IntPropLevel ipl=IPL_DEF);
4014 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
4015 IntRelType irt, IntVar y, Reify r,
4016 IntPropLevel ipl=IPL_DEF);
4017
4018
4055 binpacking(Home home,
4056 const IntVarArgs& l,
4057 const IntVarArgs& b, const IntArgs& s,
4058 IntPropLevel ipl=IPL_DEF);
4059 /* \brief Post propagator for multi-dimensional bin packing
4060 *
4061 * In the following \a n refers to the number of items and \a m
4062 * refers to the number of bins.
4063 *
4064 * The multi-dimensional bin-packing constraint enforces that
4065 * all items are packed into bins
4066 * \f$b_i\in\{0,\ldots,m-1\}\f$ for \f$0\leq i<n\f$
4067 * and that the load of each bin corresponds to the items
4068 * packed into it for each dimension \f$l_{j\cdot
4069 * d + k} = \sum_{\{i\in\{0,\ldots,n-1\}|
4070 * b_{j\cdot d+k}=i}\}s_{i\cdot d+k}\f$
4071 * for \f$0\leq j<m\f$, \f$0\leq k<d\f$
4072 * Furthermore, the load variables must satisfy the capacity
4073 * constraints \f$l_{j\cdot d + k} \leq
4074 * c_k\f$ for \f$0\leq j<m\f$, \f$0\leq k<d\f$.
4075 *
4076 * The constraint is implemented by the decomposition
4077 * introduced in: Stefano Gualandi and Michele Lombardi. A
4078 * simple and effective decomposition for the multidimensional
4079 * binpacking constraint. CP 2013, pages 356--364.
4080 *
4081 * Posting the constraint returns a maximal set containing conflicting
4082 * items that require pairwise different bins.
4083 *
4084 * Note that posting the constraint has exponential complexity in the
4085 * number of items due to the Bron-Kerbosch algorithm used for finding
4086 * the maximal conflict item sets.
4087 *
4088 * The propagation level \a ipl controls the filtering performed by each
4089 * per-dimension bin-packing propagator:
4090 * - \a IPL_BASIC performs basic load and item filtering only.
4091 * - \a IPL_ADVANCED performs basic filtering, knapsack filtering using
4092 * NoSum, and a small DFF portfolio (CCM1 and MT). It is the default
4093 * (\a IPL_DEF).
4094 * - \a IPL_FULL performs all of the above and the complete DFF portfolio.
4095 *
4096 * Throws the following exceptions:
4097 * - Of type Int::ArgumentSizeMismatch if any of the following properties
4098 * is violated: \f$|b|=n\f$, \f$|l|=m\cdot d\f$, \f$|s|=n\cdot d\f$,
4099 * and \f$|c|=d\f$.
4100 * - Of type Int::ArgumentSame if \a l and \a b share unassigned variables.
4101 * - Of type Int::OutOfLimits if \a s or \a c contains a negative number.
4102 *
4103 * \ingroup TaskModelIntBinPacking
4104 */
4106 binpacking(Home home, int d,
4107 const IntVarArgs& l, const IntVarArgs& b,
4108 const IntArgs& s, const IntArgs& c,
4109 IntPropLevel ipl=IPL_DEF);
4110
4111
4131 nooverlap(Home home,
4132 const IntVarArgs& x, const IntArgs& w,
4133 const IntVarArgs& y, const IntArgs& h,
4134 IntPropLevel ipl=IPL_DEF);
4149 nooverlap(Home home,
4150 const IntVarArgs& x, const IntArgs& w,
4151 const IntVarArgs& y, const IntArgs& h,
4152 const BoolVarArgs& o,
4153 IntPropLevel ipl=IPL_DEF);
4171 nooverlap(Home home,
4172 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
4173 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
4174 IntPropLevel ipl=IPL_DEF);
4193 nooverlap(Home home,
4194 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
4195 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
4196 const BoolVarArgs& o,
4197 IntPropLevel ipl=IPL_DEF);
4198
4199
4205
4217 order(Home home, IntVar s0, int p0, IntVar s1, int p1, BoolVar b,
4218 IntPropLevel ipl=IPL_DEF);
4219
4263 cumulatives(Home home, const IntVarArgs& m,
4264 const IntVarArgs& s, const IntVarArgs& p,
4265 const IntVarArgs& e, const IntVarArgs& u,
4266 const IntArgs& c, bool at_most,
4267 IntPropLevel ipl=IPL_DEF);
4273 cumulatives(Home home, const IntArgs& m,
4274 const IntVarArgs& s, const IntVarArgs& p,
4275 const IntVarArgs& e, const IntVarArgs& u,
4276 const IntArgs& c, bool at_most,
4277 IntPropLevel ipl=IPL_DEF);
4283 cumulatives(Home home, const IntVarArgs& m,
4284 const IntVarArgs& s, const IntArgs& p,
4285 const IntVarArgs& e, const IntVarArgs& u,
4286 const IntArgs& c, bool at_most,
4287 IntPropLevel ipl=IPL_DEF);
4293 cumulatives(Home home, const IntArgs& m,
4294 const IntVarArgs& s, const IntArgs& p,
4295 const IntVarArgs& e, const IntVarArgs& u,
4296 const IntArgs& c, bool at_most,
4297 IntPropLevel ipl=IPL_DEF);
4303 cumulatives(Home home, const IntVarArgs& m,
4304 const IntVarArgs& s, const IntVarArgs& p,
4305 const IntVarArgs& e, const IntArgs& u,
4306 const IntArgs& c, bool at_most,
4307 IntPropLevel ipl=IPL_DEF);
4313 cumulatives(Home home, const IntArgs& m,
4314 const IntVarArgs& s, const IntVarArgs& p,
4315 const IntVarArgs& e, const IntArgs& u,
4316 const IntArgs& c, bool at_most,
4317 IntPropLevel ipl=IPL_DEF);
4323 cumulatives(Home home, const IntVarArgs& m,
4324 const IntVarArgs& s, const IntArgs& p,
4325 const IntVarArgs& e, const IntArgs& u,
4326 const IntArgs& c, bool at_most,
4327 IntPropLevel ipl=IPL_DEF);
4333 cumulatives(Home home, const IntArgs& m,
4334 const IntVarArgs& s, const IntArgs& p,
4335 const IntVarArgs& e, const IntArgs& u,
4336 const IntArgs& c, bool at_most,
4337 IntPropLevel ipl=IPL_DEF);
4338
4366 unary(Home home, const IntVarArgs& s, const IntArgs& p,
4367 IntPropLevel ipl=IPL_DEF);
4368
4398 unary(Home home, const IntVarArgs& s, const IntArgs& p,
4399 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
4400
4438 unary(Home home, const TaskTypeArgs& t,
4439 const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl=IPL_DEF);
4440
4480 unary(Home home, const TaskTypeArgs& t,
4481 const IntVarArgs& flex, const IntArgs& fix,
4482 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
4483
4511 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
4512 const IntVarArgs& e, IntPropLevel ipl=IPL_DEF);
4513
4543 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
4544 const IntVarArgs& e, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
4545
4546
4547
4603 cumulative(Home home, int c, const TaskTypeArgs& t,
4604 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
4605 IntPropLevel ipl=IPL_DEF);
4606
4607
4613 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
4614 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
4615 IntPropLevel ipl=IPL_DEF);
4616
4674 cumulative(Home home, int c, const TaskTypeArgs& t,
4675 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
4676 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
4677
4682 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
4683 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
4684 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
4685
4731 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
4732 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
4733
4738 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
4739 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
4740
4788 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
4789 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
4790
4795 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
4796 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
4797
4835 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
4836 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
4837
4842 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
4843 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
4844
4884 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
4885 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
4886 IntPropLevel ipl=IPL_DEF);
4887
4892 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
4893 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
4894 IntPropLevel ipl=IPL_DEF);
4896
4897
4903
4918 circuit(Home home, const IntVarArgs& x,
4919 IntPropLevel ipl=IPL_DEF);
4936 circuit(Home home, int offset, const IntVarArgs& x,
4937 IntPropLevel ipl=IPL_DEF);
4960 circuit(Home home,
4961 const IntArgs& c,
4962 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
4963 IntPropLevel ipl=IPL_DEF);
4987 circuit(Home home,
4988 const IntArgs& c, int offset,
4989 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
4990 IntPropLevel ipl=IPL_DEF);
5010 circuit(Home home,
5011 const IntArgs& c,
5012 const IntVarArgs& x, IntVar z,
5013 IntPropLevel ipl=IPL_DEF);
5035 circuit(Home home,
5036 const IntArgs& c, int offset,
5037 const IntVarArgs& x, IntVar z,
5038 IntPropLevel ipl=IPL_DEF);
5055 path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
5056 IntPropLevel ipl=IPL_DEF);
5075 path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
5076 IntPropLevel ipl=IPL_DEF);
5100 path(Home home,
5101 const IntArgs& c,
5102 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
5103 IntPropLevel ipl=IPL_DEF);
5129 path(Home home,
5130 const IntArgs& c, int offset,
5131 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
5132 IntPropLevel ipl=IPL_DEF);
5154 path(Home home,
5155 const IntArgs& c,
5156 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
5157 IntPropLevel ipl=IPL_DEF);
5181 path(Home home,
5182 const IntArgs& c, int offset,
5183 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
5184 IntPropLevel ipl=IPL_DEF);
5186
5187
5188
5197
5199 wait(Home home, IntVar x, std::function<void(Space& home)> c,
5200 IntPropLevel ipl=IPL_DEF);
5203 wait(Home home, BoolVar x, std::function<void(Space& home)> c,
5204 IntPropLevel ipl=IPL_DEF);
5207 wait(Home home, const IntVarArgs& x, std::function<void(Space& home)> c,
5208 IntPropLevel ipl=IPL_DEF);
5211 wait(Home home, const BoolVarArgs& x,
5212 std::function<void(Space& home)> c,
5213 IntPropLevel ipl=IPL_DEF);
5216 when(Home home, BoolVar x,
5217 std::function<void(Space& home)> t,
5218 std::function<void(Space& home)> e,
5219 IntPropLevel ipl=IPL_DEF);
5222 when(Home home, BoolVar x,
5223 std::function<void(Space& home)> t,
5224 IntPropLevel ipl=IPL_DEF);
5226
5227
5245
5253 unshare(Home home, IntVarArgs& x,
5254 IntPropLevel ipl=IPL_DEF);
5257 unshare(Home home, BoolVarArgs& x,
5258 IntPropLevel ipl=IPL_DEF);
5260
5261}
5262
5263namespace Gecode {
5264
5269
5278 typedef std::function<bool(const Space& home, IntVar x, int i)>
5288 typedef std::function<bool(const Space& home, BoolVar x, int i)>
5290
5300 typedef std::function<double(const Space& home, IntVar x, int i)>
5311 typedef std::function<double(const Space& home, BoolVar x, int i)>
5313
5324 typedef std::function<int(const Space& home, IntVar x, int i)>
5336 typedef std::function<int(const Space& home, BoolVar x, int i)>
5338
5350 typedef std::function<void(Space& home, unsigned int a,
5351 IntVar x, int i, int n)>
5364 typedef std::function<void(Space& home, unsigned int a,
5365 BoolVar x, int i, int n)>
5367
5368}
5369
5371
5372namespace Gecode {
5373
5379 class IntAFC : public AFC {
5380 public:
5388 IntAFC(void);
5390 IntAFC(const IntAFC& a);
5392 IntAFC& operator =(const IntAFC& a);
5400 IntAFC(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
5411 void init(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
5412 };
5413
5419 class BoolAFC : public AFC {
5420 public:
5428 BoolAFC(void);
5430 BoolAFC(const BoolAFC& a);
5432 BoolAFC& operator =(const BoolAFC& a);
5440 BoolAFC(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
5451 void init(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
5452 };
5453
5454}
5455
5457
5458namespace Gecode {
5459
5465 class IntAction : public Action {
5466 public:
5474 IntAction(void);
5476 IntAction(const IntAction& a);
5478 IntAction& operator =(const IntAction& a);
5489 IntAction(Home home, const IntVarArgs& x, double d=1.0,
5490 bool p=true, bool f=true,
5491 IntBranchMerit bm=nullptr);
5506 init(Home home, const IntVarArgs& x, double d=1.0,
5507 bool p=true, bool f=true,
5508 IntBranchMerit bm=nullptr);
5509 };
5510
5516 class BoolAction : public Action {
5517 public:
5525 BoolAction(void);
5527 BoolAction(const BoolAction& a);
5529 BoolAction& operator =(const BoolAction& a);
5540 BoolAction(Home home, const BoolVarArgs& x, double d=1.0,
5541 bool p=true, bool f=true,
5542 BoolBranchMerit bm=nullptr);
5557 init(Home home, const BoolVarArgs& x, double d=1.0,
5558 bool p=true, bool f=true,
5559 BoolBranchMerit bm=nullptr);
5560 };
5561
5562}
5563
5565
5566namespace Gecode {
5567
5573 class IntCHB : public CHB {
5574 public:
5582 IntCHB(void);
5584 IntCHB(const IntCHB& chb);
5586 IntCHB& operator =(const IntCHB& chb);
5596 IntCHB(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
5609 init(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
5610 };
5611
5617 class BoolCHB : public CHB {
5618 public:
5626 BoolCHB(void);
5628 BoolCHB(const BoolCHB& chb);
5630 BoolCHB& operator =(const BoolCHB& chb);
5640 BoolCHB(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
5653 init(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
5654 };
5655
5656}
5657
5659
5660namespace Gecode {
5661
5663 typedef std::function<void(const Space &home, const Brancher& b,
5664 unsigned int a,
5665 IntVar x, int i, const int& n,
5666 std::ostream& o)>
5668
5670 typedef std::function<void(const Space &home, const Brancher& b,
5671 unsigned int a,
5672 BoolVar x, int i, const int& n,
5673 std::ostream& o)>
5675
5676}
5677
5678namespace Gecode {
5679
5765
5813
5819
5832 IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
5836 IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
5840 IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
5844 IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
5872 IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
5876 IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
5880 IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
5884 IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
5919
5933 BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
5937 BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
5941 BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
5945 BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
5957
5958}
5959
5961
5962namespace Gecode {
5963
5998
6004 class BoolValBranch : public ValBranch<BoolVar> {
6005 public:
6013 protected:
6016 public:
6024 Select select(void) const;
6025 };
6026
6032
6059
6074
6075}
6076
6078
6079namespace Gecode {
6080
6086 class IntAssign : public ValBranch<IntVar> {
6087 public:
6096 protected:
6099 public:
6103 IntAssign(Rnd r);
6107 Select select(void) const;
6108 };
6109
6115 class BoolAssign : public ValBranch<BoolVar> {
6116 public:
6124 protected:
6127 public:
6131 BoolAssign(Rnd r);
6135 Select select(void) const;
6136 };
6137
6143
6158
6173
6174}
6175
6177
6178namespace Gecode {
6179
6186 branch(Home home, const IntVarArgs& x,
6187 IntVarBranch vars, IntValBranch vals,
6188 IntBranchFilter bf=nullptr,
6189 IntVarValPrint vvp=nullptr);
6196 branch(Home home, const IntVarArgs& x,
6197 TieBreak<IntVarBranch> vars, IntValBranch vals,
6198 IntBranchFilter bf=nullptr,
6199 IntVarValPrint vvp=nullptr);
6206 branch(Home home, IntVar x, IntValBranch vals,
6207 IntVarValPrint vvp=nullptr);
6217 branch(Home home, OpenIntVarList x);
6223 branch(Home home, OpenBoolVarList x);
6248 branch(Home home, OpenIntVarList x,
6249 IntVarBranch vars, IntValBranch vals,
6250 IntBranchFilter bf=nullptr, IntVarValPrint vvp=nullptr);
6253 branch(Home home, OpenIntVarList x,
6254 TieBreak<IntVarBranch> vars, IntValBranch vals,
6255 IntBranchFilter bf=nullptr, IntVarValPrint vvp=nullptr);
6264 branch(Home home, OpenBoolVarList x,
6265 BoolVarBranch vars, BoolValBranch vals,
6266 BoolBranchFilter bf=nullptr, BoolVarValPrint vvp=nullptr);
6269 branch(Home home, OpenBoolVarList x,
6270 TieBreak<BoolVarBranch> vars, BoolValBranch vals,
6271 BoolBranchFilter bf=nullptr, BoolVarValPrint vvp=nullptr);
6278 branch(Home home, const BoolVarArgs& x,
6279 BoolVarBranch vars, BoolValBranch vals,
6280 BoolBranchFilter bf=nullptr,
6281 BoolVarValPrint vvp=nullptr);
6288 branch(Home home, const BoolVarArgs& x,
6289 TieBreak<BoolVarBranch> vars, BoolValBranch vals,
6290 BoolBranchFilter bf=nullptr,
6291 BoolVarValPrint vvp=nullptr);
6298 branch(Home home, BoolVar x, BoolValBranch vals,
6299 BoolVarValPrint vvp=nullptr);
6300
6307 assign(Home home, const IntVarArgs& x,
6308 IntVarBranch vars, IntAssign vals,
6309 IntBranchFilter bf=nullptr,
6310 IntVarValPrint vvp=nullptr);
6317 assign(Home home, const IntVarArgs& x,
6319 IntBranchFilter bf=nullptr,
6320 IntVarValPrint vvp=nullptr);
6327 assign(Home home, IntVar x, IntAssign vals,
6328 IntVarValPrint vvp=nullptr);
6335 assign(Home home, const BoolVarArgs& x,
6336 BoolVarBranch vars, BoolAssign vals,
6337 BoolBranchFilter bf=nullptr,
6338 BoolVarValPrint vvp=nullptr);
6345 assign(Home home, const BoolVarArgs& x,
6347 IntBranchFilter bf=nullptr,
6348 IntVarValPrint vvp=nullptr);
6355 assign(Home home, BoolVar x, BoolAssign vals,
6356 BoolVarValPrint vvp=nullptr);
6357
6358}
6359
6360namespace Gecode {
6361
6367 void
6368 branch(Home home, const IntVarArgs& x, IntValBranch vals,
6369 IntBranchFilter bf=nullptr,
6370 IntVarValPrint vvp=nullptr);
6376 void
6377 branch(Home home, const BoolVarArgs& x, BoolValBranch vals,
6378 BoolBranchFilter bf=nullptr,
6379 BoolVarValPrint vvp=nullptr);
6380
6386 void
6387 assign(Home home, const IntVarArgs& x, IntAssign vals,
6388 IntBranchFilter bf=nullptr,
6389 IntVarValPrint vvp=nullptr);
6395 void
6396 assign(Home home, const BoolVarArgs& x, BoolAssign vals,
6397 BoolBranchFilter bf=nullptr,
6398 BoolVarValPrint vvp=nullptr);
6399
6400}
6401
6402#include <gecode/int/branch.hpp>
6403
6404namespace Gecode {
6405
6409 template<class Char, class Traits>
6410 std::basic_ostream<Char,Traits>&
6411 operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
6412
6416 template<class Char, class Traits>
6417 std::basic_ostream<Char,Traits>&
6418 operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
6419
6420}
6421
6422// LDSB-related declarations.
6423namespace Gecode {
6424
6425 namespace Int { namespace LDSB {
6426 class SymmetryObject;
6427 }}
6428
6435 public:
6439 void increment(void);
6441 void decrement(void);
6442 public:
6444 SymmetryHandle(void);
6450 const SymmetryHandle& operator=(const SymmetryHandle& h);
6452 ~SymmetryHandle(void);
6453 };
6454 class Symmetries;
6456 template<>
6463
6470
6471 class Symmetries : public ArgArray<SymmetryHandle> {};
6472 // If this is instead a typedef, strange things happen with the
6473 // overloading of the "branch" function.
6474
6481 const IntArgs& indices);
6509
6511 GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
6515
6528 branch(Home home, const IntVarArgs& x,
6529 IntVarBranch vars, IntValBranch vals,
6530 const Symmetries& syms,
6531 IntBranchFilter bf=nullptr,
6532 IntVarValPrint vvp=nullptr);
6545 branch(Home home, const IntVarArgs& x,
6547 const Symmetries& syms,
6548 IntBranchFilter bf=nullptr,
6549 IntVarValPrint vvp=nullptr);
6562 branch(Home home, const BoolVarArgs& x,
6563 BoolVarBranch vars, BoolValBranch vals,
6564 const Symmetries& syms,
6565 BoolBranchFilter bf=nullptr,
6566 BoolVarValPrint vvp=nullptr);
6579 branch(Home home, const BoolVarArgs& x,
6581 const Symmetries& syms,
6582 BoolBranchFilter bf=nullptr,
6583 BoolVarValPrint vvp=nullptr);
6584
6585#ifdef GECODE_HAS_CBS
6586
6608 cbsbranch(Home home, const IntVarArgs& x);
6609
6610
6632 cbsbranch(Home home, const BoolVarArgs& x);
6633
6634#endif
6635
6636}
6637
6638namespace Gecode {
6639
6640 /*
6641 * \brief Relaxed assignment of variables in \a x from values in \a sx
6642 *
6643 * The variables in \a x are assigned values from the assigned variables
6644 * in the solution \a sx with a relaxation probability \a p. That is,
6645 * if \f$p=0.1\f$ approximately 10% of the variables in \a x will be
6646 * assigned a value from \a sx.
6647 *
6648 * The random numbers are generated from the generator \a r. At least
6649 * one variable will not be assigned: in case the relaxation attempt
6650 * would suggest that all variables should be assigned, a single
6651 * variable will be selected randomly to remain unassigned.
6652 *
6653 * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
6654 * \a sx are of different size.
6655 *
6656 * Throws an exception of type Int::OutOfLimits, if \a p is not between
6657 * \a 0.0 and \a 1.0.
6658 *
6659 * \ingroup TaskModelInt
6660 */
6662 relax(Home home, const IntVarArgs& x, const IntVarArgs& sx,
6663 Rnd r, double p);
6664
6665 /*
6666 * \brief Relaxed assignment of variables in \a x from values in \a sx
6667 *
6668 * The variables in \a x are assigned values from the assigned variables
6669 * in the solution \a sx with a relaxation probability \a p. That is,
6670 * if \f$p=0.1\f$ approximately 10% of the variables in \a x will be
6671 * assigned a value from \a sx.
6672 *
6673 * The random numbers are generated from the generator \a r. At least
6674 * one variable will not be assigned: in case the relaxation attempt
6675 * would suggest that all variables should be assigned, a single
6676 * variable will be selected randomly to remain unassigned.
6677 *
6678 * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
6679 * \a sx are of different size.
6680 *
6681 * Throws an exception of type Int::OutOfLimits, if \a p is not between
6682 * \a 0.0 and \a 1.0.
6683 *
6684 * \ingroup TaskModelInt
6685 */
6687 relax(Home home, const BoolVarArgs& x, const BoolVarArgs& sx,
6688 Rnd r, double p);
6689
6690}
6691
6692
6695
6696namespace Gecode {
6697
6702
6708 : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
6709 Int::ViewRanges<Int::IntView> > {
6710 protected:
6715 public:
6717
6718
6721 };
6722
6728 protected:
6731 public:
6733
6734
6737
6739
6740 bool operator ()(void) const;
6742 void operator ++(void);
6744
6746
6747
6748 int min(void) const;
6750 int max(void) const;
6752 unsigned int width(void) const;
6754 };
6755
6756}
6757
6760
6762
6763namespace Gecode {
6764
6775
6781 protected:
6783 std::ostream& os;
6784 public:
6786 StdIntTracer(std::ostream& os0 = std::cerr);
6788 virtual void init(const Space& home, const IntTraceRecorder& t);
6790 virtual void prune(const Space& home, const IntTraceRecorder& t,
6791 const ViewTraceInfo& vti, int i, IntTraceDelta& d);
6793 virtual void fix(const Space& home, const IntTraceRecorder& t);
6795 virtual void fail(const Space& home, const IntTraceRecorder& t);
6797 virtual void done(const Space& home, const IntTraceRecorder& t);
6800 };
6801
6802
6813
6819 protected:
6821 std::ostream& os;
6822 public:
6824 StdBoolTracer(std::ostream& os0 = std::cerr);
6826 virtual void init(const Space& home, const BoolTraceRecorder& t);
6828 virtual void prune(const Space& home, const BoolTraceRecorder& t,
6829 const ViewTraceInfo& vti, int i, BoolTraceDelta& d);
6831 virtual void fix(const Space& home, const BoolTraceRecorder& t);
6833 virtual void fail(const Space& home, const BoolTraceRecorder& t);
6835 virtual void done(const Space& home, const BoolTraceRecorder& t);
6838 };
6839
6845 trace(Home home, const IntVarArgs& x,
6846 TraceFilter tf,
6847 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
6853 void
6854 trace(Home home, const IntVarArgs& x,
6855 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
6857
6863 trace(Home home, const BoolVarArgs& x,
6864 TraceFilter tf,
6865 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
6871 void
6872 trace(Home home, const BoolVarArgs& x,
6873 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
6875
6876}
6877
6878#include <gecode/int/trace.hpp>
6879
6880#endif
6881
6882// IFDEF: GECODE_HAS_INT_VARS
6883// STATISTICS: int-post
AFC(void)
Construct as not yet initialized.
Definition afc.hpp:119
Action(void)
Construct as not yet initialized.
Definition action.hpp:344
Argument array for non-primitive types.
Definition array.hpp:695
Traits of arrays in Gecode.
Definition array.hpp:94
Recording AFC information for Boolean variables.
Definition int.hh:5419
BoolAFC(void)
Construct as not yet initialized.
Definition afc.hpp:61
BoolAFC & operator=(const BoolAFC &a)
Assignment operator.
Definition afc.hpp:68
void init(Home home, const BoolVarArgs &x, double d=1.0, bool share=true)
Initialize for Boolean variables x with decay factor d.
Definition afc.hpp:78
Recording actions for Boolean variables.
Definition int.hh:5516
BoolAction(void)
Construct as not yet initialized.
Definition action.hpp:50
BoolAction & operator=(const BoolAction &a)
Assignment operator.
Definition action.hpp:57
void init(Home home, const BoolVarArgs &x, double d=1.0, bool p=true, bool f=true, BoolBranchMerit bm=nullptr)
Initialize for Boolean variables x with decay factor d.
Definition action.cpp:59
Which values to select for assignment.
Definition int.hh:6115
Select
Which value selection.
Definition int.hh:6118
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:6122
@ SEL_MIN
Select smallest value.
Definition int.hh:6119
@ SEL_MAX
Select largest value.
Definition int.hh:6120
@ SEL_RND
Select random value.
Definition int.hh:6121
BoolAssign(Select s=SEL_MIN)
Initialize with selection strategy s.
Definition assign.hpp:82
Select select(void) const
Return selection strategy.
Definition assign.hpp:94
Select s
Which value to select.
Definition int.hh:6126
Recording CHB for Boolean variables.
Definition int.hh:5617
BoolCHB & operator=(const BoolCHB &chb)
Assignment operator.
Definition chb.hpp:57
void init(Home home, const BoolVarArgs &x, BoolBranchMerit bm=nullptr)
Initialize for Boolean variables x.
Definition chb.cpp:56
BoolCHB(void)
Construct as not yet initialized.
Definition chb.hpp:50
Trace delta information for Boolean variables.
Definition int.hh:6727
void operator++(void)
Move iterator to next range (if possible).
int min(void) const
Return smallest value of range.
bool operator()(void) const
Test whether iterator is still at a range or done.
int max(void) const
Return largest value of range.
BoolTraceDelta(Int::BoolTraceView o, Int::BoolView n, const Delta &d)
Initialize with old trace view o, new view n, and delta d.
unsigned int width(void) const
Return width of range (distance between minimum and maximum).
int delta
Delta information.
Definition int.hh:6730
Which values to select for branching first.
Definition int.hh:6004
Select s
Which value to select.
Definition int.hh:6015
Select
Which value selection.
Definition int.hh:6007
@ SEL_MIN
Select smallest value.
Definition int.hh:6008
@ SEL_RND
Select random value.
Definition int.hh:6010
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:6011
@ SEL_MAX
Select largest value.
Definition int.hh:6009
Select select(void) const
Return selection strategy.
Definition val.hpp:124
BoolValBranch(Select s=SEL_MIN)
Initialize with selection strategy s.
Definition val.hpp:112
Passing Boolean variables.
Definition int.hh:739
BoolVarArgs(void)
Allocate empty array.
Definition array.hpp:114
BoolVarArgs & operator=(const BoolVarArgs &)=default
Assignment operator.
BoolVarArray & operator=(const BoolVarArray &)=default
Assignment operator.
BoolVarArray(void)
Default constructor (array of size 0).
Definition array.hpp:159
Which Boolean variable to select for branching.
Definition int.hh:5771
void expand(Home home, const BoolVarArgs &x)
Expand decay factor into AFC or action.
Definition var.hpp:345
Select select(void) const
Return selection strategy.
Definition var.hpp:340
BoolVarBranch(void)
Initialize with strategy SEL_NONE.
Definition var.hpp:308
Select
Which variable selection.
Definition int.hh:5774
@ SEL_DEGREE_MIN
With smallest degree.
Definition int.hh:5779
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition int.hh:5782
@ SEL_CHB_MIN
With lowest CHB.
Definition int.hh:5785
@ SEL_MERIT_MIN
With least merit.
Definition int.hh:5777
@ SEL_ACTION_MIN
With lowest action.
Definition int.hh:5783
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition int.hh:5781
@ SEL_RND
Random (uniform, for tie breaking).
Definition int.hh:5776
@ SEL_NONE
First unassigned.
Definition int.hh:5775
@ SEL_ACTION_MAX
With highest action.
Definition int.hh:5784
@ SEL_CHB_MAX
With highest CHB.
Definition int.hh:5786
@ SEL_MERIT_MAX
With highest merit.
Definition int.hh:5778
@ SEL_DEGREE_MAX
With largest degree.
Definition int.hh:5780
Select s
Which variable to select.
Definition int.hh:5790
Boolean integer variables.
Definition int.hh:534
bool one(void) const
Test whether domain is one.
Definition bool.hpp:107
unsigned int size(void) const
Return size (cardinality) of domain.
Definition bool.hpp:81
int val(void) const
Return assigned value.
Definition bool.hpp:57
bool zero(void) const
Test whether domain is zero.
Definition bool.hpp:103
int max(void) const
Return maximum of domain.
Definition bool.hpp:71
BoolVar & operator=(const BoolVar &)=default
Assignment operator.
int med(void) const
Return median of domain (greatest element not greater than the median).
Definition bool.hpp:67
friend class BoolVarArgs
Definition int.hh:536
friend class BoolVarArray
Definition int.hh:535
bool in(int n) const
Test whether n is contained in domain.
Definition bool.hpp:98
BoolVar(void)
Default constructor.
Definition bool.hpp:48
unsigned int width(void) const
Return width of domain (distance between maximum and minimum).
Definition bool.hpp:77
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value).
Definition bool.hpp:85
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value).
Definition bool.hpp:89
int min(void) const
Return minimum of domain.
Definition bool.hpp:63
bool none(void) const
Test whether domain is neither zero nor one.
Definition bool.hpp:111
bool range(void) const
Test whether domain is a range.
Definition bool.hpp:94
Base-class for branchers.
Definition core.hpp:1460
CHB(void)
Construct as not yet initialized.
Definition chb.hpp:346
Data stored for a DFA.
Definition dfa.hpp:42
int val(void) const
Return current symbol.
Definition dfa.hpp:293
void operator++(void)
Move iterator to next symbol.
Definition dfa.hpp:285
bool operator()(void) const
Test whether iterator still at a symbol.
Definition dfa.hpp:280
Symbols(const DFA &d)
Initialize to symbols of DFA d.
Definition dfa.hpp:269
Specification of a DFA transition.
Definition int.hh:2629
int i_state
input state
Definition int.hh:2631
int o_state
output state Default constructor
Definition int.hh:2633
Iterator for DFA transitions (sorted by symbols).
Definition int.hh:2640
int o_state(void) const
Return out-state of current transition.
Definition dfa.hpp:259
void operator++(void)
Move iterator to next transition.
Definition dfa.hpp:244
bool operator()(void) const
Test whether iterator still at a transition.
Definition dfa.hpp:239
Transitions(const DFA &d)
Initialize to all transitions of DFA d.
Definition dfa.hpp:213
int i_state(void) const
Return in-state of current transition.
Definition dfa.hpp:249
int symbol(void) const
Return symbol of current transition.
Definition dfa.hpp:254
Finite automaton with deterministic construction by default.
Definition int.hh:2620
bool operator==(const DFA &d) const
Test whether DFA is equal to d.
Definition dfa.hpp:330
int symbol_max(void) const
Return largest symbol in DFA.
Definition dfa.hpp:182
friend class Transitions
Definition int.hh:2693
unsigned int max_degree(void) const
Return maximal degree (in-degree and out-degree) of any state.
Definition dfa.hpp:157
int n_states(void) const
Return the number of states.
Definition dfa.hpp:139
int symbol_min(void) const
Return smallest symbol in DFA.
Definition dfa.hpp:175
DFA(void)
Initialize for DFA accepting the empty word.
Definition dfa.hpp:131
int final_lst(void) const
Return the number of the last final state.
Definition dfa.hpp:169
int n_transitions(void) const
Return the number of transitions.
Definition dfa.hpp:151
unsigned int n_symbols(void) const
Return the number of symbols.
Definition dfa.hpp:145
void init(int s, Transition t[], int f[], bool minimize=true)
Initialize DFA.
Definition dfa.cpp:162
std::size_t hash(void) const
Return hash key.
Definition dfa.hpp:189
bool operator!=(const DFA &d) const
Test whether DFA is not equal to d.
Definition dfa.hpp:347
int final_fst(void) const
Return the number of the first final state.
Definition dfa.hpp:163
static DFA nfa(int s, Transition t[], int f[])
Construct a nondeterministic finite automaton.
Definition dfa.cpp:545
Generic domain change information to be supplied to advisors.
Definition core.hpp:209
Home class for posting propagators
Definition core.hpp:863
Recording AFC information for integer variables.
Definition int.hh:5379
IntAFC(void)
Construct as not yet initialized.
Definition afc.hpp:37
void init(Home home, const IntVarArgs &x, double d=1.0, bool share=true)
Initialize for integer variables x with decay factor d.
Definition afc.hpp:54
IntAFC & operator=(const IntAFC &a)
Assignment operator.
Definition afc.hpp:44
Recording actions for integer variables.
Definition int.hh:5465
void init(Home home, const IntVarArgs &x, double d=1.0, bool p=true, bool f=true, IntBranchMerit bm=nullptr)
Initialize for integer variables x with decay factor d.
Definition action.cpp:45
IntAction & operator=(const IntAction &a)
Assignment operator.
Definition action.hpp:44
IntAction(void)
Construct as not yet initialized.
Definition action.hpp:37
Passing integer arguments.
Definition int.hh:653
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
Definition array.hpp:76
IntArgs(void)
Allocate empty array.
Definition array.hpp:42
Which values to select for assignment.
Definition int.hh:6086
Select s
Which value to select.
Definition int.hh:6098
Select select(void) const
Return selection strategy.
Definition assign.hpp:49
IntAssign(Select s=SEL_MIN)
Initialize with selection strategy s.
Definition assign.hpp:37
Select
Which value selection.
Definition int.hh:6089
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:6094
@ SEL_MIN
Select smallest value.
Definition int.hh:6090
@ SEL_MED
Select greatest value not greater than the median.
Definition int.hh:6091
@ SEL_RND
Select random value.
Definition int.hh:6093
@ SEL_MAX
Select largest value.
Definition int.hh:6092
Recording CHB for integer variables.
Definition int.hh:5573
IntCHB(void)
Construct as not yet initialized.
Definition chb.hpp:37
IntCHB & operator=(const IntCHB &chb)
Assignment operator.
Definition chb.hpp:44
void init(Home home, const IntVarArgs &x, IntBranchMerit bm=nullptr)
Initialize for integer variables x.
Definition chb.cpp:44
Data(int n, const IntArgs &matrix)
const int n
Number of sites.
Definition int.hh:3361
const IntSharedArray matrix
Row-major matrix, empty for a callable.
Definition int.hh:3362
const std::function< int(int, int)> function
Computed distance.
Definition int.hh:3363
int size(void) const
Number of sites.
IntDistance(int n, const IntArgs &matrix)
Copy and validate an n by n row-major distance matrix.
int operator()(int a, int b) const
Distance between valid indices a and b.
unsigned int width(void) const
Return width of range (distance between minimum and maximum).
bool operator()(void) const
Test whether iterator is still at a range or done.
int max(void) const
Return largest value of range.
void operator++(void)
Move iterator to next range (if possible).
void init(const IntSet &s)
Initialize with ranges for set s.
int min(void) const
Return smallest value of range.
IntSetRanges(void)
Default constructor.
void init(const IntSet &s)
Initialize with values for s.
IntSetValues(void)
Default constructor.
Integer sets.
Definition int.hh:179
int min(void) const
Return minimum of entire set.
unsigned int width(void) const
Return width of set (distance between maximum and minimum).
int min(int i) const
Return minimum of range at position i.
bool in(int n) const
Return whether n is included in the set.
int max(int i) const
Return maximum of range at position i.
int max(void) const
Return maximum of entire set.
friend class IntSetRanges
Definition int.hh:180
int ranges(void) const
Return number of ranges of the specification.
bool operator==(const IntSet &s) const
Return whether s is equal.
unsigned int size(void) const
Return size (cardinality) of set.
IntSet(void)
Initialize as empty set.
Definition int-set-1.hpp:47
static const IntSet empty
Empty set.
Definition int.hh:302
bool operator!=(const IntSet &s) const
Return whether s is not equal.
friend class IntSetInit
Definition int.hh:181
Trace delta information for integer variables.
Definition int.hh:6709
Int::ViewRanges< Int::IntView > rn
Iterator over the new values.
Definition int.hh:6712
Iter::Ranges::RangeList ro
Iterator over the old values.
Definition int.hh:6714
IntTraceDelta(Int::IntTraceView o, Int::IntView n, const Delta &d)
Initialize with old trace view o, new view n, and delta d.
Definition int-delta.hpp:37
Which values to select for branching first.
Definition int.hh:5969
Select
Which value selection.
Definition int.hh:5972
@ SEL_VALUES_MIN
Select all values starting from smallest.
Definition int.hh:5982
@ SEL_RND
Select random value.
Definition int.hh:5976
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition int.hh:5978
@ SEL_MIN
Select smallest value.
Definition int.hh:5973
@ SEL_MAX
Select largest value.
Definition int.hh:5975
@ SEL_RANGE_MAX
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Definition int.hh:5980
@ SEL_RANGE_MIN
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
Definition int.hh:5979
@ SEL_VALUES_MAX
Select all values starting from largest.
Definition int.hh:5983
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:5981
@ SEL_MED
Select greatest value not greater than the median.
Definition int.hh:5974
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition int.hh:5977
Select select(void) const
Return selection strategy.
Definition val.hpp:49
IntValBranch(Select s=SEL_MIN)
Initialize with selection strategy s.
Definition val.hpp:37
Select s
Which value to select.
Definition int.hh:5987
Passing integer variables.
Definition int.hh:681
IntVarArgs(void)
Allocate empty array.
Definition array.hpp:85
IntVarArgs & operator=(const IntVarArgs &)=default
Assignment operator.
IntVarArray & operator=(const IntVarArray &)=default
Assignment operator.
IntVarArray(void)
Default constructor (array of size 0).
Definition array.hpp:143
Which integer variable to select for branching.
Definition int.hh:5685
void expand(Home home, const IntVarArgs &x)
Expand AFC, action, and CHB.
Definition var.hpp:74
Select
Which variable selection.
Definition int.hh:5688
@ SEL_MAX_MIN
With smallest max.
Definition int.hh:5703
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition int.hh:5700
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition int.hh:5710
@ SEL_MIN_MIN
With smallest min.
Definition int.hh:5701
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition int.hh:5712
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition int.hh:5709
@ SEL_REGRET_MIN_MIN
With smallest min-regret.
Definition int.hh:5720
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition int.hh:5707
@ SEL_MIN_MAX
With largest min.
Definition int.hh:5702
@ SEL_REGRET_MIN_MAX
With largest min-regret.
Definition int.hh:5726
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition int.hh:5714
@ SEL_MAX_MAX
With largest max.
Definition int.hh:5704
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition int.hh:5695
@ SEL_SIZE_MIN
With smallest domain size.
Definition int.hh:5705
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition int.hh:5696
@ SEL_MERIT_MAX
With highest merit.
Definition int.hh:5692
@ SEL_DEGREE_MAX
With largest degree.
Definition int.hh:5694
@ SEL_SIZE_MAX
With largest domain size.
Definition int.hh:5706
@ SEL_ACTION_MIN
With lowest action.
Definition int.hh:5697
@ SEL_ACTION_MAX
With highest action.
Definition int.hh:5698
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition int.hh:5699
@ SEL_RND
Random (uniform, for tie breaking).
Definition int.hh:5690
@ SEL_NONE
First unassigned.
Definition int.hh:5689
@ SEL_MERIT_MIN
With least merit.
Definition int.hh:5691
@ SEL_REGRET_MAX_MIN
With smallest max-regret.
Definition int.hh:5732
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition int.hh:5713
@ SEL_DEGREE_MIN
With smallest degree.
Definition int.hh:5693
@ SEL_REGRET_MAX_MAX
With largest max-regret.
Definition int.hh:5738
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition int.hh:5711
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition int.hh:5708
Select s
Which variable to select.
Definition int.hh:5742
Select select(void) const
Return selection strategy.
Definition var.hpp:69
IntVarBranch(void)
Initialize with strategy SEL_NONE.
Definition var.hpp:37
IntVarRanges(void)
Default constructor.
Definition int.hpp:106
void init(const IntVar &x)
Initialize with ranges for integer variable x.
Definition int.hpp:113
IntVarValues(void)
Default constructor.
Definition int.hpp:124
void init(const IntVar &x)
Initialize with values x.
Definition int.hpp:133
Integer variables.
Definition int.hh:390
unsigned int size(void) const
Return size (cardinality) of domain.
Definition int.hpp:80
IntVar & operator=(const IntVar &)=default
Assignment operator.
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value).
Definition int.hpp:88
int min(void) const
Return minimum of domain.
Definition int.hpp:62
friend class IntVarArgs
Definition int.hh:392
int val(void) const
Return assigned value.
Definition int.hpp:56
IntVar(void)
Default constructor.
Definition int.hpp:47
bool in(int n) const
Test whether n is contained in domain.
Definition int.hpp:97
unsigned int width(void) const
Return width of domain (distance between maximum and minimum).
Definition int.hpp:76
bool range(void) const
Test whether domain is a range.
Definition int.hpp:93
friend class IntVarArray
Definition int.hh:391
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value).
Definition int.hpp:84
int med(void) const
Return median of domain (greatest element not greater than the median).
Definition int.hpp:66
int max(void) const
Return maximum of domain.
Definition int.hpp:70
Duplicate of a Boolean view.
Boolean variable implementation.
Definition var-imp.hpp:491
Boolean view for Boolean variables.
Definition view.hpp:1378
Internal access to finalized tuple-set support representations.
Definition int.hh:3125
static bool dense_compressed_support(const TupleSet &ts, int p, int n, const TupleSet::CSupportWord *&b, const TupleSet::CSupportWord *&e)
Return compressed support words for position/value.
static bool support_id(const TupleSet &ts, int p, int n, unsigned int &gid)
Return support id for position/value.
static unsigned int sparse_values(const TupleSet &ts)
Return number of sparse support values.
static bool sparse_support(const TupleSet &ts, int p, int n, const unsigned int *&b, const unsigned int *&e, unsigned int &gid)
Return sparse support tuple id range for position/value.
static const unsigned int * sparse_support_offsets(const TupleSet &ts)
Return sparse support offsets.
static const unsigned int * sparse_tuple_value_ids(const TupleSet &ts)
Return tuple-value sparse ids.
Duplicate of an integer view.
Range iterator for ranges of integer variable implementation.
Definition var-imp.hpp:392
Integer variable implementation.
Definition var-imp.hpp:89
Integer view for integer variables.
Definition view.hpp:129
Implementation of a symmetry at the modelling level.
Definition ldsb.hh:106
Materialize positions required by the minimum eventual length.
Range iterator for integer views.
Definition view.hpp:54
Range iterator for computing set difference.
Range iterator for range lists
Value iterator from range iterator.
LocalHandle(void)
Create local handle pointing to nullptr object.
Definition core.hpp:3968
OpenBoolVarList(void)
Construct an uninitialized list.
Open list of integer variables.
Definition int.hh:1076
OpenIntVarList(void)
Construct an uninitialized list.
std::function< IntSet(int i)> Domain
Function returning the domain for position i.
Definition int.hh:1084
Space-local list of variables with an open length.
Definition int.hh:923
void materialize(Space &home, int n)
Materialize the first n variables.
void close(Space &home)
Close the list at its materialized length.
void update(Space &home, OpenVarList< Var > &s)
Update during cloning.
int known_length(void) const
Return the number of constructed positions (their values may be unassigned).
friend class OpenViewList
Definition int.hh:924
OpenVarList(Space &home, Factory create, int max=Int::Limits::max)
Construct a list using create for each position.
IntVar length(void) const
Return the eventual-length variable.
std::function< Var(Space &home, int i)> Factory
Function creating the variable at position i in home.
Definition int.hh:948
OpenVarList(Space &home, Factory create, Transition t, int max=Int::Limits::max)
Construct a list using create and transition function t.
OpenVarList(void)
Construct an uninitialized list.
void cancel(Space &home, Propagator &p)
Cancel the subscription of p to the addition of positions.
void reschedule(Space &home, Propagator &p)
Reschedule p for the addition of positions.
void subscribe(Space &home, Propagator &p)
Subscribe p to the addition of positions.
std::function< void(Space &home, OpenVarList< Var > x, int i)> Transition
Function called after materializing position i.
Definition int.hh:959
Var get(Space &home, int i)
Require and return the variable at position i.
Var operator[](int i) const
Return variable at position i, where 0 <= i < known_length().
void append(Space &home, Var x)
Append variable x.
void materialize(Space &home, int n)
Require and construct at least the first n positions.
View operator[](int i) const
Return the view at constructed position i.
Int::IntView length(void) const
Return the eventual-length view.
void reschedule(Space &home, Propagator &p)
Reschedule p for construction of positions.
int known_length(void) const
Return the number of constructed positions.
void update(Space &home, OpenViewList< View > &s)
Update during cloning.
void cancel(Space &home, Propagator &p)
Cancel the subscription of p to construction of positions.
OpenViewList(void)
Construct an uninitialized list.
void subscribe(Space &home, Propagator &p)
Subscribe p to construction of positions.
Base-class for propagators.
Definition core.hpp:1073
Reification specification.
Definition int.hh:1176
BoolVar x
The Boolean control variable.
Definition int.hh:1179
BoolVar var(void) const
Return Boolean control variable.
Definition reify.hpp:48
Reify(void)
Default constructor without proper initialization.
Definition reify.hpp:42
ReifyMode mode(void) const
Return reification mode.
Definition reify.hpp:56
ReifyMode rm
The reification mode.
Definition int.hh:1181
Random number generator.
Definition rnd.hpp:42
Shared array with arbitrary number of elements.
SharedHandle(void)
Create shared handle with no object pointing to.
Computation spaces.
Definition core.hpp:1787
virtual void init(const Space &home, const BoolTraceRecorder &t)
Print init information.
Definition tracer.cpp:123
virtual void prune(const Space &home, const BoolTraceRecorder &t, const ViewTraceInfo &vti, int i, BoolTraceDelta &d)
Print prune information.
Definition tracer.cpp:132
std::ostream & os
Output stream to use.
Definition int.hh:6821
virtual void fix(const Space &home, const BoolTraceRecorder &t)
Print fixpoint information.
Definition tracer.cpp:152
static StdBoolTracer def
Default tracer (printing to std::cerr).
Definition int.hh:6837
StdBoolTracer(std::ostream &os0=std::cerr)
Initialize with output stream os0.
Definition tracer.cpp:119
virtual void fail(const Space &home, const BoolTraceRecorder &t)
Print failure information.
Definition tracer.cpp:170
virtual void done(const Space &home, const BoolTraceRecorder &t)
Print that trace recorder is done.
Definition tracer.cpp:188
virtual void done(const Space &home, const IntTraceRecorder &t)
Print that trace recorder is done.
Definition tracer.cpp:108
StdIntTracer(std::ostream &os0=std::cerr)
Initialize with output stream os0 and events \ e.
Definition tracer.cpp:39
std::ostream & os
Output stream to use.
Definition int.hh:6783
virtual void prune(const Space &home, const IntTraceRecorder &t, const ViewTraceInfo &vti, int i, IntTraceDelta &d)
Print prune information.
Definition tracer.cpp:52
virtual void init(const Space &home, const IntTraceRecorder &t)
Print init information.
Definition tracer.cpp:43
virtual void fail(const Space &home, const IntTraceRecorder &t)
Print failure information.
Definition tracer.cpp:90
virtual void fix(const Space &home, const IntTraceRecorder &t)
Print fixpoint information.
Definition tracer.cpp:72
static StdIntTracer def
Default tracer (printing to std::cerr).
Definition int.hh:6799
Date item for bitsets.
Collection of symmetries.
Definition int.hh:6471
A reference-counted pointer to a SymmetryObject.
Definition int.hh:6434
SymmetryHandle(void)
Default constructor.
Definition sym-obj.cpp:37
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Definition int.hh:6437
void decrement(void)
Decrement counter.
Definition sym-obj.cpp:66
const SymmetryHandle & operator=(const SymmetryHandle &h)
Assignment operator.
Definition sym-obj.cpp:47
void increment(void)
Increment counter.
Definition sym-obj.cpp:62
Combine variable selection criteria for tie-breaking.
Definition tiebreak.hpp:38
Trace filters.
Definition filter.hpp:133
Compressed support data for one tuple-word block.
Definition int.hh:2832
unsigned int widx
Word index in tuple-word array.
Definition int.hh:2834
BitSetData bits
Support bits in that word.
Definition int.hh:2835
Data stored for a Table.
Definition int.hh:2873
int max
Largest value.
Definition int.hh:2898
void clear_support(void)
Release partially or fully constructed support data.
unsigned int compressed_n_entries
Number of compressed support entries.
Definition int.hh:2926
int n_free
Number of free tuple entries of arity.
Definition int.hh:2894
bool terminal(void) const
Is datastructure no longer mutable.
Definition tuple-set.hpp:93
unsigned int * sparse_tuples
Sparse support tuple ids (size arity*n_tuples).
Definition int.hh:2918
void resize(void)
Resize tuple data.
BitSetData * support
Pointer to all support data.
Definition int.hh:2910
Data(int a)
Initialize as empty tuple set with arity a.
Definition tuple-set.hpp:66
unsigned int * compressed_offsets
Compressed support offsets (size n_vals+1).
Definition int.hh:2922
unsigned int n_words
Number of words for support.
Definition int.hh:2890
int min
Smallest value.
Definition int.hh:2896
State empty_state(ExtensionalPropKind epk) const
Select the state for an empty finalized tuple set.
bool failed(void) const
Has finalization failed.
Definition tuple-set.hpp:88
static void set(BitSetData *d, unsigned int n)
Set bit n in bitset data d.
unsigned int * sparse_offsets
Sparse support offsets (size sparse_n_vals+1).
Definition int.hh:2916
void finalize(void)
Finalize datastructure (disallows additions of more Tuples).
int n_tuples
Number of Tuples.
Definition int.hh:2892
unsigned int sparse_n_vals
Number of sparse support values.
Definition int.hh:2914
Tuple get(int i) const
Return tuple with number i.
unsigned int * sparse_tv
Tuple cell to sparse support id map (size arity*n_tuples).
Definition int.hh:2920
int * td
Tuple data.
Definition int.hh:2902
State state
Tuple set lifecycle state and finalized representation.
Definition int.hh:2912
CSupportWord * compressed_words
Compressed support words (size compressed_n_entries).
Definition int.hh:2924
unsigned int tuple2idx(Tuple t) const
Map tuple address to index.
State
Tuple set lifecycle state and finalized representation.
Definition int.hh:2879
Range * range
Pointer to all ranges.
Definition int.hh:2906
const Range * lst(int i) const
Return last range for position i.
bool finalized(void) const
Is datastructure finalized.
Definition tuple-set.hpp:81
State select_state(ExtensionalPropKind epk, bool dense_possible, bool sparse_possible, bool compressed_possible, bool support_bits_sparse, unsigned long long dense_bytes) const
Select the finalized state for the computed table layout.
ValueData * vd
Value data.
Definition int.hh:2904
const Range * fst(int i) const
Return first range for position i.
static const int n_initial_free
Initial number of free tuples.
Definition int.hh:2876
std::size_t key
Hash key.
Definition int.hh:2900
Tuple add(void)
Return newly added tuple.
Definition tuple-set.hpp:98
unsigned int * range_base
Pointer to all range support ids.
Definition int.hh:2908
Range information.
Definition int.hh:2838
BitSetData * s
Begin of supports.
Definition int.hh:2845
unsigned int width(void) const
Return the width.
Definition tuple-set.hpp:45
int max
Maximum value.
Definition int.hh:2843
int min
Minimum value.
Definition int.hh:2841
const BitSetData * supports(unsigned int n_words, int n) const
Return the dense supports for value n.
Definition tuple-set.hpp:50
bool operator()(void) const
Test whether iterator is still at a range.
Ranges(const TupleSet &ts, int i)
Initialize for column i.
int max(void) const
Return largest value of range.
const Range * l
Last range.
Definition int.hh:3093
int min(void) const
Return smallest value of range.
void operator++(void)
Move iterator to next range (if possible).
const Range * c
Current range.
Definition int.hh:3091
unsigned int width(void) const
Return width of range (distance between minimum and maximum).
Data about values in the table.
Definition int.hh:2858
unsigned int start(int n) const
Find start range for value n.
unsigned int n
Number of ranges.
Definition int.hh:2861
unsigned int * base
Base support id for each range (sparse and compressed only).
Definition int.hh:2865
Class representing a set of tuples.
Definition int.hh:2821
TupleSet(void)
Construct an uninitialized tuple set.
bool failed(void) const
Has tuple-set finalization failed.
void _add(const IntArgs &t)
Add tuple t to tuple set.
int tuples(void) const
Number of tuples.
int max(void) const
Return maximal value in all tuples.
bool operator!=(const TupleSet &t) const
Test whether tuple set is different from t.
bool finalized(void) const
Is tuple set successfully finalized.
ExtensionalPropKind representation(void) const
Return materialized tuple-set representation.
TupleSet & add(const IntArgs &t)
Add tuple t to tuple set.
bool operator==(const TupleSet &t) const
Test whether tuple set is equal to t.
TupleSet & operator=(const TupleSet &t)
Assignment operator.
Tuple operator[](int i) const
Get tuple i.
const Range * lst(int i) const
Return last range for position i.
int * Tuple
Type of a tuple.
Definition int.hh:2828
std::size_t hash(void) const
Return hash key.
void finalize(void)
Finalize tuple set with dense support data.
bool equal(const TupleSet &t) const
Test whether tuple set is equal to t.
const Range * fst(int i) const
Return first range for position i.
unsigned int words(void) const
Return number of required bit set words.
int min(void) const
Return minimal value in all tuples.
Data & raw(void) const
Get raw data (must be initialized).
Gecode::Support::BitSetData BitSetData
Import bit set data type.
Definition int.hh:2830
Data & data(void) const
Get data (must be initialized and finalized).
void init(int a)
Initialize an uninitialized tuple set.
int arity(void) const
Arity of tuple set.
Variable arrays
Definition array.hpp:112
Base class for variables.
Definition var.hpp:40
View trace information.
Definition core.hpp:917
Propagator for recording view trace information.
Definition recorder.hpp:60
Tracer that process view trace information.
Definition tracer.hpp:51
#define GECODE_INT_EXPORT
Definition int.hh:86
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te=(TE_INIT|TE_PRUNE|TE_FIX|TE_FAIL|TE_DONE), FloatTracer &t=StdFloatTracer::def)
Create a tracer for float variables.
Definition trace.cpp:39
ViewTraceRecorder< Int::IntView > IntTraceRecorder
Trace recorder for integer variables.
Definition int.hh:6774
ViewTraceRecorder< Int::BoolView > BoolTraceRecorder
Trace recorder for Boolean variables.
Definition int.hh:6812
ViewTracer< Int::IntView > IntTracer
Tracer for integer variables.
Definition int.hh:6769
ViewTracer< Int::BoolView > BoolTracer
Tracer for Boolean variables.
Definition int.hh:6807
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Definition var.hpp:48
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Assign all x with variable selection vars and value selection vals.
Definition branch.cpp:111
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
Definition branch.cpp:39
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Definition linear.cpp:41
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
Definition bool.cpp:39
void binpacking(Home home, const IntVarArgs &l, const IntVarArgs &b, const IntArgs &s, IntPropLevel ipl=IPL_DEF)
Post propagator for bin packing.
std::function< double(const Space &home, IntVar x, int i)> IntBranchMerit
Branch merit function type for integer variables.
Definition int.hh:5301
std::function< bool(const Space &home, IntVar x, int i)> IntBranchFilter
Branch filter function type for integer variables.
Definition int.hh:5279
std::function< bool(const Space &home, BoolVar x, int i)> BoolBranchFilter
Branch filter function type for Boolean variables.
Definition int.hh:5289
std::function< int(const Space &home, BoolVar x, int i)> BoolBranchVal
Branch value function type for Boolean variables.
Definition int.hh:5337
std::function< double(const Space &home, BoolVar x, int i)> BoolBranchMerit
Branch merit function type for Boolean variables.
Definition int.hh:5312
std::function< int(const Space &home, IntVar x, int i)> IntBranchVal
Branch value function type for integer variables.
Definition int.hh:5325
std::function< void(Space &home, unsigned int a, BoolVar x, int i, int n)> BoolBranchCommit
Branch commit function type for Boolean variables.
Definition int.hh:5366
std::function< void(Space &home, unsigned int a, IntVar x, int i, int n)> IntBranchCommit
Branch commit function type for integer variables.
Definition int.hh:5352
ExtensionalPropKind
Support representation selection for extensional tuple sets.
Definition int.hh:2794
void extensional(Home home, const IntVarArgs &x, DFA d, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for extensional constraint described by a DFA.
@ EPK_AUTO
Select dense or compressed representation automatically.
Definition int.hh:2795
@ EPK_DENSE
Use dense support representation.
Definition int.hh:2796
@ EPK_SPARSE
Use sparse support representation.
Definition int.hh:2797
@ EPK_DENSE_COMPRESSED
Use compressed dense support representation.
Definition int.hh:2798
void nooverlap(Home home, const IntVarArgs &x, const IntArgs &w, const IntVarArgs &y, const IntArgs &h, IntPropLevel ipl=IPL_DEF)
Post propagator for rectangle packing.
void precede(Home home, const IntVarArgs &x, int s, int t, IntPropLevel=IPL_DEF)
Post propagator that s precedes t in x.
Definition precede.cpp:43
void clause(Home home, BoolOpType o, const BoolVarArgs &x, const BoolVarArgs &y, BoolVar z, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for Boolean clause with positive variables x and negative variables...
Definition bool.cpp:955
void sliding_sum(Home home, OpenIntVarList x, int q, int l, int u, IntPropLevel ipl=IPL_DEF)
Constrain the sum of every complete window in x.
Definition sequence.cpp:213
void product(Home home, const IntVarArgs &x, IntVar y, IntPropLevel ipl=IPL_DEF)
Constrain y to the exact product of the variables in x.
Reify imp(BoolVar x)
Use implication for reification.
Definition reify.hpp:73
IntRelType
Relation types for integers.
Definition int.hh:1225
Reify eqv(BoolVar x)
Use equivalence for reification.
Definition reify.hpp:69
TaskType
Type of task for scheduling constraints.
Definition int.hh:1305
ReifyMode
Mode for reification.
Definition int.hh:1148
BoolOpType
Operation types for Booleans.
Definition int.hh:1250
Reify pmi(BoolVar x)
Use reverse implication for reification.
Definition reify.hpp:77
void product_mod(Home home, const IntVarArgs &x, int m, IntVar y, IntPropLevel ipl=IPL_DEF)
Constrain y to the product of x modulo m.
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:1274
ArgArray< TaskType > TaskTypeArgs
Argument arrays for passing task type arguments.
Definition int.hh:1316
@ IRT_EQ
Equality ( ).
Definition int.hh:1226
@ IRT_NQ
Disequality ( ).
Definition int.hh:1227
@ IRT_GQ
Greater or equal ( ).
Definition int.hh:1230
@ IRT_LE
Less ( ).
Definition int.hh:1229
@ IRT_GR
Greater ( ).
Definition int.hh:1231
@ IRT_LQ
Less or equal ( ).
Definition int.hh:1228
@ TT_FIXS
Definition int.hh:1307
@ TT_FIXE
Definition int.hh:1308
@ TT_FIXP
Definition int.hh:1306
@ RM_IMP
Implication for reification.
Definition int.hh:1162
@ RM_PMI
Inverse implication for reification.
Definition int.hh:1169
@ RM_EQV
Equivalence for reification (default).
Definition int.hh:1155
@ BOT_OR
Disjunction.
Definition int.hh:1252
@ BOT_EQV
Equivalence.
Definition int.hh:1254
@ BOT_IMP
Implication.
Definition int.hh:1253
@ BOT_XOR
Exclusive or.
Definition int.hh:1255
@ BOT_AND
Conjunction.
Definition int.hh:1251
@ IPL_BITS_
Number of bits required (internal).
Definition int.hh:1285
@ IPL_BASIC
Use basic propagation algorithm.
Definition int.hh:1281
@ IPL_BASIC_ADVANCED
Use both.
Definition int.hh:1283
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Definition int.hh:1279
@ IPL_FULL
Use full propagation.
Definition int.hh:1284
@ IPL_VAL
Value propagation.
Definition int.hh:1277
@ IPL_ADVANCED
Use advanced propagation algorithm.
Definition int.hh:1282
@ IPL_DEF
Simple propagation levels.
Definition int.hh:1276
@ IPL_BND
Bounds propagation.
Definition int.hh:1278
@ TE_INIT
Trace init events.
Definition recorder.hpp:43
@ TE_PRUNE
Trace prune events.
Definition recorder.hpp:44
@ TE_FIX
Trace fixpoint events.
Definition recorder.hpp:45
@ TE_FAIL
Trace fail events.
Definition recorder.hpp:46
@ TE_DONE
Trace done events.
Definition recorder.hpp:47
Extensional propagators
Definition int.hh:2774
Symmetry breaking for integer variables.
Definition int.hh:6425
Numerical limits for integer variables.
Definition int.hh:119
const long long int llmin
Smallest allowed long long integer value.
Definition int.hh:129
void positive(int n, const char *l)
Check whether n is in range and strictly positive, otherwise throw out of limits with information l.
Definition limits.hpp:57
const long long int llmax
Largest allowed long long integer value.
Definition int.hh:127
bool overflow_add(int n, int m)
Check whether adding n and m would overflow.
Definition limits.hpp:79
void nonnegative(int n, const char *l)
Check whether n is in range and nonnegative, otherwise throw out of limits with information l.
Definition limits.hpp:68
void check(int n, const char *l)
Check whether n is in range, otherwise throw out of limits with information l.
Definition limits.hpp:46
const int infinity
Infinity for integers.
Definition int.hh:125
bool overflow_mul(int n, int m)
Check whether multiplying n and m would overflow.
Definition limits.hpp:107
const int min
Smallest allowed integer value.
Definition int.hh:123
bool valid(int n)
Return whether n is in range.
Definition limits.hpp:37
const int max
Largest allowed integer value.
Definition int.hh:121
const long long int llinfinity
Infinity for long long integers.
Definition int.hh:131
bool overflow_sub(int n, int m)
Check whether subtracting m from n would overflow.
Definition limits.hpp:93
Finite domain integers.
Definition lastval.hh:52
Gecode toplevel namespace
ArgArray< IntSet > IntSetArgs
Passing set arguments.
Definition int.hh:644
BoolVarBranch BOOL_VAR_CHB_MIN(BoolCHB c, BranchTbl tbl=nullptr)
Select variable with lowest CHB Q-score.
Definition var.hpp:434
IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=nullptr)
Select value as defined by the value function v and commit function c.
Definition assign.hpp:75
IntAssign INT_ASSIGN_RND(Rnd r)
Select random value.
Definition assign.hpp:70
SymmetryHandle ValueSymmetry(const IntArgs &v)
Values in v are interchangeable.
Definition ldsb.cpp:81
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Definition val.hpp:75
SymmetryHandle ValueSequenceSymmetry(const IntArgs &v, int ss)
Value sequences in v of size ss are interchangeable.
Definition ldsb.cpp:102
BoolAssign BOOL_ASSIGN_MAX(void)
Select largest value.
Definition assign.hpp:105
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel ipl=IPL_DEF)
Post propagator for .
Definition count.cpp:40
IntValBranch INT_VAL_RANGE_MIN(void)
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
Definition val.hpp:85
IntValBranch INT_VAL_RANGE_MAX(void)
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Definition val.hpp:90
BoolValBranch BOOL_VAL(BoolBranchVal v, BoolBranchCommit c=nullptr)
Select value as defined by the value function v and commit function c Uses a commit function as defau...
Definition val.hpp:145
IntValBranch INT_VALUES_MAX(void)
Try all values starting from largest.
Definition val.hpp:105
IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:236
SymmetryHandle values_reflect(int lower, int upper)
The values from lower to upper (inclusive) can be reflected.
Definition ldsb.cpp:106
IntVarBranch INT_VAR_CHB_SIZE_MIN(IntCHB c, BranchTbl tbl=nullptr)
Select variable with smallest CHB Q-score divided by domain size.
Definition var.hpp:266
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition channel.cpp:41
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void order(Home home, IntVar s0, int p0, IntVar s1, int p1, BoolVar b, IntPropLevel ipl=IPL_DEF)
Post propagators for ordering two tasks.
Definition order.cpp:41
IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree.
Definition var.hpp:121
IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=nullptr)
Select variable with smallest min-regret.
Definition var.hpp:286
IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with highest action with decay factor d.
Definition var.hpp:156
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntPropLevel ipl=IPL_DEF)
Post propagator for .
Definition sequence.cpp:47
SharedArray< int > IntSharedArray
Arrays of integers that can be shared among several element constraints.
Definition int.hh:1813
IntValBranch INT_VAL_MED(void)
Select greatest value not greater than the median.
Definition val.hpp:60
IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=nullptr)
Select value as defined by the value function v and commit function c Uses a commit function as defau...
Definition val.hpp:95
TieBreak< VarBranch > tiebreak(VarBranch a, VarBranch b)
Combine variable selection criteria a and b for tie-breaking.
Definition tiebreak.hpp:80
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition val-sel.hpp:39
void sorted(Home home, const IntVarArgs &x, const IntVarArgs &y, IntPropLevel ipl=IPL_DEF)
Post propagator that y is x sorted in increasing order.
Definition sorted.cpp:58
IntPropLevel ba(IntPropLevel ipl)
Extract basic or advanced from propagation level.
Definition ipl.hpp:43
IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=nullptr)
Select variable with largest min-regret.
Definition var.hpp:291
void divides(Home home, IntVar divisor, IntVar dividend, Reify r, IntPropLevel ipl=IPL_DEF)
Reify whether divisor divides dividend.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Post propagator for for all .
Definition distinct.cpp:46
IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest action divided by domain size with decay factor d.
Definition var.hpp:256
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
BoolValBranch BOOL_VAL_MIN(void)
Select smallest value.
Definition val.hpp:130
BoolVarBranch BOOL_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with least merit according to branch merit function bm.
Definition var.hpp:374
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Definition var.hpp:96
IntPropLevel vbd(IntPropLevel ipl)
Extract value, bounds, or domain propagation from propagation level.
Definition ipl.hpp:37
IntRelType neg(IntRelType irt)
Return negated relation type of irt.
Definition irt.hpp:52
IntVarBranch INT_VAR_CHB_MIN(IntCHB c, BranchTbl tbl=nullptr)
Select variable with lowest CHB Q-score.
Definition var.hpp:166
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Definition dom.cpp:40
BoolVarBranch BOOL_VAR_NONE(void)
Select first unassigned variable.
Definition var.hpp:364
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Definition element.cpp:39
IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count with decay factor d.
Definition var.hpp:136
void argmax(Home home, const IntVarArgs &x, IntVar y, bool tiebreak=true, IntPropLevel ipl=IPL_DEF)
Post propagator for .
IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest accumulated failure count with decay factor d.
Definition var.hpp:126
IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=nullptr)
Select variable with largest max-regret.
Definition var.hpp:301
IntValBranch INT_VALUES_MIN(void)
Try all values starting from smallest.
Definition val.hpp:100
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3, IntPropLevel ipl=IPL_DEF)
Post propagator for .
IntRelType swap(IntRelType irt)
Return swapped relation type of irt.
Definition irt.hpp:37
void path(Home home, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl=IPL_DEF)
Post propagator such that x forms a Hamiltonian path.
Definition circuit.cpp:169
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
IntVarBranch INT_VAR_CHB_MAX(IntCHB c, BranchTbl tbl=nullptr)
Select variable with largest CHB Q-score.
Definition var.hpp:176
IntValBranch INT_VAL_MAX(void)
Select largest value.
Definition val.hpp:65
BoolValBranch BOOL_VAL_MAX(void)
Select largest value.
Definition val.hpp:135
BoolVarBranch BOOL_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking).
Definition var.hpp:369
BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with lowest action with decay factor d.
Definition var.hpp:414
void when(Home home, BoolVar x, std::function< void(Space &home)> t, std::function< void(Space &home)> e, IntPropLevel ipl=IPL_DEF)
Execute t (then) when x is assigned one, and e (else) otherwise.
Definition exec.cpp:70
void cumulative(Home home, int c, const TaskTypeArgs &t, const IntVarArgs &flex, const IntArgs &fix, const IntArgs &u, IntPropLevel ipl=IPL_DEF)
Post propagators for scheduling tasks on cumulative resources.
BoolVarBranch BOOL_VAR_DEGREE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree.
Definition var.hpp:384
void cumulatives(Home home, const IntVarArgs &m, const IntVarArgs &s, const IntVarArgs &p, const IntVarArgs &e, const IntVarArgs &u, const IntArgs &c, bool at_most, IntPropLevel ipl=IPL_DEF)
Post propagators for the cumulatives constraint.
void inter_distance(Home home, const IntVarArgs &x, int p, IntPropLevel ipl=IPL_DEF)
Post bounds-consistent propagator for for all .
BoolAssign BOOL_ASSIGN_RND(Rnd r)
Select random value.
Definition assign.hpp:110
std::function< void(const Space &home, const Brancher &b, unsigned int a, IntVar x, int i, const int &n, std::ostream &o)> IntVarValPrint
Function type for printing branching alternatives for integer variables.
Definition int.hh:5667
IntValBranch INT_VAL_SPLIT_MAX(void)
Select values greater than mean of smallest and largest value.
Definition val.hpp:80
IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=nullptr)
Select variable with smallest max.
Definition var.hpp:196
void minimum_distance(Home home, const IntVarArgs &x, IntVar z, const IntDistance &d, IntPropLevel ipl=IPL_DEF, MinDistancePropKind kind=MDP_SINGLE)
Post .
IntValBranch INT_VAL_MIN(void)
Select smallest value.
Definition val.hpp:55
SymmetryHandle VariableSymmetry(const IntVarArgs &x)
Variables in x are interchangeable.
Definition ldsb.cpp:62
IntAssign INT_ASSIGN_MED(void)
Select greatest value not greater than the median.
Definition assign.hpp:60
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
Definition relax.cpp:57
BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest accumulated failure count with decay factor d.
Definition var.hpp:394
BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count with decay factor d.
Definition var.hpp:404
BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c=nullptr)
Select value as defined by the value function v and commit function c.
Definition assign.hpp:115
BoolVarBranch BOOL_VAR_CHB_MAX(BoolCHB c, BranchTbl tbl=nullptr)
Select variable with largest CHB Q-score.
Definition var.hpp:444
IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=nullptr)
Select variable with largest max.
Definition var.hpp:201
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
Definition exec.cpp:39
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
Definition assign.hpp:55
IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with lowest action with decay factor d.
Definition var.hpp:146
IntVarBranch INT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking).
Definition var.hpp:101
IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest accumulated failure count divided by domain size with decay factor d.
Definition var.hpp:226
void unshare(Home home, IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Replace multiple variable occurrences in x by fresh variables.
Definition unshare.cpp:136
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree.
Definition var.hpp:116
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &x, int ss)
Variable sequences in x of size ss are interchangeable.
Definition ldsb.cpp:90
MinDistancePropKind
Organization of forward-bound minimum-distance propagation.
Definition int.hh:3395
@ MDP_SINGLE
One propagator with advisors and cached pair maxima.
Definition int.hh:3397
@ MDP_DECOMPOSED
One propagator per selected-position pair.
Definition int.hh:3396
BoolValBranch BOOL_VAL_RND(Rnd r)
Select random value.
Definition val.hpp:140
IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=nullptr)
Select variable with smallest max-regret.
Definition var.hpp:296
IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with least merit according to branch merit function bm.
Definition var.hpp:106
IntVarBranch INT_VAR_CHB_SIZE_MAX(IntCHB c, BranchTbl tbl=nullptr)
Select variable with largest CHB Q-score divided by domain size.
Definition var.hpp:276
void argmin(Home home, const IntVarArgs &x, IntVar y, bool tiebreak=true, IntPropLevel ipl=IPL_DEF)
Post propagator for .
void nvalues(Home home, const IntVarArgs &x, IntRelType irt, int y, IntPropLevel ipl=IPL_DEF)
Post propagator for .
Definition nvalues.cpp:40
IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree divided by domain size.
Definition var.hpp:221
void unary(Home home, const IntVarArgs &s, const IntArgs &p, IntPropLevel ipl=IPL_DEF)
Post propagators for scheduling tasks on unary resources.
Definition unary.cpp:44
void member(Home home, const IntVarArgs &x, IntVar y, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Definition member.cpp:39
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for .
IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with highest merit according to branch merit function bm.
Definition var.hpp:111
void circuit(Home home, const IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Post propagator such that x forms a circuit.
Definition circuit.cpp:73
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest domain size.
Definition var.hpp:206
BoolVarBranch BOOL_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree.
Definition var.hpp:389
std::function< void(const Space &home, const Brancher &b, unsigned int a, BoolVar x, int i, const int &n, std::ostream &o)> BoolVarValPrint
Function type for printing branching alternatives for Boolean variables.
Definition int.hh:5674
IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with smallest action divided by domain size with decay factor d.
Definition var.hpp:246
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for .
BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with highest action with decay factor d.
Definition var.hpp:424
BoolAssign BOOL_ASSIGN_MIN(void)
Select smallest value.
Definition assign.hpp:100
IntAssign INT_ASSIGN_MAX(void)
Select largest value.
Definition assign.hpp:65
IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=nullptr)
Select variable with largest min.
Definition var.hpp:191
BoolVarBranch BOOL_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with highest merit according to branch merit function bm.
Definition var.hpp:379
IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest degree divided by domain size.
Definition var.hpp:216
IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=nullptr)
Select variable with smallest min.
Definition var.hpp:186
IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=nullptr)
Select variable with largest domain size.
Definition var.hpp:211
IntValBranch INT_VAL_RND(Rnd r)
Select random value.
Definition val.hpp:70
void gcd(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
#define GECODE_VTABLE_EXPORT
Definition support.hh:76