Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.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
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 };
460
465 template<class Char, class Traits>
466 std::basic_ostream<Char,Traits>&
467 operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
468
474 public:
476
477
478 IntVarRanges(void);
480 IntVarRanges(const IntVar& x);
482 void init(const IntVar& x);
484 };
485
490 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
491 public:
493
494
495 IntVarValues(void);
497 IntVarValues(const IntVar& x);
499 void init(const IntVar& x);
501 };
502
503 namespace Int {
504 class BoolView;
505 }
506
512 class BoolVar : public VarImpVar<Int::BoolVarImp> {
513 friend class BoolVarArray;
514 friend class BoolVarArgs;
515 private:
523 void _init(Space& home, int min, int max);
524 public:
526
527
528 BoolVar(void);
530 BoolVar(const BoolVar& y);
532 BoolVar(const Int::BoolView& y);
544 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
546
548
549
550 int min(void) const;
552 int max(void) const;
554 int med(void) const;
562 int val(void) const;
563
565 unsigned int size(void) const;
567 unsigned int width(void) const;
569 unsigned int regret_min(void) const;
571 unsigned int regret_max(void) const;
573
575
576
577 bool range(void) const;
579 bool in(int n) const;
581
583
584
585 bool zero(void) const;
587 bool one(void) const;
589 bool none(void) const;
591 };
592
597 template<class Char, class Traits>
598 std::basic_ostream<Char,Traits>&
599 operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
600
601}
602
603
604#include <gecode/int/view.hpp>
606
607namespace Gecode {
608
620
621}
622
624
625namespace Gecode {
626
628 class IntArgs : public ArgArray<int> {
629 public:
631
632
633 IntArgs(void);
635 explicit IntArgs(int n);
637 IntArgs(const SharedArray<int>& x);
639 IntArgs(const std::vector<int>& x);
641 IntArgs(std::initializer_list<int> x);
643 template<class InputIterator>
644 IntArgs(InputIterator first, InputIterator last);
646 IntArgs(int n, const int* e);
648 IntArgs(const ArgArray<int>& a);
649
651 static IntArgs create(int n, int start, int inc=1);
653 };
654
656 class IntVarArgs : public VarArgArray<IntVar> {
657 public:
659
660
661 IntVarArgs(void);
663 explicit IntVarArgs(int n);
665 IntVarArgs(const IntVarArgs& a);
669 IntVarArgs(const std::vector<IntVar>& a);
671 IntVarArgs(std::initializer_list<IntVar> a);
673 template<class InputIterator>
674 IntVarArgs(InputIterator first, InputIterator last);
687 IntVarArgs(Space& home, int n, int min, int max);
700 IntVarArgs(Space& home, int n, const IntSet& s);
702 };
703
712 class BoolVarArgs : public VarArgArray<BoolVar> {
713 public:
715
716
717 BoolVarArgs(void);
719 explicit BoolVarArgs(int n);
721 BoolVarArgs(const BoolVarArgs& a);
725 BoolVarArgs(const std::vector<BoolVar>& a);
727 BoolVarArgs(std::initializer_list<BoolVar> a);
729 template<class InputIterator>
730 BoolVarArgs(InputIterator first, InputIterator last);
743 BoolVarArgs(Space& home, int n, int min, int max);
745 };
747
763 class IntVarArray : public VarArray<IntVar> {
764 public:
766
767
768 IntVarArray(void);
770 IntVarArray(Space& home, int n);
772 IntVarArray(const IntVarArray& a);
774 IntVarArray(Space& home, const IntVarArgs& a);
787 IntVarArray(Space& home, int n, int min, int max);
800 IntVarArray(Space& home, int n, const IntSet& s);
802 };
803
808 class BoolVarArray : public VarArray<BoolVar> {
809 public:
811
812
813 BoolVarArray(void);
815 BoolVarArray(Space& home, int n);
819 BoolVarArray(Space& home, const BoolVarArgs& a);
832 BoolVarArray(Space& home, int n, int min, int max);
834 };
835
836}
837
839
840#include <gecode/int/array.hpp>
841
842namespace Gecode {
843
871
876 class Reify {
877 protected:
882 public:
884 Reify(void);
888 BoolVar var(void) const;
890 ReifyMode mode(void) const;
892 void var(BoolVar x);
894 void mode(ReifyMode rm);
895 };
896
902
908
914
915}
916
917#include <gecode/int/reify.hpp>
918
919namespace Gecode {
920
933
936
939
940}
941
942#include <gecode/int/irt.hpp>
943
944namespace Gecode {
945
957
986
989
992
993}
994
995#include <gecode/int/ipl.hpp>
996
997namespace Gecode {
998
1005 TT_FIXP, //< Task with fixed processing time
1006 TT_FIXS, //< Task with fixed start time
1007 TT_FIXE //< Task with fixed end time
1009
1016
1018 template<>
1025
1026
1036 dom(Home home, IntVar x, int n,
1037 IntPropLevel ipl=IPL_DEF);
1040 dom(Home home, const IntVarArgs& x, int n,
1041 IntPropLevel ipl=IPL_DEF);
1042
1045 dom(Home home, IntVar x, int l, int m,
1046 IntPropLevel ipl=IPL_DEF);
1049 dom(Home home, const IntVarArgs& x, int l, int m,
1050 IntPropLevel ipl=IPL_DEF);
1051
1054 dom(Home home, IntVar x, const IntSet& s,
1055 IntPropLevel ipl=IPL_DEF);
1058 dom(Home home, const IntVarArgs& x, const IntSet& s,
1059 IntPropLevel ipl=IPL_DEF);
1060
1063 dom(Home home, IntVar x, int n, Reify r,
1064 IntPropLevel ipl=IPL_DEF);
1067 dom(Home home, IntVar x, int l, int m, Reify r,
1068 IntPropLevel ipl=IPL_DEF);
1071 dom(Home home, IntVar x, const IntSet& s, Reify r,
1072 IntPropLevel ipl=IPL_DEF);
1073
1076 dom(Home home, IntVar x, IntVar d,
1077 IntPropLevel ipl=IPL_DEF);
1080 dom(Home home, BoolVar x, BoolVar d,
1081 IntPropLevel ipl=IPL_DEF);
1084 dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
1085 IntPropLevel ipl=IPL_DEF);
1088 dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
1089 IntPropLevel ipl=IPL_DEF);
1091
1092
1104 rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
1105 IntPropLevel ipl=IPL_DEF);
1113 rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
1114 IntPropLevel ipl=IPL_DEF);
1119 rel(Home home, IntVar x, IntRelType irt, int c,
1120 IntPropLevel ipl=IPL_DEF);
1125 rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
1126 IntPropLevel ipl=IPL_DEF);
1134 rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
1135 IntPropLevel ipl=IPL_DEF);
1143 rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
1144 IntPropLevel ipl=IPL_DEF);
1160 rel(Home home, const IntVarArgs& x, IntRelType irt,
1161 IntPropLevel ipl=IPL_DEF);
1177 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
1178 IntPropLevel ipl=IPL_DEF);
1193 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
1194 IntPropLevel ipl=IPL_DEF);
1209 rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
1210 IntPropLevel ipl=IPL_DEF);
1211
1220 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
1221 IntPropLevel ipl=IPL_DEF);
1226 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
1227 IntPropLevel ipl=IPL_DEF);
1232 rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
1233 IntPropLevel ipl=IPL_DEF);
1242 rel(Home home, BoolVar x, IntRelType irt, int n,
1243 IntPropLevel ipl=IPL_DEF);
1252 rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
1253 IntPropLevel ipl=IPL_DEF);
1262 rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
1263 IntPropLevel ipl=IPL_DEF);
1277 rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
1278 IntPropLevel ipl=IPL_DEF);
1292 rel(Home home, const BoolVarArgs& x, IntRelType irt, const IntArgs& y,
1293 IntPropLevel ipl=IPL_DEF);
1307 rel(Home home, const IntArgs& x, IntRelType irt, const BoolVarArgs& y,
1308 IntPropLevel ipl=IPL_DEF);
1320 rel(Home home, const BoolVarArgs& x, IntRelType irt,
1321 IntPropLevel ipl=IPL_DEF);
1328 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
1329 IntPropLevel ipl=IPL_DEF);
1339 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
1340 IntPropLevel ipl=IPL_DEF);
1351 rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
1352 IntPropLevel ipl=IPL_DEF);
1366 rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
1367 IntPropLevel ipl=IPL_DEF);
1379 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
1395 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
1396 int n, IntPropLevel ipl=IPL_DEF);
1407 ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
1408 IntPropLevel ipl=IPL_DEF);
1417 IntPropLevel ipl=IPL_DEF);
1418
1419
1432 precede(Home home, const IntVarArgs& x, int s, int t,
1442 precede(Home home, const IntVarArgs& x, const IntArgs& c,
1444
1445
1453 member(Home home, const IntVarArgs& x, IntVar y,
1454 IntPropLevel ipl=IPL_DEF);
1457 member(Home home, const BoolVarArgs& x, BoolVar y,
1458 IntPropLevel ipl=IPL_DEF);
1461 member(Home home, const IntVarArgs& x, IntVar y, Reify r,
1462 IntPropLevel ipl=IPL_DEF);
1465 member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
1466 IntPropLevel ipl=IPL_DEF);
1468
1469
1484 element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
1485 IntPropLevel ipl=IPL_DEF);
1492 element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
1493 IntPropLevel ipl=IPL_DEF);
1500 element(Home home, IntSharedArray n, IntVar x0, int x1,
1501 IntPropLevel ipl=IPL_DEF);
1508 element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
1509 IntPropLevel ipl=IPL_DEF);
1516 element(Home home, const IntVarArgs& x, IntVar y0, int y1,
1517 IntPropLevel ipl=IPL_DEF);
1520 element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
1521 IntPropLevel ipl=IPL_DEF);
1524 element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
1525 IntPropLevel ipl=IPL_DEF);
1526
1541 IntVar x, int w, IntVar y, int h, IntVar z,
1542 IntPropLevel ipl=IPL_DEF);
1557 IntVar x, int w, IntVar y, int h, BoolVar z,
1558 IntPropLevel ipl=IPL_DEF);
1575 element(Home home, const IntVarArgs& a,
1576 IntVar x, int w, IntVar y, int h, IntVar z,
1577 IntPropLevel ipl=IPL_DEF);
1591 element(Home home, const BoolVarArgs& a,
1592 IntVar x, int w, IntVar y, int h, BoolVar z,
1593 IntPropLevel ipl=IPL_DEF);
1595
1596
1612 distinct(Home home, const IntVarArgs& x,
1613 IntPropLevel ipl=IPL_DEF);
1627 distinct(Home home, const IntArgs& n, const IntVarArgs& x,
1628 IntPropLevel ipl=IPL_DEF);
1644 distinct(Home home, const BoolVarArgs& b, const IntVarArgs& x,
1645 IntPropLevel ipl=IPL_DEF);
1659 distinct(Home home, const IntVarArgs& x, int c,
1660 IntPropLevel ipl=IPL_DEF);
1662
1663
1682 channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
1683 IntPropLevel ipl=IPL_DEF);
1684
1699 channel(Home home, const IntVarArgs& x, int xoff,
1700 const IntVarArgs& y, int yoff,
1701 IntPropLevel ipl=IPL_DEF);
1702
1705 channel(Home home, BoolVar x0, IntVar x1,
1706 IntPropLevel ipl=IPL_DEF);
1708 void
1709 channel(Home home, IntVar x0, BoolVar x1,
1710 IntPropLevel ipl=IPL_DEF);
1717 channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
1718 IntPropLevel ipl=IPL_DEF);
1720
1721}
1722
1723#include <gecode/int/channel.hpp>
1724
1725namespace Gecode {
1726
1744 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
1745 IntPropLevel ipl=IPL_DEF);
1746
1759 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
1760 const IntVarArgs& z,
1761 IntPropLevel ipl=IPL_DEF);
1763
1764
1784 count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
1785 IntPropLevel ipl=IPL_DEF);
1791 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
1792 IntPropLevel ipl=IPL_DEF);
1801 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
1802 IntPropLevel ipl=IPL_DEF);
1811 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
1812 IntPropLevel ipl=IPL_DEF);
1818 count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
1819 IntPropLevel ipl=IPL_DEF);
1825 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
1826 IntPropLevel ipl=IPL_DEF);
1835 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
1836 IntPropLevel ipl=IPL_DEF);
1845 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
1846 IntPropLevel ipl=IPL_DEF);
1847
1862 count(Home home, const IntVarArgs& x, const IntVarArgs& c,
1863 IntPropLevel ipl=IPL_DEF);
1864
1879 count(Home home, const IntVarArgs& x, const IntSetArgs& c,
1880 IntPropLevel ipl=IPL_DEF);
1881
1899 count(Home home, const IntVarArgs& x,
1900 const IntVarArgs& c, const IntArgs& v,
1901 IntPropLevel ipl=IPL_DEF);
1902
1920 count(Home home, const IntVarArgs& x,
1921 const IntSetArgs& c, const IntArgs& v,
1922 IntPropLevel ipl=IPL_DEF);
1923
1941 count(Home home, const IntVarArgs& x,
1942 const IntSet& c, const IntArgs& v,
1943 IntPropLevel ipl=IPL_DEF);
1944
1946
1962 nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
1963 IntPropLevel ipl=IPL_DEF);
1968 nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
1969 IntPropLevel ipl=IPL_DEF);
1974 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
1975 IntPropLevel ipl=IPL_DEF);
1980 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
1981 IntPropLevel ipl=IPL_DEF);
1983
2005 sequence(Home home, const IntVarArgs& x, const IntSet& s,
2006 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2007
2023 sequence(Home home, const BoolVarArgs& x, const IntSet& s,
2024 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
2025
2027
2049 class DFA : public SharedHandle {
2050 private:
2052 class DFAI;
2055 bool equal(const DFA& d) const;
2056 public:
2059 public:
2064 Transition(void);
2066 Transition(int i_state0, int symbol0, int o_state0);
2067 };
2070 private:
2072 const Transition* c_trans;
2074 const Transition* e_trans;
2075 public:
2077 Transitions(const DFA& d);
2079 Transitions(const DFA& d, int n);
2081 bool operator ()(void) const;
2083 void operator ++(void);
2085 int i_state(void) const;
2087 int symbol(void) const;
2089 int o_state(void) const;
2090 };
2092 class Symbols {
2093 private:
2095 const Transition* c_trans;
2097 const Transition* e_trans;
2098 public:
2100 Symbols(const DFA& d);
2102 bool operator ()(void) const;
2104 void operator ++(void);
2106 int val(void) const;
2107 };
2120 void init(int s, Transition t[], int f[], bool minimize=true);
2121 public:
2122 friend class Transitions;
2124 DFA(void);
2137 DFA(int s, Transition t[], int f[], bool minimize=true);
2148 DFA(int s, std::initializer_list<Transition> t,
2149 std::initializer_list<int> f, bool minimize=true);
2151 DFA(const DFA& d);
2154 bool operator ==(const DFA& d) const;
2156 bool operator !=(const DFA& d) const;
2158 int n_states(void) const;
2160 int n_transitions(void) const;
2162 unsigned int n_symbols(void) const;
2164 unsigned int max_degree(void) const;
2166 int final_fst(void) const;
2168 int final_lst(void) const;
2170 int symbol_min(void) const;
2172 int symbol_max(void) const;
2174 std::size_t hash(void) const;
2175 };
2176
2177}
2178
2180
2181namespace Gecode {
2182
2191 class TupleSet : public SharedHandle {
2192 public:
2197 typedef int* Tuple;
2201 class Range {
2202 public:
2204 int min;
2206 int max;
2210 unsigned int width(void) const;
2212 const BitSetData* supports(unsigned int n_words, int n) const;
2213 };
2214 protected:
2217 public:
2219 unsigned int n;
2223 unsigned int start(int n) const;
2224 };
2230 protected:
2232 static const int n_initial_free = 1024;
2233 public:
2237 unsigned int n_words;
2243 int min;
2245 int max;
2247 std::size_t key;
2249 int* td;
2256
2258 Tuple add(void);
2260 Tuple get(int i) const;
2262 static void set(BitSetData* d, unsigned int n);
2264 static bool get(const BitSetData* d, unsigned int n);
2266 unsigned int tuple2idx(Tuple t) const;
2268 const Range* fst(int i) const;
2270 const Range* lst(int i) const;
2273 void finalize(void);
2276 void resize(void);
2278 bool finalized(void) const;
2280 Data(int a);
2283 virtual ~Data(void);
2284 };
2285
2287 Data& data(void) const;
2289 Data& raw(void) const;
2292 void _add(const IntArgs& t);
2295 bool equal(const TupleSet& t) const;
2296 public:
2298
2299
2300 TupleSet(void);
2303 TupleSet(int a);
2306 void init(int a);
2309 TupleSet(const TupleSet& t);
2312 TupleSet& operator =(const TupleSet& t);
2315 TupleSet(int a, const DFA& dfa);
2317 operator bool(void) const;
2319 bool operator ==(const TupleSet& t) const;
2321 bool operator !=(const TupleSet& t) const;
2323
2325
2326
2327 TupleSet& add(const IntArgs& t);
2329 bool finalized(void) const;
2331 void finalize(void);
2333
2335
2336
2337 int arity(void) const;
2339 int tuples(void) const;
2341 unsigned int words(void) const;
2343 Tuple operator [](int i) const;
2345 int min(void) const;
2347 int max(void) const;
2349 std::size_t hash(void) const;
2351
2353
2354
2355 const Range* fst(int i) const;
2357 const Range* lst(int i) const;
2359 class Ranges {
2360 protected:
2362 const Range* c;
2364 const Range* l;
2365 public:
2367
2368
2369 Ranges(const TupleSet& ts, int i);
2371
2373
2374
2375 bool operator ()(void) const;
2377 void operator ++(void);
2379
2381
2382
2383 int min(void) const;
2385 int max(void) const;
2387 unsigned int width(void) const;
2389 };
2391 };
2392
2393}
2394
2396
2397namespace Gecode {
2398
2412 extensional(Home home, const IntVarArgs& x, DFA d,
2413 IntPropLevel ipl=IPL_DEF);
2414
2428 extensional(Home home, const BoolVarArgs& x, DFA d,
2429 IntPropLevel ipl=IPL_DEF);
2430
2441 void
2442 extensional(Home home, const IntVarArgs& x, const TupleSet& t,
2443 IntPropLevel ipl=IPL_DEF);
2444
2458 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
2459 IntPropLevel ipl=IPL_DEF);
2460
2471 void
2472 extensional(Home home, const IntVarArgs& x, const TupleSet& t, Reify r,
2473 IntPropLevel ipl=IPL_DEF);
2474
2488 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
2489 Reify r,
2490 IntPropLevel ipl=IPL_DEF);
2491
2502 void
2503 extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
2504 IntPropLevel ipl=IPL_DEF);
2505
2519 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
2520 IntPropLevel ipl=IPL_DEF);
2521
2532 void
2533 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, Reify r,
2534 IntPropLevel ipl=IPL_DEF);
2535
2549 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
2550 Reify r,
2551 IntPropLevel ipl=IPL_DEF);
2552
2553}
2554
2556
2557namespace Gecode {
2558
2571 min(Home home, IntVar x0, IntVar x1, IntVar x2,
2572 IntPropLevel ipl=IPL_DEF);
2581 min(Home home, const IntVarArgs& x, IntVar y,
2582 IntPropLevel ipl=IPL_DEF);
2589 max(Home home, IntVar x0, IntVar x1, IntVar x2,
2590 IntPropLevel ipl=IPL_DEF);
2599 max(Home home, const IntVarArgs& x, IntVar y,
2600 IntPropLevel ipl=IPL_DEF);
2601
2612 argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
2613 IntPropLevel ipl=IPL_DEF);
2624 argmin(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
2625 IntPropLevel ipl=IPL_DEF);
2636 argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
2637 IntPropLevel ipl=IPL_DEF);
2648 argmax(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
2649 IntPropLevel ipl=IPL_DEF);
2660 argmin(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
2661 IntPropLevel ipl=IPL_DEF);
2672 argmin(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
2673 IntPropLevel ipl=IPL_DEF);
2684 argmax(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
2685 IntPropLevel ipl=IPL_DEF);
2696 argmax(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
2697 IntPropLevel ipl=IPL_DEF);
2698
2705 abs(Home home, IntVar x0, IntVar x1,
2706 IntPropLevel ipl=IPL_DEF);
2707
2714 mult(Home home, IntVar x0, IntVar x1, IntVar x2,
2715 IntPropLevel ipl=IPL_DEF);
2716
2722 divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
2723 IntPropLevel ipl=IPL_DEF);
2724
2730 div(Home home, IntVar x0, IntVar x1, IntVar x2,
2731 IntPropLevel ipl=IPL_DEF);
2732
2738 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
2739 IntPropLevel ipl=IPL_DEF);
2740
2747 sqr(Home home, IntVar x0, IntVar x1,
2748 IntPropLevel ipl=IPL_DEF);
2749
2756 sqrt(Home home, IntVar x0, IntVar x1,
2757 IntPropLevel ipl=IPL_DEF);
2758
2768 pow(Home home, IntVar x0, int n, IntVar x1,
2769 IntPropLevel ipl=IPL_DEF);
2770
2780 nroot(Home home, IntVar x0, int n, IntVar x1,
2781 IntPropLevel ipl=IPL_DEF);
2782
2784
2821 linear(Home home, const IntVarArgs& x,
2822 IntRelType irt, int c,
2823 IntPropLevel ipl=IPL_DEF);
2828 linear(Home home, const IntVarArgs& x,
2829 IntRelType irt, IntVar y,
2830 IntPropLevel ipl=IPL_DEF);
2835 linear(Home home, const IntVarArgs& x,
2836 IntRelType irt, int c, Reify r,
2837 IntPropLevel ipl=IPL_DEF);
2842 linear(Home home, const IntVarArgs& x,
2843 IntRelType irt, IntVar y, Reify r,
2844 IntPropLevel ipl=IPL_DEF);
2852 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2853 IntRelType irt, int c,
2854 IntPropLevel ipl=IPL_DEF);
2862 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2863 IntRelType irt, IntVar y,
2864 IntPropLevel ipl=IPL_DEF);
2872 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2873 IntRelType irt, int c, Reify r,
2874 IntPropLevel ipl=IPL_DEF);
2882 linear(Home home, const IntArgs& a, const IntVarArgs& x,
2883 IntRelType irt, IntVar y, Reify r,
2884 IntPropLevel ipl=IPL_DEF);
2885
2886
2915 linear(Home home, const BoolVarArgs& x,
2916 IntRelType irt, int c,
2917 IntPropLevel ipl=IPL_DEF);
2922 linear(Home home, const BoolVarArgs& x,
2923 IntRelType irt, int c, Reify r,
2924 IntPropLevel ipl=IPL_DEF);
2929 linear(Home home, const BoolVarArgs& x,
2930 IntRelType irt, IntVar y,
2931 IntPropLevel ipl=IPL_DEF);
2936 linear(Home home, const BoolVarArgs& x,
2937 IntRelType irt, IntVar y, Reify r,
2938 IntPropLevel ipl=IPL_DEF);
2946 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2947 IntRelType irt, int c,
2948 IntPropLevel ipl=IPL_DEF);
2956 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2957 IntRelType irt, int c, Reify r,
2958 IntPropLevel ipl=IPL_DEF);
2966 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2967 IntRelType irt, IntVar y,
2968 IntPropLevel ipl=IPL_DEF);
2976 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
2977 IntRelType irt, IntVar y, Reify r,
2978 IntPropLevel ipl=IPL_DEF);
2979
2980
3008 binpacking(Home home,
3009 const IntVarArgs& l,
3010 const IntVarArgs& b, const IntArgs& s,
3011 IntPropLevel ipl=IPL_DEF);
3012 /* \brief Post propagator for multi-dimensional bin packing
3013 *
3014 * In the following \a n refers to the number of items and \a m
3015 * refers to the number of bins.
3016 *
3017 * The multi-dimensional bin-packing constraint enforces that
3018 * all items are packed into bins
3019 * \f$b_i\in\{0,\ldots,m-1\}\f$ for \f$0\leq i<n\f$
3020 * and that the load of each bin corresponds to the items
3021 * packed into it for each dimension \f$l_{j\cdot
3022 * d + k} = \sum_{\{i\in\{0,\ldots,n-1\}|
3023 * b_{j\cdot d+k}=i}\}s_{i\cdot d+k}\f$
3024 * for \f$0\leq j<m\f$, \f$0\leq k<d\f$
3025 * Furthermore, the load variables must satisfy the capacity
3026 * constraints \f$l_{j\cdot d + k} \leq
3027 * c_k\f$ for \f$0\leq j<m\f$, \f$0\leq k<d\f$.
3028 *
3029 * The constraint is implemented by the decomposition
3030 * introduced in: Stefano Gualandi and Michele Lombardi. A
3031 * simple and effective decomposition for the multidimensional
3032 * binpacking constraint. CP 2013, pages 356--364.
3033 *
3034 * Posting the constraint returns a maximal set containing conflicting
3035 * items that require pairwise different bins.
3036 *
3037 * Note that posting the constraint has exponential complexity in the
3038 * number of items due to the Bron-Kerbosch algorithm used for finding
3039 * the maximal conflict item sets.
3040 *
3041 * Throws the following exceptions:
3042 * - Of type Int::ArgumentSizeMismatch if any of the following properties
3043 * is violated: \f$|b|=n\f$, \f$|l|=m\cdot d\f$, \f$|s|=n\cdot d\f$,
3044 * and \f$|c|=d\f$.
3045 * - Of type Int::ArgumentSame if \a l and \a b share unassigned variables.
3046 * - Of type Int::OutOfLimits if \a s or \a c contains a negative number.
3047 *
3048 * \ingroup TaskModelIntBinPacking
3049 */
3050 GECODE_INT_EXPORT IntSet
3051 binpacking(Home home, int d,
3052 const IntVarArgs& l, const IntVarArgs& b,
3053 const IntArgs& s, const IntArgs& c,
3054 IntPropLevel ipl=IPL_DEF);
3055
3056
3076 nooverlap(Home home,
3077 const IntVarArgs& x, const IntArgs& w,
3078 const IntVarArgs& y, const IntArgs& h,
3079 IntPropLevel ipl=IPL_DEF);
3094 nooverlap(Home home,
3095 const IntVarArgs& x, const IntArgs& w,
3096 const IntVarArgs& y, const IntArgs& h,
3097 const BoolVarArgs& o,
3098 IntPropLevel ipl=IPL_DEF);
3116 nooverlap(Home home,
3117 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
3118 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
3119 IntPropLevel ipl=IPL_DEF);
3138 nooverlap(Home home,
3139 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
3140 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
3141 const BoolVarArgs& o,
3142 IntPropLevel ipl=IPL_DEF);
3143
3144
3150
3162 order(Home home, IntVar s0, int p0, IntVar s1, int p1, BoolVar b,
3163 IntPropLevel ipl=IPL_DEF);
3164
3208 cumulatives(Home home, const IntVarArgs& m,
3209 const IntVarArgs& s, const IntVarArgs& p,
3210 const IntVarArgs& e, const IntVarArgs& u,
3211 const IntArgs& c, bool at_most,
3212 IntPropLevel ipl=IPL_DEF);
3218 cumulatives(Home home, const IntArgs& m,
3219 const IntVarArgs& s, const IntVarArgs& p,
3220 const IntVarArgs& e, const IntVarArgs& u,
3221 const IntArgs& c, bool at_most,
3222 IntPropLevel ipl=IPL_DEF);
3228 cumulatives(Home home, const IntVarArgs& m,
3229 const IntVarArgs& s, const IntArgs& p,
3230 const IntVarArgs& e, const IntVarArgs& u,
3231 const IntArgs& c, bool at_most,
3232 IntPropLevel ipl=IPL_DEF);
3238 cumulatives(Home home, const IntArgs& m,
3239 const IntVarArgs& s, const IntArgs& p,
3240 const IntVarArgs& e, const IntVarArgs& u,
3241 const IntArgs& c, bool at_most,
3242 IntPropLevel ipl=IPL_DEF);
3248 cumulatives(Home home, const IntVarArgs& m,
3249 const IntVarArgs& s, const IntVarArgs& p,
3250 const IntVarArgs& e, const IntArgs& u,
3251 const IntArgs& c, bool at_most,
3252 IntPropLevel ipl=IPL_DEF);
3258 cumulatives(Home home, const IntArgs& m,
3259 const IntVarArgs& s, const IntVarArgs& p,
3260 const IntVarArgs& e, const IntArgs& u,
3261 const IntArgs& c, bool at_most,
3262 IntPropLevel ipl=IPL_DEF);
3268 cumulatives(Home home, const IntVarArgs& m,
3269 const IntVarArgs& s, const IntArgs& p,
3270 const IntVarArgs& e, const IntArgs& u,
3271 const IntArgs& c, bool at_most,
3272 IntPropLevel ipl=IPL_DEF);
3278 cumulatives(Home home, const IntArgs& m,
3279 const IntVarArgs& s, const IntArgs& p,
3280 const IntVarArgs& e, const IntArgs& u,
3281 const IntArgs& c, bool at_most,
3282 IntPropLevel ipl=IPL_DEF);
3283
3311 unary(Home home, const IntVarArgs& s, const IntArgs& p,
3312 IntPropLevel ipl=IPL_DEF);
3313
3343 unary(Home home, const IntVarArgs& s, const IntArgs& p,
3344 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3345
3383 unary(Home home, const TaskTypeArgs& t,
3384 const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl=IPL_DEF);
3385
3425 unary(Home home, const TaskTypeArgs& t,
3426 const IntVarArgs& flex, const IntArgs& fix,
3427 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3428
3456 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
3457 const IntVarArgs& e, IntPropLevel ipl=IPL_DEF);
3458
3488 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
3489 const IntVarArgs& e, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3490
3491
3492
3536 cumulative(Home home, int c, const TaskTypeArgs& t,
3537 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3538 IntPropLevel ipl=IPL_DEF);
3539
3540
3546 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
3547 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3548 IntPropLevel ipl=IPL_DEF);
3549
3595 cumulative(Home home, int c, const TaskTypeArgs& t,
3596 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3597 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3598
3603 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
3604 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
3605 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3606
3640 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
3641 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3642
3647 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
3648 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3649
3685 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
3686 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3687
3692 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
3693 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
3694
3732 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
3733 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3734
3739 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
3740 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
3741
3781 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
3782 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
3783 IntPropLevel ipl=IPL_DEF);
3784
3789 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
3790 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
3791 IntPropLevel ipl=IPL_DEF);
3793
3794
3815 circuit(Home home, const IntVarArgs& x,
3816 IntPropLevel ipl=IPL_DEF);
3833 circuit(Home home, int offset, const IntVarArgs& x,
3834 IntPropLevel ipl=IPL_DEF);
3857 circuit(Home home,
3858 const IntArgs& c,
3859 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
3860 IntPropLevel ipl=IPL_DEF);
3884 circuit(Home home,
3885 const IntArgs& c, int offset,
3886 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
3887 IntPropLevel ipl=IPL_DEF);
3907 circuit(Home home,
3908 const IntArgs& c,
3909 const IntVarArgs& x, IntVar z,
3910 IntPropLevel ipl=IPL_DEF);
3932 circuit(Home home,
3933 const IntArgs& c, int offset,
3934 const IntVarArgs& x, IntVar z,
3935 IntPropLevel ipl=IPL_DEF);
3952 path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
3953 IntPropLevel ipl=IPL_DEF);
3972 path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
3973 IntPropLevel ipl=IPL_DEF);
3997 path(Home home,
3998 const IntArgs& c,
3999 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
4000 IntPropLevel ipl=IPL_DEF);
4026 path(Home home,
4027 const IntArgs& c, int offset,
4028 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
4029 IntPropLevel ipl=IPL_DEF);
4051 path(Home home,
4052 const IntArgs& c,
4053 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
4054 IntPropLevel ipl=IPL_DEF);
4078 path(Home home,
4079 const IntArgs& c, int offset,
4080 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
4081 IntPropLevel ipl=IPL_DEF);
4083
4084
4085
4096 wait(Home home, IntVar x, std::function<void(Space& home)> c,
4097 IntPropLevel ipl=IPL_DEF);
4100 wait(Home home, BoolVar x, std::function<void(Space& home)> c,
4101 IntPropLevel ipl=IPL_DEF);
4104 wait(Home home, const IntVarArgs& x, std::function<void(Space& home)> c,
4105 IntPropLevel ipl=IPL_DEF);
4108 wait(Home home, const BoolVarArgs& x,
4109 std::function<void(Space& home)> c,
4110 IntPropLevel ipl=IPL_DEF);
4113 when(Home home, BoolVar x,
4114 std::function<void(Space& home)> t,
4115 std::function<void(Space& home)> e,
4116 IntPropLevel ipl=IPL_DEF);
4119 when(Home home, BoolVar x,
4120 std::function<void(Space& home)> t,
4121 IntPropLevel ipl=IPL_DEF);
4123
4124
4150 unshare(Home home, IntVarArgs& x,
4151 IntPropLevel ipl=IPL_DEF);
4154 unshare(Home home, BoolVarArgs& x,
4155 IntPropLevel ipl=IPL_DEF);
4157
4158}
4159
4160namespace Gecode {
4161
4175 typedef std::function<bool(const Space& home, IntVar x, int i)>
4185 typedef std::function<bool(const Space& home, BoolVar x, int i)>
4187
4197 typedef std::function<double(const Space& home, IntVar x, int i)>
4208 typedef std::function<double(const Space& home, BoolVar x, int i)>
4210
4221 typedef std::function<int(const Space& home, IntVar x, int i)>
4233 typedef std::function<int(const Space& home, BoolVar x, int i)>
4235
4247 typedef std::function<void(Space& home, unsigned int a,
4248 IntVar x, int i, int n)>
4261 typedef std::function<void(Space& home, unsigned int a,
4262 BoolVar x, int i, int n)>
4264
4265}
4266
4268
4269namespace Gecode {
4270
4276 class IntAFC : public AFC {
4277 public:
4285 IntAFC(void);
4287 IntAFC(const IntAFC& a);
4289 IntAFC& operator =(const IntAFC& a);
4297 IntAFC(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
4308 void init(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
4309 };
4310
4316 class BoolAFC : public AFC {
4317 public:
4325 BoolAFC(void);
4327 BoolAFC(const BoolAFC& a);
4329 BoolAFC& operator =(const BoolAFC& a);
4337 BoolAFC(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
4348 void init(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
4349 };
4350
4351}
4352
4354
4355namespace Gecode {
4356
4362 class IntAction : public Action {
4363 public:
4371 IntAction(void);
4373 IntAction(const IntAction& a);
4384 IntAction(Home home, const IntVarArgs& x, double d=1.0,
4385 IntBranchMerit bm=nullptr);
4398 init(Home home, const IntVarArgs& x, double d=1.0,
4399 IntBranchMerit bm=nullptr);
4400 };
4401
4407 class BoolAction : public Action {
4408 public:
4416 BoolAction(void);
4418 BoolAction(const BoolAction& a);
4429 BoolAction(Home home, const BoolVarArgs& x, double d=1.0,
4430 BoolBranchMerit bm=nullptr);
4443 init(Home home, const BoolVarArgs& x, double d=1.0,
4444 BoolBranchMerit bm=nullptr);
4445 };
4446
4447}
4448
4450
4451namespace Gecode {
4452
4458 class IntCHB : public CHB {
4459 public:
4467 IntCHB(void);
4469 IntCHB(const IntCHB& chb);
4471 IntCHB& operator =(const IntCHB& chb);
4481 IntCHB(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
4494 init(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
4495 };
4496
4502 class BoolCHB : public CHB {
4503 public:
4511 BoolCHB(void);
4513 BoolCHB(const BoolCHB& chb);
4515 BoolCHB& operator =(const BoolCHB& chb);
4525 BoolCHB(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
4538 init(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
4539 };
4540
4541}
4542
4544
4545namespace Gecode {
4546
4548 typedef std::function<void(const Space &home, const Brancher& b,
4549 unsigned int a,
4550 IntVar x, int i, const int& n,
4551 std::ostream& o)>
4553
4555 typedef std::function<void(const Space &home, const Brancher& b,
4556 unsigned int a,
4557 BoolVar x, int i, const int& n,
4558 std::ostream& o)>
4560
4561}
4562
4563namespace Gecode {
4564
4650
4698
4717 IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
4721 IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
4725 IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
4729 IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
4757 IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
4761 IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
4765 IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
4769 IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
4804
4818 BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
4822 BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
4826 BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
4830 BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
4842
4843}
4844
4846
4847namespace Gecode {
4848
4883
4889 class BoolValBranch : public ValBranch<BoolVar> {
4890 public:
4898 protected:
4901 public:
4909 Select select(void) const;
4910 };
4911
4944
4959
4960}
4961
4963
4964namespace Gecode {
4965
4971 class IntAssign : public ValBranch<IntVar> {
4972 public:
4981 protected:
4984 public:
4988 IntAssign(Rnd r);
4992 Select select(void) const;
4993 };
4994
5000 class BoolAssign : public ValBranch<BoolVar> {
5001 public:
5009 protected:
5012 public:
5016 BoolAssign(Rnd r);
5020 Select select(void) const;
5021 };
5022
5043
5058
5059}
5060
5062
5063namespace Gecode {
5064
5071 branch(Home home, const IntVarArgs& x,
5072 IntVarBranch vars, IntValBranch vals,
5073 IntBranchFilter bf=nullptr,
5074 IntVarValPrint vvp=nullptr);
5081 branch(Home home, const IntVarArgs& x,
5082 TieBreak<IntVarBranch> vars, IntValBranch vals,
5083 IntBranchFilter bf=nullptr,
5084 IntVarValPrint vvp=nullptr);
5091 branch(Home home, IntVar x, IntValBranch vals,
5092 IntVarValPrint vvp=nullptr);
5099 branch(Home home, const BoolVarArgs& x,
5100 BoolVarBranch vars, BoolValBranch vals,
5101 BoolBranchFilter bf=nullptr,
5102 BoolVarValPrint vvp=nullptr);
5109 branch(Home home, const BoolVarArgs& x,
5110 TieBreak<BoolVarBranch> vars, BoolValBranch vals,
5111 BoolBranchFilter bf=nullptr,
5112 BoolVarValPrint vvp=nullptr);
5119 branch(Home home, BoolVar x, BoolValBranch vals,
5120 BoolVarValPrint vvp=nullptr);
5121
5128 assign(Home home, const IntVarArgs& x,
5129 IntVarBranch vars, IntAssign vals,
5130 IntBranchFilter bf=nullptr,
5131 IntVarValPrint vvp=nullptr);
5138 assign(Home home, const IntVarArgs& x,
5140 IntBranchFilter bf=nullptr,
5141 IntVarValPrint vvp=nullptr);
5148 assign(Home home, IntVar x, IntAssign vals,
5149 IntVarValPrint vvp=nullptr);
5156 assign(Home home, const BoolVarArgs& x,
5157 BoolVarBranch vars, BoolAssign vals,
5158 BoolBranchFilter bf=nullptr,
5159 BoolVarValPrint vvp=nullptr);
5166 assign(Home home, const BoolVarArgs& x,
5168 IntBranchFilter bf=nullptr,
5169 IntVarValPrint vvp=nullptr);
5176 assign(Home home, BoolVar x, BoolAssign vals,
5177 BoolVarValPrint vvp=nullptr);
5178
5179}
5180
5181namespace Gecode {
5182
5188 void
5189 branch(Home home, const IntVarArgs& x, IntValBranch vals,
5190 IntBranchFilter bf=nullptr,
5191 IntVarValPrint vvp=nullptr);
5197 void
5198 branch(Home home, const BoolVarArgs& x, BoolValBranch vals,
5199 BoolBranchFilter bf=nullptr,
5200 BoolVarValPrint vvp=nullptr);
5201
5207 void
5208 assign(Home home, const IntVarArgs& x, IntAssign vals,
5209 IntBranchFilter bf=nullptr,
5210 IntVarValPrint vvp=nullptr);
5216 void
5217 assign(Home home, const BoolVarArgs& x, BoolAssign vals,
5218 BoolBranchFilter bf=nullptr,
5219 BoolVarValPrint vvp=nullptr);
5220
5221}
5222
5223#include <gecode/int/branch.hpp>
5224
5225namespace Gecode {
5226
5230 template<class Char, class Traits>
5231 std::basic_ostream<Char,Traits>&
5232 operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
5233
5237 template<class Char, class Traits>
5238 std::basic_ostream<Char,Traits>&
5239 operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
5240
5241}
5242
5243// LDSB-related declarations.
5244namespace Gecode {
5245
5246 namespace Int { namespace LDSB {
5247 class SymmetryObject;
5248 }}
5249
5256 public:
5260 void increment(void);
5262 void decrement(void);
5263 public:
5265 SymmetryHandle(void);
5271 const SymmetryHandle& operator=(const SymmetryHandle& h);
5273 ~SymmetryHandle(void);
5274 };
5275 class Symmetries;
5277 template<>
5284
5292 class Symmetries : public ArgArray<SymmetryHandle> {};
5293 // If this is instead a typedef, strange things happen with the
5294 // overloading of the "branch" function.
5295
5302 const IntArgs& indices);
5330
5332 GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
5336
5349 branch(Home home, const IntVarArgs& x,
5350 IntVarBranch vars, IntValBranch vals,
5351 const Symmetries& syms,
5352 IntBranchFilter bf=nullptr,
5353 IntVarValPrint vvp=nullptr);
5366 branch(Home home, const IntVarArgs& x,
5368 const Symmetries& syms,
5369 IntBranchFilter bf=nullptr,
5370 IntVarValPrint vvp=nullptr);
5383 branch(Home home, const BoolVarArgs& x,
5384 BoolVarBranch vars, BoolValBranch vals,
5385 const Symmetries& syms,
5386 BoolBranchFilter bf=nullptr,
5387 BoolVarValPrint vvp=nullptr);
5400 branch(Home home, const BoolVarArgs& x,
5402 const Symmetries& syms,
5403 BoolBranchFilter bf=nullptr,
5404 BoolVarValPrint vvp=nullptr);
5405
5406#ifdef GECODE_HAS_CBS
5407
5429 cbsbranch(Home home, const IntVarArgs& x);
5430
5431
5453 cbsbranch(Home home, const BoolVarArgs& x);
5454
5455#endif
5456
5457}
5458
5459namespace Gecode {
5460
5461 /*
5462 * \brief Relaxed assignment of variables in \a x from values in \a sx
5463 *
5464 * The variables in \a x are assigned values from the assigned variables
5465 * in the solution \a sx with a relaxation probability \a p. That is,
5466 * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
5467 * assigned a value from \a sx.
5468 *
5469 * The random numbers are generated from the generator \a r. At least
5470 * one variable will not be assigned: in case the relaxation attempt
5471 * would suggest that all variables should be assigned, a single
5472 * variable will be selected randomly to remain unassigned.
5473 *
5474 * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
5475 * \a sx are of different size.
5476 *
5477 * Throws an exception of type Int::OutOfLimits, if \a p is not between
5478 * \a 0.0 and \a 1.0.
5479 *
5480 * \ingroup TaskModelInt
5481 */
5483 relax(Home home, const IntVarArgs& x, const IntVarArgs& sx,
5484 Rnd r, double p);
5485
5486 /*
5487 * \brief Relaxed assignment of variables in \a x from values in \a sx
5488 *
5489 * The variables in \a x are assigned values from the assigned variables
5490 * in the solution \a sx with a relaxation probability \a p. That is,
5491 * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
5492 * assigned a value from \a sx.
5493 *
5494 * The random numbers are generated from the generator \a r. At least
5495 * one variable will not be assigned: in case the relaxation attempt
5496 * would suggest that all variables should be assigned, a single
5497 * variable will be selected randomly to remain unassigned.
5498 *
5499 * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
5500 * \a sx are of different size.
5501 *
5502 * Throws an exception of type Int::OutOfLimits, if \a p is not between
5503 * \a 0.0 and \a 1.0.
5504 *
5505 * \ingroup TaskModelInt
5506 */
5508 relax(Home home, const BoolVarArgs& x, const BoolVarArgs& sx,
5509 Rnd r, double p);
5510
5511}
5512
5513
5516
5517namespace Gecode {
5518
5529 : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
5530 Int::ViewRanges<Int::IntView> > {
5531 protected:
5536 public:
5538
5539
5542 };
5543
5549 protected:
5552 public:
5554
5555
5558
5560
5561 bool operator ()(void) const;
5563 void operator ++(void);
5565
5567
5568
5569 int min(void) const;
5571 int max(void) const;
5573 unsigned int width(void) const;
5575 };
5576
5577}
5578
5581
5583
5584namespace Gecode {
5585
5596
5602 protected:
5604 std::ostream& os;
5605 public:
5607 StdIntTracer(std::ostream& os0 = std::cerr);
5609 virtual void init(const Space& home, const IntTraceRecorder& t);
5611 virtual void prune(const Space& home, const IntTraceRecorder& t,
5612 const ViewTraceInfo& vti, int i, IntTraceDelta& d);
5614 virtual void fix(const Space& home, const IntTraceRecorder& t);
5616 virtual void fail(const Space& home, const IntTraceRecorder& t);
5618 virtual void done(const Space& home, const IntTraceRecorder& t);
5621 };
5622
5623
5634
5640 protected:
5642 std::ostream& os;
5643 public:
5645 StdBoolTracer(std::ostream& os0 = std::cerr);
5647 virtual void init(const Space& home, const BoolTraceRecorder& t);
5649 virtual void prune(const Space& home, const BoolTraceRecorder& t,
5650 const ViewTraceInfo& vti, int i, BoolTraceDelta& d);
5652 virtual void fix(const Space& home, const BoolTraceRecorder& t);
5654 virtual void fail(const Space& home, const BoolTraceRecorder& t);
5656 virtual void done(const Space& home, const BoolTraceRecorder& t);
5659 };
5660
5666 trace(Home home, const IntVarArgs& x,
5667 TraceFilter tf,
5668 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5674 void
5675 trace(Home home, const IntVarArgs& x,
5676 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5678
5684 trace(Home home, const BoolVarArgs& x,
5685 TraceFilter tf,
5686 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5692 void
5693 trace(Home home, const BoolVarArgs& x,
5694 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
5696
5697}
5698
5699#include <gecode/int/trace.hpp>
5700
5701#endif
5702
5703// IFDEF: GECODE_HAS_INT_VARS
5704// STATISTICS: int-post
5705
NNF * l
Left subtree.
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
union Gecode::@603::NNF::@65 u
Union depending on nodetype t.
NodeType t
Type of node.
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
bool neg
Is atomic formula negative.
Class for AFC (accumulated failure count) management.
Definition afc.hpp:40
Class for action management.
Definition action.hpp:42
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:4316
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:4407
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:5000
Select
Which value selection.
Definition int.hh:5003
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:5007
@ SEL_MIN
Select smallest value.
Definition int.hh:5004
@ SEL_MAX
Select largest value.
Definition int.hh:5005
@ SEL_RND
Select random value.
Definition int.hh:5006
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:5011
Recording CHB for Boolean variables.
Definition int.hh:4502
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:5548
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:5551
Which values to select for branching first.
Definition int.hh:4889
Select s
Which value to select.
Definition int.hh:4900
Select
Which value selection.
Definition int.hh:4892
@ SEL_MIN
Select smallest value.
Definition int.hh:4893
@ SEL_RND
Select random value.
Definition int.hh:4895
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:4896
@ SEL_MAX
Select largest value.
Definition int.hh:4894
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:712
BoolVarArgs(void)
Allocate empty array.
Definition array.hpp:114
Boolean variable array.
Definition int.hh:808
BoolVarArray(void)
Default constructor (array of size 0)
Definition array.hpp:159
Which Boolean variable to select for branching.
Definition int.hh:4656
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:4659
@ SEL_DEGREE_MIN
With smallest degree.
Definition int.hh:4664
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition int.hh:4667
@ SEL_CHB_MIN
With lowest CHB.
Definition int.hh:4670
@ SEL_MERIT_MIN
With least merit.
Definition int.hh:4662
@ SEL_ACTION_MIN
With lowest action.
Definition int.hh:4668
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition int.hh:4666
@ SEL_RND
Random (uniform, for tie breaking)
Definition int.hh:4661
@ SEL_NONE
First unassigned.
Definition int.hh:4660
@ SEL_ACTION_MAX
With highest action.
Definition int.hh:4669
@ SEL_CHB_MAX
With highest CHB.
Definition int.hh:4671
@ SEL_MERIT_MAX
With highest merit.
Definition int.hh:4663
@ SEL_DEGREE_MAX
With largest degree.
Definition int.hh:4665
Select s
Which variable to select.
Definition int.hh:4675
Boolean integer variables.
Definition int.hh:512
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
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition bool.hpp:67
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:1442
Class for CHB management.
Definition chb.hpp:46
Data stored for a DFA.
Definition dfa.hpp:42
Iterator for DFA symbols.
Definition int.hh:2092
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:2058
int i_state
input state
Definition int.hh:2060
int o_state
output state Default constructor
Definition int.hh:2062
Iterator for DFA transitions (sorted by symbols)
Definition int.hh:2069
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
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:2049
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:2122
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:4276
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:4362
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:628
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:4971
Select s
Which value to select.
Definition int.hh:4983
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:4974
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:4979
@ SEL_MIN
Select smallest value.
Definition int.hh:4975
@ SEL_MED
Select greatest value not greater than the median.
Definition int.hh:4976
@ SEL_RND
Select random value.
Definition int.hh:4978
@ SEL_MAX
Select largest value.
Definition int.hh:4977
Recording CHB for integer variables.
Definition int.hh:4458
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
Integer set initialization.
Definition int-set-1.hpp:53
Range iterator for integer sets.
Definition int.hh:292
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.
Value iterator for integer sets.
Definition int.hh:333
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)
bool in(int n) const
Return whether n is included in the set.
int max(void) const
Return maximum of entire set.
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.
Trace delta information for integer variables.
Definition int.hh:5530
Int::ViewRanges< Int::IntView > rn
Iterator over the new values.
Definition int.hh:5533
Iter::Ranges::RangeList ro
Iterator over the old values.
Definition int.hh:5535
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:4854
Select
Which value selection.
Definition int.hh:4857
@ SEL_VALUES_MIN
Select all values starting from smallest.
Definition int.hh:4867
@ SEL_RND
Select random value.
Definition int.hh:4861
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Definition int.hh:4863
@ SEL_MIN
Select smallest value.
Definition int.hh:4858
@ SEL_MAX
Select largest value.
Definition int.hh:4860
@ SEL_RANGE_MAX
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Definition int.hh:4865
@ SEL_RANGE_MIN
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
Definition int.hh:4864
@ SEL_VALUES_MAX
Select all values starting from largest.
Definition int.hh:4868
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Definition int.hh:4866
@ SEL_MED
Select greatest value not greater than the median.
Definition int.hh:4859
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Definition int.hh:4862
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:4872
Passing integer variables.
Definition int.hh:656
IntVarArgs(void)
Allocate empty array.
Definition array.hpp:85
Integer variable array.
Definition int.hh:763
IntVarArray(void)
Default constructor (array of size 0)
Definition array.hpp:143
Which integer variable to select for branching.
Definition int.hh:4570
void expand(Home home, const IntVarArgs &x)
Expand AFC, action, and CHB.
Definition var.hpp:74
Select
Which variable selection.
Definition int.hh:4573
@ SEL_MAX_MIN
With smallest max.
Definition int.hh:4588
@ SEL_CHB_MAX
With highest CHB Q-score.
Definition int.hh:4585
@ SEL_AFC_SIZE_MAX
With largest accumulated failure count divided by domain size.
Definition int.hh:4595
@ SEL_MIN_MIN
With smallest min.
Definition int.hh:4586
@ SEL_ACTION_SIZE_MAX
With largest action divided by domain size.
Definition int.hh:4597
@ SEL_AFC_SIZE_MIN
With smallest accumulated failure count divided by domain size.
Definition int.hh:4594
@ SEL_REGRET_MIN_MIN
With smallest min-regret.
Definition int.hh:4605
@ SEL_DEGREE_SIZE_MIN
With smallest degree divided by domain size.
Definition int.hh:4592
@ SEL_MIN_MAX
With largest min.
Definition int.hh:4587
@ SEL_REGRET_MIN_MAX
With largest min-regret.
Definition int.hh:4611
@ SEL_CHB_SIZE_MAX
With largest CHB Q-score divided by domain size.
Definition int.hh:4599
@ SEL_MAX_MAX
With largest max.
Definition int.hh:4589
@ SEL_AFC_MIN
With smallest accumulated failure count.
Definition int.hh:4580
@ SEL_SIZE_MIN
With smallest domain size.
Definition int.hh:4590
@ SEL_AFC_MAX
With largest accumulated failure count.
Definition int.hh:4581
@ SEL_MERIT_MAX
With highest merit.
Definition int.hh:4577
@ SEL_DEGREE_MAX
With largest degree.
Definition int.hh:4579
@ SEL_SIZE_MAX
With largest domain size.
Definition int.hh:4591
@ SEL_ACTION_MIN
With lowest action.
Definition int.hh:4582
@ SEL_ACTION_MAX
With highest action.
Definition int.hh:4583
@ SEL_CHB_MIN
With lowest CHB Q-score.
Definition int.hh:4584
@ SEL_RND
Random (uniform, for tie breaking)
Definition int.hh:4575
@ SEL_NONE
First unassigned.
Definition int.hh:4574
@ SEL_MERIT_MIN
With least merit.
Definition int.hh:4576
@ SEL_REGRET_MAX_MIN
With smallest max-regret.
Definition int.hh:4617
@ SEL_CHB_SIZE_MIN
With smallest CHB Q-score divided by domain size.
Definition int.hh:4598
@ SEL_DEGREE_MIN
With smallest degree.
Definition int.hh:4578
@ SEL_REGRET_MAX_MAX
With largest max-regret.
Definition int.hh:4623
@ SEL_ACTION_SIZE_MIN
With smallest action divided by domain size.
Definition int.hh:4596
@ SEL_DEGREE_SIZE_MAX
With largest degree divided by domain size.
Definition int.hh:4593
Select s
Which variable to select.
Definition int.hh:4627
Select select(void) const
Return selection strategy.
Definition var.hpp:69
IntVarBranch(void)
Initialize with strategy SEL_NONE.
Definition var.hpp:37
Range iterator for integer variables
Definition int.hh:473
IntVarRanges(void)
Default constructor.
Definition int.hpp:106
void init(const IntVar &x)
Initialize with ranges for integer variable x.
Definition int.hpp:113
Value iterator for integer variables.
Definition int.hh:490
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
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
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
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:876
BoolVar x
The Boolean control variable.
Definition int.hh:879
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:881
Random number generator.
Definition rnd.hpp:42
Shared array with arbitrary number of elements.
The shared handle.
Computation spaces.
Definition core.hpp:1742
Standard Boolean variable tracer.
Definition int.hh:5639
std::ostream & os
Output stream to use.
Definition int.hh:5642
static StdBoolTracer def
Default tracer (printing to std::cerr)
Definition int.hh:5658
Standard integer variable tracer.
Definition int.hh:5601
std::ostream & os
Output stream to use.
Definition int.hh:5604
static StdIntTracer def
Default tracer (printing to std::cerr)
Definition int.hh:5620
Date item for bitsets.
Collection of symmetries.
Definition int.hh:5292
A reference-counted pointer to a SymmetryObject.
Definition int.hh:5255
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Definition int.hh:5258
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:2229
int max
Largest value.
Definition int.hh:2245
int n_free
Number of free tuple entries of arity.
Definition int.hh:2241
BitSetData * support
Pointer to all support data.
Definition int.hh:2255
unsigned int n_words
Number of words for support.
Definition int.hh:2237
int min
Smallest value.
Definition int.hh:2243
int n_tuples
Number of Tuples.
Definition int.hh:2239
int * td
Tuple data.
Definition int.hh:2249
Range * range
Pointer to all ranges.
Definition int.hh:2253
ValueData * vd
Value data.
Definition int.hh:2251
std::size_t key
Hash key.
Definition int.hh:2247
Range information.
Definition int.hh:2201
BitSetData * s
Begin of supports.
Definition int.hh:2208
unsigned int width(void) const
Return the width.
Definition tuple-set.hpp:45
int max
Maximum value.
Definition int.hh:2206
int min
Minimum value.
Definition int.hh:2204
const BitSetData * supports(unsigned int n_words, int n) const
Return the supports for value n.
Definition tuple-set.hpp:50
Iterator over ranges.
Definition int.hh:2359
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:2364
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:2362
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Data about values in the table.
Definition int.hh:2216
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:2219
Class represeting a set of tuples.
Definition int.hh:2191
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.
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.
Gecode::Support::BitSetData BitSetData
Import bit set data type.
Definition int.hh:2199
int * Tuple
Type of a tuple.
Definition int.hh:2197
int min(void) const
Return minimal value in all tuples.
Data & raw(void) const
Get raw data (must be initialized)
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.
Value branching information.
Definition val.hpp:41
Argument array for variables.
Definition array.hpp:774
Variable arrays
Definition array.hpp:112
Variable branching information.
Definition var.hpp:55
Variables as interfaces to variable implementations.
Definition var.hpp:47
View trace information.
Definition core.hpp:908
Propagator for recording view trace information.
Definition tracer.hpp:44
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:5595
ViewTraceRecorder< Int::BoolView > BoolTraceRecorder
Trace recorder for Boolean variables.
Definition int.hh:5633
ViewTracer< Int::IntView > IntTracer
Tracer for integer variables.
Definition int.hh:5590
ViewTracer< Int::BoolView > BoolTracer
Tracer for Boolean variables.
Definition int.hh:5628
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:4198
std::function< bool(const Space &home, IntVar x, int i)> IntBranchFilter
Branch filter function type for integer variables.
Definition int.hh:4176
std::function< bool(const Space &home, BoolVar x, int i)> BoolBranchFilter
Branch filter function type for Boolean variables.
Definition int.hh:4186
std::function< int(const Space &home, BoolVar x, int i)> BoolBranchVal
Branch value function type for Boolean variables.
Definition int.hh:4234
std::function< double(const Space &home, BoolVar x, int i)> BoolBranchMerit
Branch merit function type for Boolean variables.
Definition int.hh:4209
std::function< int(const Space &home, IntVar x, int i)> IntBranchVal
Branch value function type for integer variables.
Definition int.hh:4222
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:4263
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:4249
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:925
Reify eqv(BoolVar x)
Use equivalence for reification.
Definition reify.hpp:69
TaskType
Type of task for scheduling constraints.
Definition int.hh:1004
ReifyMode
Mode for reification.
Definition int.hh:848
BoolOpType
Operation types for Booleans.
Definition int.hh:950
Reify pmi(BoolVar x)
Use reverse implication for reification.
Definition reify.hpp:77
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
ArgArray< TaskType > TaskTypeArgs
Argument arrays for passing task type arguments.
Definition int.hh:1015
@ IRT_EQ
Equality ( )
Definition int.hh:926
@ IRT_NQ
Disequality ( )
Definition int.hh:927
@ IRT_GQ
Greater or equal ( )
Definition int.hh:930
@ IRT_LE
Less ( )
Definition int.hh:929
@ IRT_GR
Greater ( )
Definition int.hh:931
@ IRT_LQ
Less or equal ( )
Definition int.hh:928
@ TT_FIXS
Definition int.hh:1006
@ TT_FIXE
Definition int.hh:1007
@ TT_FIXP
Definition int.hh:1005
@ RM_IMP
Implication for reification.
Definition int.hh:862
@ RM_PMI
Inverse implication for reification.
Definition int.hh:869
@ RM_EQV
Equivalence for reification (default)
Definition int.hh:855
@ BOT_OR
Disjunction.
Definition int.hh:952
@ BOT_EQV
Equivalence.
Definition int.hh:954
@ BOT_IMP
Implication.
Definition int.hh:953
@ BOT_XOR
Exclusive or.
Definition int.hh:955
@ BOT_AND
Conjunction.
Definition int.hh:951
@ IPL_BASIC
Use basic propagation algorithm.
Definition int.hh:981
@ IPL_BASIC_ADVANCED
Use both.
Definition int.hh:983
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Definition int.hh:979
@ _IPL_BITS
Number of bits required (internal)
Definition int.hh:984
@ IPL_VAL
Value propagation.
Definition int.hh:977
@ IPL_ADVANCED
Use advanced propagation algorithm.
Definition int.hh:982
@ IPL_DEF
Simple propagation levels.
Definition int.hh:976
@ IPL_BND
Bounds propagation.
Definition int.hh:978
@ 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
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
Gecode toplevel namespace
ArgArray< IntSet > IntSetArgs
Passing set arguments.
Definition int.hh:619
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:767
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:1477
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
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:767
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:767
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:4552
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:4559
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:767
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