Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.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.org>
5 * Guido Tack <tack@gecode.org>
6 *
7 * Contributing authors:
8 * Stefano Gualandi <stefano.gualandi@gmail.com>
9 * Mikael Lagerkvist <lagerkvist@gecode.org>
10 * David Rijsman <David.Rijsman@quintiq.com>
11 * Samuel Gagnon <samuel.gagnon92@gmail.com>
12 *
13 * Copyright:
14 * Stefano Gualandi, 2013
15 * Mikael Lagerkvist, 2006
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.org
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#include <iostream>
53#include <vector>
54#include <unordered_map>
55#include <functional>
56#include <utility>
57#include <initializer_list>
58
59#include <gecode/kernel.hh>
60#include <gecode/search.hh>
61#include <gecode/iter.hh>
62
63/*
64 * Configure linking
65 *
66 */
67#if !defined(GECODE_STATIC_LIBS) && \
68 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
69
70#ifdef GECODE_BUILD_INT
71#define GECODE_INT_EXPORT __declspec( dllexport )
72#else
73#define GECODE_INT_EXPORT __declspec( dllimport )
74#endif
75
76#else
77
78#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
79#define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
80#else
81#define GECODE_INT_EXPORT
82#endif
83
84#endif
85
86// Configure auto-linking
87#ifndef GECODE_BUILD_INT
88#define GECODE_LIBRARY_NAME "Int"
90#endif
91
102
104
105namespace Gecode { namespace Int {
106
114 namespace Limits {
116 const int max = INT_MAX - 1;
118 const int min = -max;
120 const int infinity = max + 1;
122 const long long int llmax = LLONG_MAX - 1;
124 const long long int llmin = -llmax;
126 const long long int llinfinity = llmax + 1;
128 bool valid(int n);
130 bool valid(long long int n);
132 void check(int n, const char* l);
134 void check(long long int n, const char* l);
136 void positive(int n, const char* l);
138 void positive(long long int n, const char* l);
140 void nonnegative(int n, const char* l);
142 void nonnegative(long long int n, const char* l);
144 bool overflow_add(int n, int m);
146 bool overflow_add(long long int n, long long int m);
148 bool overflow_sub(int n, int m);
150 bool overflow_sub(long long int n, long long int m);
152 bool overflow_mul(int n, int m);
154 bool overflow_mul(long long int n, long long int m);
155 }
156
157}}
158
159#include <gecode/int/limits.hpp>
160
161namespace Gecode {
162
163 class IntSetRanges;
164
165 template<class I> class IntSetInit;
166
174 class IntSet : public SharedHandle {
175 friend class IntSetRanges;
176 template<class I> friend class IntSetInit;
177 private:
179 class Range {
180 public:
181 int min, max;
182 };
183 class IntSetObject : public SharedHandle::Object {
184 public:
186 unsigned int size;
188 int n;
190 Range* r;
192 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
194 GECODE_INT_EXPORT bool in(int n) const;
196 GECODE_INT_EXPORT bool equal(const IntSetObject& so) const;
198 GECODE_INT_EXPORT virtual ~IntSetObject(void);
199 };
201 class MinInc;
203 GECODE_INT_EXPORT void normalize(Range* r, int n);
205 GECODE_INT_EXPORT void init(int n, int m);
207 GECODE_INT_EXPORT void init(const int r[], int n);
209 GECODE_INT_EXPORT void init(const int r[][2], int n);
210 public:
212
213
214 IntSet(void);
219 explicit IntSet(int n, int m);
221 explicit IntSet(const int r[], int n);
227 explicit IntSet(const int r[][2], int n);
229 template<class I>
230 explicit IntSet(I& i);
232 template<class I>
233 explicit IntSet(const I& i);
236 explicit IntSet(std::initializer_list<int> r);
243 explicit IntSet(std::initializer_list<std::pair<int,int>> r);
245
247
248
249 int ranges(void) const;
251 int min(int i) const;
253 int max(int i) const;
255 unsigned int width(int i) const;
257
259
260
261 bool in(int n) const;
263 unsigned int size(void) const;
265 unsigned int width(void) const;
267 int min(void) const;
269 int max(void) const;
271
273
274
275 bool operator ==(const IntSet& s) const;
277 bool operator !=(const IntSet& s) const;
279
281
282
285 };
286
293 private:
295 const IntSet::Range* i;
297 const IntSet::Range* e;
298 public:
300
301
302 IntSetRanges(void);
304 IntSetRanges(const IntSet& s);
306 void init(const IntSet& s);
308
310
311
312 bool operator ()(void) const;
314 void operator ++(void);
316
318
319
320 int min(void) const;
322 int max(void) const;
324 unsigned int width(void) const;
326 };
327
333 class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
334 public:
336
337
338 IntSetValues(void);
340 IntSetValues(const IntSet& s);
342 void init(const IntSet& s);
344 };
345
350 template<class Char, class Traits>
351 std::basic_ostream<Char,Traits>&
352 operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
353
354}
355
357
358#include <gecode/int/var-imp.hpp>
359
360namespace Gecode {
361
362 namespace Int {
363 class IntView;
364 }
365
371 class IntVar : public VarImpVar<Int::IntVarImp> {
372 friend class IntVarArray;
373 friend class IntVarArgs;
374 private:
382 void _init(Space& home, int min, int max);
389 void _init(Space& home, const IntSet& d);
390 public:
392
393
394 IntVar(void);
396 IntVar(const IntVar& y);
398 IntVar(const Int::IntView& y);
410 GECODE_INT_EXPORT IntVar(Space& home, int min, int max);
422 GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
424
426
427
428 int min(void) const;
430 int max(void) const;
432 int med(void) const;
440 int val(void) const;
441
443 unsigned int size(void) const;
445 unsigned int width(void) const;
447 unsigned int regret_min(void) const;
449 unsigned int regret_max(void) const;
451
453
454
455 bool range(void) const;
457 bool in(int n) const;
459
461 IntVar& operator =(const IntVar&) = default;
462 };
463
468 template<class Char, class Traits>
469 std::basic_ostream<Char,Traits>&
470 operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
471
477 public:
479
480
481 IntVarRanges(void);
483 IntVarRanges(const IntVar& x);
485 void init(const IntVar& x);
487 };
488
493 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
494 public:
496
497
498 IntVarValues(void);
500 IntVarValues(const IntVar& x);
502 void init(const IntVar& x);
504 };
505
506 namespace Int {
507 class BoolView;
508 }
509
515 class BoolVar : public VarImpVar<Int::BoolVarImp> {
516 friend class BoolVarArray;
517 friend class BoolVarArgs;
518 private:
526 void _init(Space& home, int min, int max);
527 public:
529
530
531 BoolVar(void);
533 BoolVar(const BoolVar& y);
535 BoolVar(const Int::BoolView& y);
547 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
549
551
552
553 int min(void) const;
555 int max(void) const;
557 int med(void) const;
565 int val(void) const;
566
568 unsigned int size(void) const;
570 unsigned int width(void) const;
572 unsigned int regret_min(void) const;
574 unsigned int regret_max(void) const;
576
578
579
580 bool range(void) const;
582 bool in(int n) const;
584
586
587
588 bool zero(void) const;
590 bool one(void) const;
592 bool none(void) const;
594
596 BoolVar& operator =(const BoolVar&) = default;
597 };
598
603 template<class Char, class Traits>
604 std::basic_ostream<Char,Traits>&
605 operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
606
607}
608
609
610#include <gecode/int/view.hpp>
612
613namespace Gecode {
614
622
624
626
627}
628
630
631namespace Gecode {
632
634 class IntArgs : public ArgArray<int> {
635 public:
637
638
639 IntArgs(void);
641 explicit IntArgs(int n);
643 IntArgs(const SharedArray<int>& x);
645 IntArgs(const std::vector<int>& x);
647 IntArgs(std::initializer_list<int> x);
649 template<class InputIterator>
650 IntArgs(InputIterator first, InputIterator last);
652 IntArgs(int n, const int* e);
654 IntArgs(const ArgArray<int>& a);
655
657 static IntArgs create(int n, int start, int inc=1);
659 };
660
662 class IntVarArgs : public VarArgArray<IntVar> {
663 public:
665
666
667 IntVarArgs(void);
669 explicit IntVarArgs(int n);
671 IntVarArgs(const IntVarArgs& a);
675 IntVarArgs(const std::vector<IntVar>& a);
677 IntVarArgs(std::initializer_list<IntVar> a);
679 template<class InputIterator>
680 IntVarArgs(InputIterator first, InputIterator last);
693 IntVarArgs(Space& home, int n, int min, int max);
706 IntVarArgs(Space& home, int n, const IntSet& s);
708
710 IntVarArgs& operator =(const IntVarArgs&) = default;
711 };
712
721 class BoolVarArgs : public VarArgArray<BoolVar> {
722 public:
724
725
726 BoolVarArgs(void);
728 explicit BoolVarArgs(int n);
730 BoolVarArgs(const BoolVarArgs& a);
734 BoolVarArgs(const std::vector<BoolVar>& a);
736 BoolVarArgs(std::initializer_list<BoolVar> a);
738 template<class InputIterator>
739 BoolVarArgs(InputIterator first, InputIterator last);
752 BoolVarArgs(Space& home, int n, int min, int max);
754 };
755
756
767
772 class IntVarArray : public VarArray<IntVar> {
773 public:
775
776
777 IntVarArray(void);
779 IntVarArray(Space& home, int n);
781 IntVarArray(const IntVarArray& a);
783 IntVarArray(Space& home, const IntVarArgs& a);
796 IntVarArray(Space& home, int n, int min, int max);
809 IntVarArray(Space& home, int n, const IntSet& s);
811
814 };
815
820 class BoolVarArray : public VarArray<BoolVar> {
821 public:
823
824
825 BoolVarArray(void);
827 BoolVarArray(Space& home, int n);
829 BoolVarArray(const BoolVarArray& a);
831 BoolVarArray(Space& home, const BoolVarArgs& a);
844 BoolVarArray(Space& home, int n, int min, int max);
846
849 };
850
851}
852
854
855#include <gecode/int/array.hpp>
856
857namespace Gecode {
858
886
891 class Reify {
892 protected:
897 public:
899 Reify(void);
903 BoolVar var(void) const;
905 ReifyMode mode(void) const;
907 void var(BoolVar x);
909 void mode(ReifyMode rm);
910 };
911
917
923
929
930}
931
932#include <gecode/int/reify.hpp>
933
934namespace Gecode {
935
948
951
954
955}
956
957#include <gecode/int/irt.hpp>
958
959namespace Gecode {
960
972
1001
1004
1007
1008}
1009
1010#include <gecode/int/ipl.hpp>
1011
1012namespace Gecode {
1013
1020 TT_FIXP, //< Task with fixed processing time
1021 TT_FIXS, //< Task with fixed start time
1022 TT_FIXE //< Task with fixed end time
1023 };
1024
1031
1033 template<>
1040
1041
1047
1049
1051 dom(Home home, IntVar x, int n,
1052 IntPropLevel ipl=IPL_DEF);
1055 dom(Home home, const IntVarArgs& x, int n,
1056 IntPropLevel ipl=IPL_DEF);
1057
1060 dom(Home home, IntVar x, int l, int m,
1061 IntPropLevel ipl=IPL_DEF);
1064 dom(Home home, const IntVarArgs& x, int l, int m,
1065 IntPropLevel ipl=IPL_DEF);
1066
1069 dom(Home home, IntVar x, const IntSet& s,
1070 IntPropLevel ipl=IPL_DEF);
1073 dom(Home home, const IntVarArgs& x, const IntSet& s,
1074 IntPropLevel ipl=IPL_DEF);
1075
1078 dom(Home home, IntVar x, int n, Reify r,
1079 IntPropLevel ipl=IPL_DEF);
1082 dom(Home home, IntVar x, int l, int m, Reify r,
1083 IntPropLevel ipl=IPL_DEF);
1086 dom(Home home, IntVar x, const IntSet& s, Reify r,
1087 IntPropLevel ipl=IPL_DEF);
1088
1091 dom(Home home, IntVar x, IntVar d,
1092 IntPropLevel ipl=IPL_DEF);
1095 dom(Home home, BoolVar x, BoolVar d,
1096 IntPropLevel ipl=IPL_DEF);
1099 dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
1100 IntPropLevel ipl=IPL_DEF);
1103 dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
1104 IntPropLevel ipl=IPL_DEF);
1106
1107
1119 rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
1120 IntPropLevel ipl=IPL_DEF);
1128 rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
1129 IntPropLevel ipl=IPL_DEF);
1134 rel(Home home, IntVar x, IntRelType irt, int c,
1135 IntPropLevel ipl=IPL_DEF);
1140 rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
1141 IntPropLevel ipl=IPL_DEF);
1149 rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
1150 IntPropLevel ipl=IPL_DEF);
1158 rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
1159 IntPropLevel ipl=IPL_DEF);
1175 rel(Home home, const IntVarArgs& x, IntRelType irt,
1176 IntPropLevel ipl=IPL_DEF);
1192 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
1193 IntPropLevel ipl=IPL_DEF);
1208 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
1209 IntPropLevel ipl=IPL_DEF);
1224 rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
1225 IntPropLevel ipl=IPL_DEF);
1226
1235 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
1236 IntPropLevel ipl=IPL_DEF);
1241 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
1242 IntPropLevel ipl=IPL_DEF);
1247 rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
1248 IntPropLevel ipl=IPL_DEF);
1257 rel(Home home, BoolVar x, IntRelType irt, int n,
1258 IntPropLevel ipl=IPL_DEF);
1267 rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
1268 IntPropLevel ipl=IPL_DEF);
1277 rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
1278 IntPropLevel ipl=IPL_DEF);
1292 rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
1293 IntPropLevel ipl=IPL_DEF);
1307 rel(Home home, const BoolVarArgs& x, IntRelType irt, const IntArgs& y,
1308 IntPropLevel ipl=IPL_DEF);
1322 rel(Home home, const IntArgs& x, IntRelType irt, const BoolVarArgs& y,
1323 IntPropLevel ipl=IPL_DEF);
1335 rel(Home home, const BoolVarArgs& x, IntRelType irt,
1336 IntPropLevel ipl=IPL_DEF);
1343 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
1344 IntPropLevel ipl=IPL_DEF);
1354 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
1355 IntPropLevel ipl=IPL_DEF);
1366 rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
1367 IntPropLevel ipl=IPL_DEF);
1381 rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
1382 IntPropLevel ipl=IPL_DEF);
1394 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
1410 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
1411 int n, IntPropLevel ipl=IPL_DEF);
1422 ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
1423 IntPropLevel ipl=IPL_DEF);
1431 ite(Home home, BoolVar b, BoolVar x, BoolVar y, BoolVar z,
1432 IntPropLevel ipl=IPL_DEF);
1433
1434
1447 precede(Home home, const IntVarArgs& x, int s, int t,
1457 precede(Home home, const IntVarArgs& x, const IntArgs& c,
1459
1460
1466
1468 member(Home home, const IntVarArgs& x, IntVar y,
1469 IntPropLevel ipl=IPL_DEF);
1472 member(Home home, const BoolVarArgs& x, BoolVar y,
1473 IntPropLevel ipl=IPL_DEF);
1476 member(Home home, const IntVarArgs& x, IntVar y, Reify r,
1477 IntPropLevel ipl=IPL_DEF);
1480 member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
1481 IntPropLevel ipl=IPL_DEF);
1483
1484
1489
1491
1499 element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
1500 IntPropLevel ipl=IPL_DEF);
1507 element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
1508 IntPropLevel ipl=IPL_DEF);
1515 element(Home home, IntSharedArray n, IntVar x0, int x1,
1516 IntPropLevel ipl=IPL_DEF);
1523 element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
1524 IntPropLevel ipl=IPL_DEF);
1531 element(Home home, const IntVarArgs& x, IntVar y0, int y1,
1532 IntPropLevel ipl=IPL_DEF);
1535 element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
1536 IntPropLevel ipl=IPL_DEF);
1539 element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
1540 IntPropLevel ipl=IPL_DEF);
1541
1555 element(Home home, IntSharedArray a,
1556 IntVar x, int w, IntVar y, int h, IntVar z,
1557 IntPropLevel ipl=IPL_DEF);
1571 element(Home home, IntSharedArray a,
1572 IntVar x, int w, IntVar y, int h, BoolVar z,
1573 IntPropLevel ipl=IPL_DEF);
1590 element(Home home, const IntVarArgs& a,
1591 IntVar x, int w, IntVar y, int h, IntVar z,
1592 IntPropLevel ipl=IPL_DEF);
1606 element(Home home, const BoolVarArgs& a,
1607 IntVar x, int w, IntVar y, int h, BoolVar z,
1608 IntPropLevel ipl=IPL_DEF);
1610
1611
1616
1618
1627 distinct(Home home, const IntVarArgs& x,
1628 IntPropLevel ipl=IPL_DEF);
1642 distinct(Home home, const IntArgs& n, const IntVarArgs& x,
1643 IntPropLevel ipl=IPL_DEF);
1659 distinct(Home home, const BoolVarArgs& b, const IntVarArgs& x,
1660 IntPropLevel ipl=IPL_DEF);
1674 distinct(Home home, const IntVarArgs& x, int c,
1675 IntPropLevel ipl=IPL_DEF);
1677
1678
1683
1685
1697 channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
1698 IntPropLevel ipl=IPL_DEF);
1699
1714 channel(Home home, const IntVarArgs& x, int xoff,
1715 const IntVarArgs& y, int yoff,
1716 IntPropLevel ipl=IPL_DEF);
1717
1720 channel(Home home, BoolVar x0, IntVar x1,
1721 IntPropLevel ipl=IPL_DEF);
1723 void
1724 channel(Home home, IntVar x0, BoolVar x1,
1725 IntPropLevel ipl=IPL_DEF);
1732 channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
1733 IntPropLevel ipl=IPL_DEF);
1735
1736}
1737
1738#include <gecode/int/channel.hpp>
1739
1740namespace Gecode {
1741
1750
1759 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
1760 IntPropLevel ipl=IPL_DEF);
1761
1774 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
1775 const IntVarArgs& z,
1776 IntPropLevel ipl=IPL_DEF);
1778
1779
1792
1794
1799 count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
1800 IntPropLevel ipl=IPL_DEF);
1806 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
1807 IntPropLevel ipl=IPL_DEF);
1816 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
1817 IntPropLevel ipl=IPL_DEF);
1826 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
1827 IntPropLevel ipl=IPL_DEF);
1833 count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
1834 IntPropLevel ipl=IPL_DEF);
1840 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
1841 IntPropLevel ipl=IPL_DEF);
1850 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
1851 IntPropLevel ipl=IPL_DEF);
1860 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
1861 IntPropLevel ipl=IPL_DEF);
1862
1877 count(Home home, const IntVarArgs& x, const IntVarArgs& c,
1878 IntPropLevel ipl=IPL_DEF);
1879
1894 count(Home home, const IntVarArgs& x, const IntSetArgs& c,
1895 IntPropLevel ipl=IPL_DEF);
1896
1914 count(Home home, const IntVarArgs& x,
1915 const IntVarArgs& c, const IntArgs& v,
1916 IntPropLevel ipl=IPL_DEF);
1917
1935 count(Home home, const IntVarArgs& x,
1936 const IntSetArgs& c, const IntArgs& v,
1937 IntPropLevel ipl=IPL_DEF);
1938
1956 count(Home home, const IntVarArgs& x,
1957 const IntSet& c, const IntArgs& v,
1958 IntPropLevel ipl=IPL_DEF);
1959
1961
1971
1973
1977 nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
1978 IntPropLevel ipl=IPL_DEF);
1983 nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
1984 IntPropLevel ipl=IPL_DEF);
1989 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
1990 IntPropLevel ipl=IPL_DEF);
1995 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
1996 IntPropLevel ipl=IPL_DEF);
1998
2003
2005
2020 sequence(Home home, const IntVarArgs& x, const IntSet& s,
2021 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2022
2038 sequence(Home home, const BoolVarArgs& x, const IntSet& s,
2039 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2040
2042
2054
2064 class DFA : public SharedHandle {
2065 private:
2067 class DFAI;
2070 bool equal(const DFA& d) const;
2071 public:
2074 public:
2079 Transition(void);
2081 Transition(int i_state0, int symbol0, int o_state0);
2082 };
2083
2085 private:
2087 const Transition* c_trans;
2089 const Transition* e_trans;
2090 public:
2092 Transitions(const DFA& d);
2094 Transitions(const DFA& d, int n);
2096 bool operator ()(void) const;
2098 void operator ++(void);
2100 int i_state(void) const;
2102 int symbol(void) const;
2104 int o_state(void) const;
2105 };
2106
2107 class Symbols {
2108 private:
2110 const Transition* c_trans;
2112 const Transition* e_trans;
2113 public:
2115 Symbols(const DFA& d);
2117 bool operator ()(void) const;
2119 void operator ++(void);
2121 int val(void) const;
2122 };
2123
2135 void init(int s, Transition t[], int f[], bool minimize=true);
2136 public:
2137 friend class Transitions;
2139 DFA(void);
2152 DFA(int s, Transition t[], int f[], bool minimize=true);
2163 DFA(int s, std::initializer_list<Transition> t,
2164 std::initializer_list<int> f, bool minimize=true);
2166 DFA(const DFA& d);
2169 bool operator ==(const DFA& d) const;
2171 bool operator !=(const DFA& d) const;
2173 int n_states(void) const;
2175 int n_transitions(void) const;
2177 unsigned int n_symbols(void) const;
2179 unsigned int max_degree(void) const;
2181 int final_fst(void) const;
2183 int final_lst(void) const;
2185 int symbol_min(void) const;
2187 int symbol_max(void) const;
2189 std::size_t hash(void) const;
2190 };
2191
2192}
2193
2195
2196namespace Gecode {
2197
2206 class TupleSet : public SharedHandle {
2207 public:
2212 typedef int* Tuple;
2216 class Range {
2217 public:
2219 int min;
2221 int max;
2225 unsigned int width(void) const;
2227 const BitSetData* supports(unsigned int n_words, int n) const;
2228 };
2229 protected:
2232 public:
2234 unsigned int n;
2238 unsigned int start(int n) const;
2239 };
2240
2245 protected:
2247 static const int n_initial_free = 1024;
2248 public:
2252 unsigned int n_words;
2258 int min;
2260 int max;
2262 std::size_t key;
2264 int* td;
2271
2273 Tuple add(void);
2275 Tuple get(int i) const;
2277 static void set(BitSetData* d, unsigned int n);
2279 static bool get(const BitSetData* d, unsigned int n);
2281 unsigned int tuple2idx(Tuple t) const;
2283 const Range* fst(int i) const;
2285 const Range* lst(int i) const;
2288 void finalize(void);
2291 void resize(void);
2293 bool finalized(void) const;
2295 Data(int a);
2298 virtual ~Data(void);
2299 };
2300
2302 Data& data(void) const;
2304 Data& raw(void) const;
2307 void _add(const IntArgs& t);
2310 bool equal(const TupleSet& t) const;
2311 public:
2313
2314
2315 TupleSet(void);
2318 TupleSet(int a);
2321 void init(int a);
2324 TupleSet(const TupleSet& t);
2327 TupleSet& operator =(const TupleSet& t);
2330 TupleSet(int a, const DFA& dfa);
2332 operator bool(void) const;
2334 bool operator ==(const TupleSet& t) const;
2336 bool operator !=(const TupleSet& t) const;
2338
2340
2341
2342 TupleSet& add(const IntArgs& t);
2344 bool finalized(void) const;
2346 void finalize(void);
2348
2350
2351
2352 int arity(void) const;
2354 int tuples(void) const;
2356 unsigned int words(void) const;
2358 Tuple operator [](int i) const;
2360 int min(void) const;
2362 int max(void) const;
2364 std::size_t hash(void) const;
2366
2368
2369
2370 const Range* fst(int i) const;
2372 const Range* lst(int i) const;
2374 class Ranges {
2375 protected:
2377 const Range* c;
2379 const Range* l;
2380 public:
2382
2383
2384 Ranges(const TupleSet& ts, int i);
2386
2388
2389
2390 bool operator ()(void) const;
2392 void operator ++(void);
2394
2396
2397
2398 int min(void) const;
2400 int max(void) const;
2402 unsigned int width(void) const;
2404 };
2405
2406 };
2407
2408}
2409
2411
2412namespace Gecode {
2413
2427 extensional(Home home, const IntVarArgs& x, DFA d,
2428 IntPropLevel ipl=IPL_DEF);
2429
2443 extensional(Home home, const BoolVarArgs& x, DFA d,
2444 IntPropLevel ipl=IPL_DEF);
2445
2456 void
2457 extensional(Home home, const IntVarArgs& x, const TupleSet& t,
2458 IntPropLevel ipl=IPL_DEF);
2459
2473 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
2474 IntPropLevel ipl=IPL_DEF);
2475
2486 void
2487 extensional(Home home, const IntVarArgs& x, const TupleSet& t, Reify r,
2488 IntPropLevel ipl=IPL_DEF);
2489
2503 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
2504 Reify r,
2505 IntPropLevel ipl=IPL_DEF);
2506
2517 void
2518 extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
2519 IntPropLevel ipl=IPL_DEF);
2520
2534 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
2535 IntPropLevel ipl=IPL_DEF);
2536
2547 void
2548 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, Reify r,
2549 IntPropLevel ipl=IPL_DEF);
2550
2564 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
2565 Reify r,
2566 IntPropLevel ipl=IPL_DEF);
2567
2568}
2569
2571
2572namespace Gecode {
2573
2578
2580
2586 min(Home home, IntVar x0, IntVar x1, IntVar x2,
2587 IntPropLevel ipl=IPL_DEF);
2596 min(Home home, const IntVarArgs& x, IntVar y,
2597 IntPropLevel ipl=IPL_DEF);
2604 max(Home home, IntVar x0, IntVar x1, IntVar x2,
2605 IntPropLevel ipl=IPL_DEF);
2614 max(Home home, const IntVarArgs& x, IntVar y,
2615 IntPropLevel ipl=IPL_DEF);
2616
2627 argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
2628 IntPropLevel ipl=IPL_DEF);
2639 argmin(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
2640 IntPropLevel ipl=IPL_DEF);
2651 argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
2652 IntPropLevel ipl=IPL_DEF);
2663 argmax(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
2664 IntPropLevel ipl=IPL_DEF);
2675 argmin(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
2676 IntPropLevel ipl=IPL_DEF);
2687 argmin(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
2688 IntPropLevel ipl=IPL_DEF);
2699 argmax(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
2700 IntPropLevel ipl=IPL_DEF);
2711 argmax(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
2712 IntPropLevel ipl=IPL_DEF);
2713
2720 abs(Home home, IntVar x0, IntVar x1,
2721 IntPropLevel ipl=IPL_DEF);
2722
2729 mult(Home home, IntVar x0, IntVar x1, IntVar x2,
2730 IntPropLevel ipl=IPL_DEF);
2731
2737 divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
2738 IntPropLevel ipl=IPL_DEF);
2739
2745 div(Home home, IntVar x0, IntVar x1, IntVar x2,
2746 IntPropLevel ipl=IPL_DEF);
2747
2753 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
2754 IntPropLevel ipl=IPL_DEF);
2755
2762 sqr(Home home, IntVar x0, IntVar x1,
2763 IntPropLevel ipl=IPL_DEF);
2764
2771 sqrt(Home home, IntVar x0, IntVar x1,
2772 IntPropLevel ipl=IPL_DEF);
2773
2783 pow(Home home, IntVar x0, int n, IntVar x1,
2784 IntPropLevel ipl=IPL_DEF);
2785
2795 nroot(Home home, IntVar x0, int n, IntVar x1,
2796 IntPropLevel ipl=IPL_DEF);
2797
2799
2836 linear(Home home, const IntVarArgs& x,
2837 IntRelType irt, int c,
2838 IntPropLevel ipl=IPL_DEF);
2843 linear(Home home, const IntVarArgs& x,
2844 IntRelType irt, IntVar y,
2845 IntPropLevel ipl=IPL_DEF);
2850 linear(Home home, const IntVarArgs& x,
2851 IntRelType irt, int c, Reify r,
2852 IntPropLevel ipl=IPL_DEF);
2857 linear(Home home, const IntVarArgs& x,
2858 IntRelType irt, IntVar y, Reify r,
2859 IntPropLevel ipl=IPL_DEF);
2867 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2868 IntRelType irt, int c,
2869 IntPropLevel ipl=IPL_DEF);
2877 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2878 IntRelType irt, IntVar y,
2879 IntPropLevel ipl=IPL_DEF);
2887 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2888 IntRelType irt, int c, Reify r,
2889 IntPropLevel ipl=IPL_DEF);
2897 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2898 IntRelType irt, IntVar y, Reify r,
2899 IntPropLevel ipl=IPL_DEF);
2900
2901
2930 linear(Home home, const BoolVarArgs& x,
2931 IntRelType irt, int c,
2932 IntPropLevel ipl=IPL_DEF);
2937 linear(Home home, const BoolVarArgs& x,
2938 IntRelType irt, int c, Reify r,
2939 IntPropLevel ipl=IPL_DEF);
2944 linear(Home home, const BoolVarArgs& x,
2945 IntRelType irt, IntVar y,
2946 IntPropLevel ipl=IPL_DEF);
2951 linear(Home home, const BoolVarArgs& x,
2952 IntRelType irt, IntVar y, Reify r,
2953 IntPropLevel ipl=IPL_DEF);
2961 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2962 IntRelType irt, int c,
2963 IntPropLevel ipl=IPL_DEF);
2971 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2972 IntRelType irt, int c, Reify r,
2973 IntPropLevel ipl=IPL_DEF);
2981 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2982 IntRelType irt, IntVar y,
2983 IntPropLevel ipl=IPL_DEF);
2991 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2992 IntRelType irt, IntVar y, Reify r,
2993 IntPropLevel ipl=IPL_DEF);
2994
2995
3023 binpacking(Home home,
3024 const IntVarArgs& l,
3025 const IntVarArgs& b, const IntArgs& s,
3026 IntPropLevel ipl=IPL_DEF);
3027 /* \brief Post propagator for multi-dimensional bin packing
3028 *
3029 * In the following \a n refers to the number of items and \a m
3030 * refers to the number of bins.
3031 *
3032 * The multi-dimensional bin-packing constraint enforces that
3033 * all items are packed into bins
3034 * \f$b_i\in\{0,\ldots,m-1\}\f$ for \f$0\leq i<n\f$
3035 * and that the load of each bin corresponds to the items
3036 * packed into it for each dimension \f$l_{j\cdot
3037 * d + k} = \sum_{\{i\in\{0,\ldots,n-1\}|
3038 * b_{j\cdot d+k}=i}\}s_{i\cdot d+k}\f$
3039 * for \f$0\leq j<m\f$, \f$0\leq k<d\f$
3040 * Furthermore, the load variables must satisfy the capacity
3041 * constraints \f$l_{j\cdot d + k} \leq
3042 * c_k\f$ for \f$0\leq j<m\f$, \f$0\leq k<d\f$.
3043 *
3044 * The constraint is implemented by the decomposition
3045 * introduced in: Stefano Gualandi and Michele Lombardi. A
3046 * simple and effective decomposition for the multidimensional
3047 * binpacking constraint. CP 2013, pages 356--364.
3048 *
3049 * Posting the constraint returns a maximal set containing conflicting
3050 * items that require pairwise different bins.
3051 *
3052 * Note that posting the constraint has exponential complexity in the
3053 * number of items due to the Bron-Kerbosch algorithm used for finding
3054 * the maximal conflict item sets.
3055 *
3056 * Throws the following exceptions:
3057 * - Of type Int::ArgumentSizeMismatch if any of the following properties
3058 * is violated: \f$|b|=n\f$, \f$|l|=m\cdot d\f$, \f$|s|=n\cdot d\f$,
3059 * and \f$|c|=d\f$.
3060 * - Of type Int::ArgumentSame if \a l and \a b share unassigned variables.
3061 * - Of type Int::OutOfLimits if \a s or \a c contains a negative number.
3062 *
3063 * \ingroup TaskModelIntBinPacking
3064 */
3066 binpacking(Home home, int d,
3067 const IntVarArgs& l, const IntVarArgs& b,
3068 const IntArgs& s, const IntArgs& c,
3069 IntPropLevel ipl=IPL_DEF);
3070
3071
3091 nooverlap(Home home,
3092 const IntVarArgs& x, const IntArgs& w,
3093 const IntVarArgs& y, const IntArgs& h,
3094 IntPropLevel ipl=IPL_DEF);
3109 nooverlap(Home home,
3110 const IntVarArgs& x, const IntArgs& w,
3111 const IntVarArgs& y, const IntArgs& h,
3112 const BoolVarArgs& o,
3113 IntPropLevel ipl=IPL_DEF);
3131 nooverlap(Home home,
3132 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
3133 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
3134 IntPropLevel ipl=IPL_DEF);
3153 nooverlap(Home home,
3154 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
3155 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
3156 const BoolVarArgs& o,
3157 IntPropLevel ipl=IPL_DEF);
3158
3159
3165
3177 order(Home home, IntVar s0, int p0, IntVar s1, int p1, BoolVar b,
3178 IntPropLevel ipl=IPL_DEF);
3179
3223 cumulatives(Home home, const IntVarArgs& m,
3224 const IntVarArgs& s, const IntVarArgs& p,
3225 const IntVarArgs& e, const IntVarArgs& u,
3226 const IntArgs& c, bool at_most,
3227 IntPropLevel ipl=IPL_DEF);
3233 cumulatives(Home home, const IntArgs& m,
3234 const IntVarArgs& s, const IntVarArgs& p,
3235 const IntVarArgs& e, const IntVarArgs& u,
3236 const IntArgs& c, bool at_most,
3237 IntPropLevel ipl=IPL_DEF);
3243 cumulatives(Home home, const IntVarArgs& m,
3244 const IntVarArgs& s, const IntArgs& p,
3245 const IntVarArgs& e, const IntVarArgs& u,
3246 const IntArgs& c, bool at_most,
3247 IntPropLevel ipl=IPL_DEF);
3253 cumulatives(Home home, const IntArgs& m,
3254 const IntVarArgs& s, const IntArgs& p,
3255 const IntVarArgs& e, const IntVarArgs& u,
3256 const IntArgs& c, bool at_most,
3257 IntPropLevel ipl=IPL_DEF);
3263 cumulatives(Home home, const IntVarArgs& m,
3264 const IntVarArgs& s, const IntVarArgs& p,
3265 const IntVarArgs& e, const IntArgs& u,
3266 const IntArgs& c, bool at_most,
3267 IntPropLevel ipl=IPL_DEF);
3273 cumulatives(Home home, const IntArgs& m,
3274 const IntVarArgs& s, const IntVarArgs& p,
3275 const IntVarArgs& e, const IntArgs& u,
3276 const IntArgs& c, bool at_most,
3277 IntPropLevel ipl=IPL_DEF);
3283 cumulatives(Home home, const IntVarArgs& m,
3284 const IntVarArgs& s, const IntArgs& p,
3285 const IntVarArgs& e, const IntArgs& u,
3286 const IntArgs& c, bool at_most,
3287 IntPropLevel ipl=IPL_DEF);
3293 cumulatives(Home home, const IntArgs& m,
3294 const IntVarArgs& s, const IntArgs& p,
3295 const IntVarArgs& e, const IntArgs& u,
3296 const IntArgs& c, bool at_most,
3297 IntPropLevel ipl=IPL_DEF);
3298
3326 unary(Home home, const IntVarArgs& s, const IntArgs& p,
3327 IntPropLevel ipl=IPL_DEF);
3328
3358 unary(Home home, const IntVarArgs& s, const IntArgs& p,
3359 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3360
3398 unary(Home home, const TaskTypeArgs& t,
3399 const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl=IPL_DEF);
3400
3440 unary(Home home, const TaskTypeArgs& t,
3441 const IntVarArgs& flex, const IntArgs& fix,
3442 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3443
3471 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
3472 const IntVarArgs& e, IntPropLevel ipl=IPL_DEF);
3473
3503 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
3504 const IntVarArgs& e, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3505
3506
3507
3551 cumulative(Home home, int c, const TaskTypeArgs& t,
3552 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3553 IntPropLevel ipl=IPL_DEF);
3554
3555
3561 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
3562 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3563 IntPropLevel ipl=IPL_DEF);
3564
3610 cumulative(Home home, int c, const TaskTypeArgs& t,
3611 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3612 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3613
3618 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
3619 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3620 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3621
3655 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
3656 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3657
3662 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
3663 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3664
3700 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
3701 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3702
3707 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
3708 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3709
3747 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
3748 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3749
3754 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
3755 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3756
3796 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
3797 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
3798 IntPropLevel ipl=IPL_DEF);
3799
3804 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
3805 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
3806 IntPropLevel ipl=IPL_DEF);
3808
3809
3815
3830 circuit(Home home, const IntVarArgs& x,
3831 IntPropLevel ipl=IPL_DEF);
3848 circuit(Home home, int offset, const IntVarArgs& x,
3849 IntPropLevel ipl=IPL_DEF);
3872 circuit(Home home,
3873 const IntArgs& c,
3874 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
3875 IntPropLevel ipl=IPL_DEF);
3899 circuit(Home home,
3900 const IntArgs& c, int offset,
3901 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
3902 IntPropLevel ipl=IPL_DEF);
3922 circuit(Home home,
3923 const IntArgs& c,
3924 const IntVarArgs& x, IntVar z,
3925 IntPropLevel ipl=IPL_DEF);
3947 circuit(Home home,
3948 const IntArgs& c, int offset,
3949 const IntVarArgs& x, IntVar z,
3950 IntPropLevel ipl=IPL_DEF);
3967 path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
3968 IntPropLevel ipl=IPL_DEF);
3987 path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
3988 IntPropLevel ipl=IPL_DEF);
4012 path(Home home,
4013 const IntArgs& c,
4014 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
4015 IntPropLevel ipl=IPL_DEF);
4041 path(Home home,
4042 const IntArgs& c, int offset,
4043 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
4044 IntPropLevel ipl=IPL_DEF);
4066 path(Home home,
4067 const IntArgs& c,
4068 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
4069 IntPropLevel ipl=IPL_DEF);
4093 path(Home home,
4094 const IntArgs& c, int offset,
4095 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
4096 IntPropLevel ipl=IPL_DEF);
4098
4099
4100
4109
4111 wait(Home home, IntVar x, std::function<void(Space& home)> c,
4112 IntPropLevel ipl=IPL_DEF);
4115 wait(Home home, BoolVar x, std::function<void(Space& home)> c,
4116 IntPropLevel ipl=IPL_DEF);
4119 wait(Home home, const IntVarArgs& x, std::function<void(Space& home)> c,
4120 IntPropLevel ipl=IPL_DEF);
4123 wait(Home home, const BoolVarArgs& x,
4124 std::function<void(Space& home)> c,
4125 IntPropLevel ipl=IPL_DEF);
4128 when(Home home, BoolVar x,
4129 std::function<void(Space& home)> t,
4130 std::function<void(Space& home)> e,
4131 IntPropLevel ipl=IPL_DEF);
4134 when(Home home, BoolVar x,
4135 std::function<void(Space& home)> t,
4136 IntPropLevel ipl=IPL_DEF);
4138
4139
4157
4165 unshare(Home home, IntVarArgs& x,
4166 IntPropLevel ipl=IPL_DEF);
4169 unshare(Home home, BoolVarArgs& x,
4170 IntPropLevel ipl=IPL_DEF);
4172
4173}
4174
4175namespace Gecode {
4176
4181
4190 typedef std::function<bool(const Space& home, IntVar x, int i)>
4200 typedef std::function<bool(const Space& home, BoolVar x, int i)>
4202
4212 typedef std::function<double(const Space& home, IntVar x, int i)>
4223 typedef std::function<double(const Space& home, BoolVar x, int i)>
4225
4236 typedef std::function<int(const Space& home, IntVar x, int i)>
4248 typedef std::function<int(const Space& home, BoolVar x, int i)>
4250
4262 typedef std::function<void(Space& home, unsigned int a,
4263 IntVar x, int i, int n)>
4276 typedef std::function<void(Space& home, unsigned int a,
4277 BoolVar x, int i, int n)>
4279
4280}
4281
4283
4284namespace Gecode {
4285
4291 class IntAFC : public AFC {
4292 public:
4300 IntAFC(void);
4302 IntAFC(const IntAFC& a);
4304 IntAFC& operator =(const IntAFC& a);
4312 IntAFC(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
4323 void init(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
4324 };
4325
4331 class BoolAFC : public AFC {
4332 public:
4340 BoolAFC(void);
4342 BoolAFC(const BoolAFC& a);
4344 BoolAFC& operator =(const BoolAFC& a);
4352 BoolAFC(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
4363 void init(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
4364 };
4365
4366}
4367
4369
4370namespace Gecode {
4371
4377 class IntAction : public Action {
4378 public:
4386 IntAction(void);
4388 IntAction(const IntAction& a);
4390 IntAction& operator =(const IntAction& a);
4399 IntAction(Home home, const IntVarArgs& x, double d=1.0,
4400 IntBranchMerit bm=nullptr);
4413 init(Home home, const IntVarArgs& x, double d=1.0,
4414 IntBranchMerit bm=nullptr);
4415 };
4416
4422 class BoolAction : public Action {
4423 public:
4431 BoolAction(void);
4433 BoolAction(const BoolAction& a);
4435 BoolAction& operator =(const BoolAction& a);
4444 BoolAction(Home home, const BoolVarArgs& x, double d=1.0,
4445 BoolBranchMerit bm=nullptr);
4458 init(Home home, const BoolVarArgs& x, double d=1.0,
4459 BoolBranchMerit bm=nullptr);
4460 };
4461
4462}
4463
4465
4466namespace Gecode {
4467
4473 class IntCHB : public CHB {
4474 public:
4482 IntCHB(void);
4484 IntCHB(const IntCHB& chb);
4486 IntCHB& operator =(const IntCHB& chb);
4496 IntCHB(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
4509 init(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
4510 };
4511
4517 class BoolCHB : public CHB {
4518 public:
4526 BoolCHB(void);
4528 BoolCHB(const BoolCHB& chb);
4530 BoolCHB& operator =(const BoolCHB& chb);
4540 BoolCHB(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
4553 init(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
4554 };
4555
4556}
4557
4559
4560namespace Gecode {
4561
4563 typedef std::function<void(const Space &home, const Brancher& b,
4564 unsigned int a,
4565 IntVar x, int i, const int& n,
4566 std::ostream& o)>
4568
4570 typedef std::function<void(const Space &home, const Brancher& b,
4571 unsigned int a,
4572 BoolVar x, int i, const int& n,
4573 std::ostream& o)>
4575
4576}
4577
4578namespace Gecode {
4579
4665
4713
4719
4732 IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
4736 IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
4740 IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
4744 IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
4772 IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
4776 IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
4780 IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
4784 IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
4819
4833 BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
4837 BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
4841 BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
4845 BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
4857
4858}
4859
4861
4862namespace Gecode {
4863
4898
4904 class BoolValBranch : public ValBranch<BoolVar> {
4905 public:
4913 protected:
4916 public:
4924 Select select(void) const;
4925 };
4926
4932
4959
4974
4975}
4976
4978
4979namespace Gecode {
4980
4986 class IntAssign : public ValBranch<IntVar> {
4987 public:
4996 protected:
4999 public:
5003 IntAssign(Rnd r);
5007 Select select(void) const;
5008 };
5009
5015 class BoolAssign : public ValBranch<BoolVar> {
5016 public:
5024 protected:
5027 public:
5031 BoolAssign(Rnd r);
5035 Select select(void) const;
5036 };
5037
5043
5058
5073
5074}
5075
5077
5078namespace Gecode {
5079
5086 branch(Home home, const IntVarArgs& x,
5087 IntVarBranch vars, IntValBranch vals,
5088 IntBranchFilter bf=nullptr,
5089 IntVarValPrint vvp=nullptr);
5096 branch(Home home, const IntVarArgs& x,
5097 TieBreak<IntVarBranch> vars, IntValBranch vals,
5098 IntBranchFilter bf=nullptr,
5099 IntVarValPrint vvp=nullptr);
5106 branch(Home home, IntVar x, IntValBranch vals,
5107 IntVarValPrint vvp=nullptr);
5114 branch(Home home, const BoolVarArgs& x,
5115 BoolVarBranch vars, BoolValBranch vals,
5116 BoolBranchFilter bf=nullptr,
5117 BoolVarValPrint vvp=nullptr);
5124 branch(Home home, const BoolVarArgs& x,
5125 TieBreak<BoolVarBranch> vars, BoolValBranch vals,
5126 BoolBranchFilter bf=nullptr,
5127 BoolVarValPrint vvp=nullptr);
5134 branch(Home home, BoolVar x, BoolValBranch vals,
5135 BoolVarValPrint vvp=nullptr);
5136
5143 assign(Home home, const IntVarArgs& x,
5144 IntVarBranch vars, IntAssign vals,
5145 IntBranchFilter bf=nullptr,
5146 IntVarValPrint vvp=nullptr);
5153 assign(Home home, const IntVarArgs& x,
5155 IntBranchFilter bf=nullptr,
5156 IntVarValPrint vvp=nullptr);
5163 assign(Home home, IntVar x, IntAssign vals,
5164 IntVarValPrint vvp=nullptr);
5171 assign(Home home, const BoolVarArgs& x,
5172 BoolVarBranch vars, BoolAssign vals,
5173 BoolBranchFilter bf=nullptr,
5174 BoolVarValPrint vvp=nullptr);
5181 assign(Home home, const BoolVarArgs& x,
5183 IntBranchFilter bf=nullptr,
5184 IntVarValPrint vvp=nullptr);
5191 assign(Home home, BoolVar x, BoolAssign vals,
5192 BoolVarValPrint vvp=nullptr);
5193
5194}
5195
5196namespace Gecode {
5197
5203 void
5204 branch(Home home, const IntVarArgs& x, IntValBranch vals,
5205 IntBranchFilter bf=nullptr,
5206 IntVarValPrint vvp=nullptr);
5212 void
5213 branch(Home home, const BoolVarArgs& x, BoolValBranch vals,
5214 BoolBranchFilter bf=nullptr,
5215 BoolVarValPrint vvp=nullptr);
5216
5222 void
5223 assign(Home home, const IntVarArgs& x, IntAssign vals,
5224 IntBranchFilter bf=nullptr,
5225 IntVarValPrint vvp=nullptr);
5231 void
5232 assign(Home home, const BoolVarArgs& x, BoolAssign vals,
5233 BoolBranchFilter bf=nullptr,
5234 BoolVarValPrint vvp=nullptr);
5235
5236}
5237
5238#include <gecode/int/branch.hpp>
5239
5240namespace Gecode {
5241
5245 template<class Char, class Traits>
5246 std::basic_ostream<Char,Traits>&
5247 operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
5248
5252 template<class Char, class Traits>
5253 std::basic_ostream<Char,Traits>&
5254 operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
5255
5256}
5257
5258// LDSB-related declarations.
5259namespace Gecode {
5260
5261 namespace Int { namespace LDSB {
5262 class SymmetryObject;
5263 }}
5264
5271 public:
5275 void increment(void);
5277 void decrement(void);
5278 public:
5280 SymmetryHandle(void);
5286 const SymmetryHandle& operator=(const SymmetryHandle& h);
5288 ~SymmetryHandle(void);
5289 };
5290 class Symmetries;
5292 template<>
5299
5306
5307 class Symmetries : public ArgArray<SymmetryHandle> {};
5308 // If this is instead a typedef, strange things happen with the
5309 // overloading of the "branch" function.
5310
5317 const IntArgs& indices);
5345
5347 GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
5351
5364 branch(Home home, const IntVarArgs& x,
5365 IntVarBranch vars, IntValBranch vals,
5366 const Symmetries& syms,
5367 IntBranchFilter bf=nullptr,
5368 IntVarValPrint vvp=nullptr);
5381 branch(Home home, const IntVarArgs& x,
5383 const Symmetries& syms,
5384 IntBranchFilter bf=nullptr,
5385 IntVarValPrint vvp=nullptr);
5398 branch(Home home, const BoolVarArgs& x,
5399 BoolVarBranch vars, BoolValBranch vals,
5400 const Symmetries& syms,
5401 BoolBranchFilter bf=nullptr,
5402 BoolVarValPrint vvp=nullptr);
5415 branch(Home home, const BoolVarArgs& x,
5417 const Symmetries& syms,
5418 BoolBranchFilter bf=nullptr,
5419 BoolVarValPrint vvp=nullptr);
5420
5421#ifdef GECODE_HAS_CBS
5422
5444 cbsbranch(Home home, const IntVarArgs& x);
5445
5446
5468 cbsbranch(Home home, const BoolVarArgs& x);
5469
5470#endif
5471
5472}
5473
5474namespace Gecode {
5475
5476 /*
5477 * \brief Relaxed assignment of variables in \a x from values in \a sx
5478 *
5479 * The variables in \a x are assigned values from the assigned variables
5480 * in the solution \a sx with a relaxation probability \a p. That is,
5481 * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
5482 * assigned a value from \a sx.
5483 *
5484 * The random numbers are generated from the generator \a r. At least
5485 * one variable will not be assigned: in case the relaxation attempt
5486 * would suggest that all variables should be assigned, a single
5487 * variable will be selected randomly to remain unassigned.
5488 *
5489 * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
5490 * \a sx are of different size.
5491 *
5492 * Throws an exception of type Int::OutOfLimits, if \a p is not between
5493 * \a 0.0 and \a 1.0.
5494 *
5495 * \ingroup TaskModelInt
5496 */
5498 relax(Home home, const IntVarArgs& x, const IntVarArgs& sx,
5499 Rnd r, double p);
5500
5501 /*
5502 * \brief Relaxed assignment of variables in \a x from values in \a sx
5503 *
5504 * The variables in \a x are assigned values from the assigned variables
5505 * in the solution \a sx with a relaxation probability \a p. That is,
5506 * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
5507 * assigned a value from \a sx.
5508 *
5509 * The random numbers are generated from the generator \a r. At least
5510 * one variable will not be assigned: in case the relaxation attempt
5511 * would suggest that all variables should be assigned, a single
5512 * variable will be selected randomly to remain unassigned.
5513 *
5514 * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
5515 * \a sx are of different size.
5516 *
5517 * Throws an exception of type Int::OutOfLimits, if \a p is not between
5518 * \a 0.0 and \a 1.0.
5519 *
5520 * \ingroup TaskModelInt
5521 */
5523 relax(Home home, const BoolVarArgs& x, const BoolVarArgs& sx,
5524 Rnd r, double p);
5525
5526}
5527
5528
5531
5532namespace Gecode {
5533
5538
5544 : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
5545 Int::ViewRanges<Int::IntView> > {
5546 protected:
5551 public:
5553
5554
5557 };
5558
5564 protected:
5567 public:
5569
5570
5573
5575
5576 bool operator ()(void) const;
5578 void operator ++(void);
5580
5582
5583
5584 int min(void) const;
5586 int max(void) const;
5588 unsigned int width(void) const;
5590 };
5591
5592}
5593
5596
5598
5599namespace Gecode {
5600
5611
5617 protected:
5619 std::ostream& os;
5620 public:
5622 StdIntTracer(std::ostream& os0 = std::cerr);
5624 virtual void init(const Space& home, const IntTraceRecorder& t);
5626 virtual void prune(const Space& home, const IntTraceRecorder& t,
5627 const ViewTraceInfo& vti, int i, IntTraceDelta& d);
5629 virtual void fix(const Space& home, const IntTraceRecorder& t);
5631 virtual void fail(const Space& home, const IntTraceRecorder& t);
5633 virtual void done(const Space& home, const IntTraceRecorder& t);
5636 };
5637
5638
5649
5655 protected:
5657 std::ostream& os;
5658 public:
5660 StdBoolTracer(std::ostream& os0 = std::cerr);
5662 virtual void init(const Space& home, const BoolTraceRecorder& t);
5664 virtual void prune(const Space& home, const BoolTraceRecorder& t,
5665 const ViewTraceInfo& vti, int i, BoolTraceDelta& d);
5667 virtual void fix(const Space& home, const BoolTraceRecorder& t);
5669 virtual void fail(const Space& home, const BoolTraceRecorder& t);
5671 virtual void done(const Space& home, const BoolTraceRecorder& t);
5674 };
5675
5681 trace(Home home, const IntVarArgs& x,
5682 TraceFilter tf,
5683 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5689 void
5690 trace(Home home, const IntVarArgs& x,
5691 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5693
5699 trace(Home home, const BoolVarArgs& x,
5700 TraceFilter tf,
5701 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5707 void
5708 trace(Home home, const BoolVarArgs& x,
5709 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5711
5712}
5713
5714#include <gecode/int/trace.hpp>
5715
5716#endif
5717
5718// IFDEF: GECODE_HAS_INT_VARS
5719// STATISTICS: int-post
5720
AFC(void)
Construct as not yet intialized.
Definition afc.hpp:119
Action(void)
Construct as not yet intialized.
Definition action.hpp:323
Argument array for non-primitive types.
Definition array.hpp:691
Traits of arrays in Gecode.
Definition array.hpp:94
Recording AFC information for Boolean variables.
Definition int.hh:4331
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:4422
BoolAction(void)
Construct as not yet initialized.
Definition action.hpp:50
void init(Home home, const BoolVarArgs &x, double d=1.0, BoolBranchMerit bm=nullptr)
Initialize for Boolean variables x with decay factor d.
Definition action.cpp:59
BoolAction & operator=(const BoolAction &a)
Assignment operator.
Definition action.hpp:57
Which values to select for assignment.
Definition int.hh:5015
Select
Which value selection.
Definition int.hh:5018
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:5022
@ SEL_MIN
Select smallest value.
Definition int.hh:5019
@ SEL_MAX
Select largest value.
Definition int.hh:5020
@ SEL_RND
Select random value.
Definition int.hh:5021
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:5026
Recording CHB for Boolean variables.
Definition int.hh:4517
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:5563
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:5566
Which values to select for branching first.
Definition int.hh:4904
Select s
Which value to select.
Definition int.hh:4915
Select
Which value selection.
Definition int.hh:4907
@ SEL_MIN
Select smallest value.
Definition int.hh:4908
@ SEL_RND
Select random value.
Definition int.hh:4910
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:4911
@ SEL_MAX
Select largest value.
Definition int.hh:4909
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:721
BoolVarArgs(void)
Allocate empty array.
Definition array.hpp:114
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:4671
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:4674
@ SEL_DEGREE_MIN
With smallest degree.
Definition int.hh:4679
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition int.hh:4682
@ SEL_CHB_MIN
With lowest CHB.
Definition int.hh:4685
@ SEL_MERIT_MIN
With least merit.
Definition int.hh:4677
@ SEL_ACTION_MIN
With lowest action.
Definition int.hh:4683
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition int.hh:4681
@ SEL_RND
Random (uniform, for tie breaking)
Definition int.hh:4676
@ SEL_NONE
First unassigned.
Definition int.hh:4675
@ SEL_ACTION_MAX
With highest action.
Definition int.hh:4684
@ SEL_CHB_MAX
With highest CHB.
Definition int.hh:4686
@ SEL_MERIT_MAX
With highest merit.
Definition int.hh:4678
@ SEL_DEGREE_MAX
With largest degree.
Definition int.hh:4680
Select s
Which variable to select.
Definition int.hh:4690
Boolean integer variables.
Definition int.hh:515
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:517
friend class BoolVarArray
Definition int.hh:516
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:1444
CHB(void)
Construct as not yet intialized.
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:2073
int i_state
input state
Definition int.hh:2075
int o_state
output state Default constructor
Definition int.hh:2077
Iterator for DFA transitions (sorted by symbols)
Definition int.hh:2084
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
Deterministic finite automaton (DFA)
Definition int.hh:2064
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:2137
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:152
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
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Home class for posting propagators
Definition core.hpp:856
Recording AFC information for integer variables.
Definition int.hh:4291
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:4377
void init(Home home, const IntVarArgs &x, double d=1.0, 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:634
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:4986
Select s
Which value to select.
Definition int.hh:4998
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:4989
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:4994
@ SEL_MIN
Select smallest value.
Definition int.hh:4990
@ SEL_MED
Select greatest value not greater than the median.
Definition int.hh:4991
@ SEL_RND
Select random value.
Definition int.hh:4993
@ SEL_MAX
Select largest value.
Definition int.hh:4992
Recording CHB for integer variables.
Definition int.hh:4473
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
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:174
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:175
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:43
static const IntSet empty
Empty set.
Definition int.hh:283
bool operator!=(const IntSet &s) const
Return whether s is not equal.
friend class IntSetInit
Definition int.hh:176
Trace delta information for integer variables.
Definition int.hh:5545
Int::ViewRanges< Int::IntView > rn
Iterator over the new values.
Definition int.hh:5548
Iter::Ranges::RangeList ro
Iterator over the old values.
Definition int.hh:5550
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:4869
Select
Which value selection.
Definition int.hh:4872
@ SEL_VALUES_MIN
Select all values starting from smallest.
Definition int.hh:4882
@ SEL_RND
Select random value.
Definition int.hh:4876
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition int.hh:4878
@ SEL_MIN
Select smallest value.
Definition int.hh:4873
@ SEL_MAX
Select largest value.
Definition int.hh:4875
@ SEL_RANGE_MAX
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Definition int.hh:4880
@ SEL_RANGE_MIN
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
Definition int.hh:4879
@ SEL_VALUES_MAX
Select all values starting from largest.
Definition int.hh:4883
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:4881
@ SEL_MED
Select greatest value not greater than the median.
Definition int.hh:4874
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition int.hh:4877
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:4887
Passing integer variables.
Definition int.hh:662
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:4585
void expand(Home home, const IntVarArgs &x)
Expand AFC, action, and CHB.
Definition var.hpp:74
Select
Which variable selection.
Definition int.hh:4588
@ SEL_MAX_MIN
With smallest max.
Definition int.hh:4603
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition int.hh:4600
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition int.hh:4610
@ SEL_MIN_MIN
With smallest min.
Definition int.hh:4601
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition int.hh:4612
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition int.hh:4609
@ SEL_REGRET_MIN_MIN
With smallest min-regret.
Definition int.hh:4620
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition int.hh:4607
@ SEL_MIN_MAX
With largest min.
Definition int.hh:4602
@ SEL_REGRET_MIN_MAX
With largest min-regret.
Definition int.hh:4626
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition int.hh:4614
@ SEL_MAX_MAX
With largest max.
Definition int.hh:4604
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition int.hh:4595
@ SEL_SIZE_MIN
With smallest domain size.
Definition int.hh:4605
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition int.hh:4596
@ SEL_MERIT_MAX
With highest merit.
Definition int.hh:4592
@ SEL_DEGREE_MAX
With largest degree.
Definition int.hh:4594
@ SEL_SIZE_MAX
With largest domain size.
Definition int.hh:4606
@ SEL_ACTION_MIN
With lowest action.
Definition int.hh:4597
@ SEL_ACTION_MAX
With highest action.
Definition int.hh:4598
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition int.hh:4599
@ SEL_RND
Random (uniform, for tie breaking)
Definition int.hh:4590
@ SEL_NONE
First unassigned.
Definition int.hh:4589
@ SEL_MERIT_MIN
With least merit.
Definition int.hh:4591
@ SEL_REGRET_MAX_MIN
With smallest max-regret.
Definition int.hh:4632
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition int.hh:4613
@ SEL_DEGREE_MIN
With smallest degree.
Definition int.hh:4593
@ SEL_REGRET_MAX_MAX
With largest max-regret.
Definition int.hh:4638
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition int.hh:4611
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition int.hh:4608
Select s
Which variable to select.
Definition int.hh:4642
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:371
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:373
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:372
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:1380
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
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.
Reification specification.
Definition int.hh:891
BoolVar x
The Boolean control variable.
Definition int.hh:894
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:896
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:1744
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:5657
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:5673
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:5619
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:5635
Date item for bitsets.
Collection of symmetries.
Definition int.hh:5307
A reference-counted pointer to a SymmetryObject.
Definition int.hh:5270
SymmetryHandle(void)
Default constructor.
Definition sym-obj.cpp:37
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Definition int.hh:5273
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
Data stored for a Table.
Definition int.hh:2244
int max
Largest value.
Definition int.hh:2260
int n_free
Number of free tuple entries of arity.
Definition int.hh:2256
void resize(void)
Resize tuple data.
BitSetData * support
Pointer to all support data.
Definition int.hh:2270
Data(int a)
Initialize as empty tuple set with arity a.
Definition tuple-set.hpp:61
unsigned int n_words
Number of words for support.
Definition int.hh:2252
int min
Smallest value.
Definition int.hh:2258
static void set(BitSetData *d, unsigned int n)
Set bit n in bitset data d.
void finalize(void)
Finalize datastructure (disallows additions of more Tuples)
int n_tuples
Number of Tuples.
Definition int.hh:2254
Tuple get(int i) const
Return tuple with number i.
Definition tuple-set.hpp:87
int * td
Tuple data.
Definition int.hh:2264
unsigned int tuple2idx(Tuple t) const
Map tuple address to index.
Range * range
Pointer to all ranges.
Definition int.hh:2268
const Range * lst(int i) const
Return last range for position i.
bool finalized(void) const
Is datastructure finalized.
Definition tuple-set.hpp:71
ValueData * vd
Value data.
Definition int.hh:2266
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:2247
std::size_t key
Hash key.
Definition int.hh:2262
Tuple add(void)
Return newly added tuple.
Definition tuple-set.hpp:76
Range information.
Definition int.hh:2216
BitSetData * s
Begin of supports.
Definition int.hh:2223
unsigned int width(void) const
Return the width.
Definition tuple-set.hpp:45
int max
Maximum value.
Definition int.hh:2221
int min
Minimum value.
Definition int.hh:2219
const BitSetData * supports(unsigned int n_words, int n) const
Return the 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:2379
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:2377
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Data about values in the table.
Definition int.hh:2231
unsigned int start(int n) const
Find start range for value n.
Definition tuple-set.hpp:93
unsigned int n
Number of ranges.
Definition int.hh:2234
Class represeting a set of tuples.
Definition int.hh:2206
TupleSet(void)
Construct an unitialized tuple set.
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 finalized.
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:2212
std::size_t hash(void) const
Return hash key.
void finalize(void)
Finalize tuple set.
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:2214
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
View trace information.
Definition core.hpp:910
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:81
int offset(void) const
Integer-precision integer scale view.
Definition view.hpp:642
GECODE_FLOAT_EXPORT 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:5610
ViewTraceRecorder< Int::BoolView > BoolTraceRecorder
Trace recorder for Boolean variables.
Definition int.hh:5648
ViewTracer< Int::IntView > IntTracer
Tracer for integer variables.
Definition int.hh:5605
ViewTracer< Int::BoolView > BoolTracer
Tracer for Boolean variables.
Definition int.hh:5643
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:4213
std::function< bool(const Space &home, IntVar x, int i)> IntBranchFilter
Branch filter function type for integer variables.
Definition int.hh:4191
std::function< bool(const Space &home, BoolVar x, int i)> BoolBranchFilter
Branch filter function type for Boolean variables.
Definition int.hh:4201
std::function< int(const Space &home, BoolVar x, int i)> BoolBranchVal
Branch value function type for Boolean variables.
Definition int.hh:4249
std::function< double(const Space &home, BoolVar x, int i)> BoolBranchMerit
Branch merit function type for Boolean variables.
Definition int.hh:4224
std::function< int(const Space &home, IntVar x, int i)> IntBranchVal
Branch value function type for integer variables.
Definition int.hh:4237
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:4278
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:4264
void extensional(Home home, const IntVarArgs &x, DFA d, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for extensional constraint described by a DFA.
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
Reify imp(BoolVar x)
Use implication for reification.
Definition reify.hpp:73
IntRelType
Relation types for integers.
Definition int.hh:940
Reify eqv(BoolVar x)
Use equivalence for reification.
Definition reify.hpp:69
TaskType
Type of task for scheduling constraints.
Definition int.hh:1019
ReifyMode
Mode for reification.
Definition int.hh:863
BoolOpType
Operation types for Booleans.
Definition int.hh:965
Reify pmi(BoolVar x)
Use reverse implication for reification.
Definition reify.hpp:77
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:989
ArgArray< TaskType > TaskTypeArgs
Argument arrays for passing task type arguments.
Definition int.hh:1030
@ IRT_EQ
Equality ( )
Definition int.hh:941
@ IRT_NQ
Disequality ( )
Definition int.hh:942
@ IRT_GQ
Greater or equal ( )
Definition int.hh:945
@ IRT_LE
Less ( )
Definition int.hh:944
@ IRT_GR
Greater ( )
Definition int.hh:946
@ IRT_LQ
Less or equal ( )
Definition int.hh:943
@ TT_FIXS
Definition int.hh:1021
@ TT_FIXE
Definition int.hh:1022
@ TT_FIXP
Definition int.hh:1020
@ RM_IMP
Implication for reification.
Definition int.hh:877
@ RM_PMI
Inverse implication for reification.
Definition int.hh:884
@ RM_EQV
Equivalence for reification (default)
Definition int.hh:870
@ BOT_OR
Disjunction.
Definition int.hh:967
@ BOT_EQV
Equivalence.
Definition int.hh:969
@ BOT_IMP
Implication.
Definition int.hh:968
@ BOT_XOR
Exclusive or.
Definition int.hh:970
@ BOT_AND
Conjunction.
Definition int.hh:966
@ IPL_BASIC
Use basic propagation algorithm.
Definition int.hh:996
@ IPL_BASIC_ADVANCED
Use both.
Definition int.hh:998
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Definition int.hh:994
@ _IPL_BITS
Number of bits required (internal)
Definition int.hh:999
@ IPL_VAL
Value propagation.
Definition int.hh:992
@ IPL_ADVANCED
Use advanced propagation algorithm.
Definition int.hh:997
@ IPL_DEF
Simple propagation levels.
Definition int.hh:991
@ IPL_BND
Bounds propagation.
Definition int.hh:993
@ 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
Symmetry breaking for integer variables.
Definition int.hh:5261
Numerical limits for integer variables.
Definition int.hh:114
const long long int llmin
Smallest allowed long long integer value.
Definition int.hh:124
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:122
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:120
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:118
bool valid(int n)
Return whether n is in range.
Definition limits.hpp:37
const int max
Largest allowed integer value.
Definition int.hh:116
const long long int llinfinity
Infinity for long long integers.
Definition int.hh:126
bool overflow_sub(int n, int m)
Check whether subtracting m from n would overflow.
Definition limits.hpp:93
Finite domain integers.
Gecode toplevel namespace
ArgArray< IntSet > IntSetArgs
Passing set arguments.
Definition int.hh:625
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
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition set.hh:773
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:1492
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 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
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition set.hh:773
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
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:773
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.
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:4567
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
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
GECODE_FLOAT_EXPORT 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 occurences 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
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 $n\geq 0$.
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:4574
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
Post propagator for SetVar x
Definition set.hh:773
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
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
#define GECODE_VTABLE_EXPORT
Definition support.hh:72