00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef __GECODE_INT_HH__
00047 #define __GECODE_INT_HH__
00048
00049 #include <climits>
00050 #include <cfloat>
00051
00052 #include <iostream>
00053 #include <vector>
00054 #include <unordered_map>
00055 #include <functional>
00056 #include <utility>
00057 #include <initializer_list>
00058
00059 #include <gecode/kernel.hh>
00060 #include <gecode/search.hh>
00061 #include <gecode/iter.hh>
00062
00063
00064
00065
00066
00067 #if !defined(GECODE_STATIC_LIBS) && \
00068 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00069
00070 #ifdef GECODE_BUILD_INT
00071 #define GECODE_INT_EXPORT __declspec( dllexport )
00072 #else
00073 #define GECODE_INT_EXPORT __declspec( dllimport )
00074 #endif
00075
00076 #else
00077
00078 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00079 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00080 #else
00081 #define GECODE_INT_EXPORT
00082 #endif
00083
00084 #endif
00085
00086
00087 #ifndef GECODE_BUILD_INT
00088 #define GECODE_LIBRARY_NAME "Int"
00089 #include <gecode/support/auto-link.hpp>
00090 #endif
00091
00103 #include <gecode/int/exception.hpp>
00104
00105 namespace Gecode { namespace Int {
00106
00114 namespace Limits {
00116 const int max = INT_MAX - 1;
00118 const int min = -max;
00120 const int infinity = max + 1;
00122 const long long int llmax = LLONG_MAX - 1;
00124 const long long int llmin = -llmax;
00126 const long long int llinfinity = llmax + 1;
00128 bool valid(int n);
00130 bool valid(long long int n);
00132 void check(int n, const char* l);
00134 void check(long long int n, const char* l);
00136 void positive(int n, const char* l);
00138 void positive(long long int n, const char* l);
00140 void nonnegative(int n, const char* l);
00142 void nonnegative(long long int n, const char* l);
00144 bool overflow_add(int n, int m);
00146 bool overflow_add(long long int n, long long int m);
00148 bool overflow_sub(int n, int m);
00150 bool overflow_sub(long long int n, long long int m);
00152 bool overflow_mul(int n, int m);
00154 bool overflow_mul(long long int n, long long int m);
00155 }
00156
00157 }}
00158
00159 #include <gecode/int/limits.hpp>
00160
00161 namespace Gecode {
00162
00163 class IntSetRanges;
00164
00165 template<class I> class IntSetInit;
00166
00174 class IntSet : public SharedHandle {
00175 friend class IntSetRanges;
00176 template<class I> friend class IntSetInit;
00177 private:
00179 class Range {
00180 public:
00181 int min, max;
00182 };
00183 class IntSetObject : public SharedHandle::Object {
00184 public:
00186 unsigned int size;
00188 int n;
00190 Range* r;
00192 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00194 GECODE_INT_EXPORT bool in(int n) const;
00196 GECODE_INT_EXPORT bool equal(const IntSetObject& so) const;
00198 GECODE_INT_EXPORT virtual ~IntSetObject(void);
00199 };
00201 class MinInc;
00203 GECODE_INT_EXPORT void normalize(Range* r, int n);
00205 GECODE_INT_EXPORT void init(int n, int m);
00207 GECODE_INT_EXPORT void init(const int r[], int n);
00209 GECODE_INT_EXPORT void init(const int r[][2], int n);
00210 public:
00212
00213
00214 IntSet(void);
00219 explicit IntSet(int n, int m);
00221 explicit IntSet(const int r[], int n);
00227 explicit IntSet(const int r[][2], int n);
00229 template<class I>
00230 explicit IntSet(I& i);
00232 template<class I>
00233 explicit IntSet(const I& i);
00235 GECODE_INT_EXPORT
00236 explicit IntSet(std::initializer_list<int> r);
00242 GECODE_INT_EXPORT
00243 explicit IntSet(std::initializer_list<std::pair<int,int>> r);
00245
00247
00248
00249 int ranges(void) const;
00251 int min(int i) const;
00253 int max(int i) const;
00255 unsigned int width(int i) const;
00257
00259
00260
00261 bool in(int n) const;
00263 unsigned int size(void) const;
00265 unsigned int width(void) const;
00267 int min(void) const;
00269 int max(void) const;
00271
00273
00274
00275 bool operator ==(const IntSet& s) const;
00277 bool operator !=(const IntSet& s) const;
00279
00281
00282
00283 GECODE_INT_EXPORT static const IntSet empty;
00285 };
00286
00292 class IntSetRanges {
00293 private:
00295 const IntSet::Range* i;
00297 const IntSet::Range* e;
00298 public:
00300
00301
00302 IntSetRanges(void);
00304 IntSetRanges(const IntSet& s);
00306 void init(const IntSet& s);
00308
00310
00311
00312 bool operator ()(void) const;
00314 void operator ++(void);
00316
00318
00319
00320 int min(void) const;
00322 int max(void) const;
00324 unsigned int width(void) const;
00326 };
00327
00333 class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00334 public:
00336
00337
00338 IntSetValues(void);
00340 IntSetValues(const IntSet& s);
00342 void init(const IntSet& s);
00344 };
00345
00350 template<class Char, class Traits>
00351 std::basic_ostream<Char,Traits>&
00352 operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
00353
00354 }
00355
00356 #include <gecode/int/int-set-1.hpp>
00357
00358 #include <gecode/int/var-imp.hpp>
00359
00360 namespace Gecode {
00361
00362 namespace Int {
00363 class IntView;
00364 }
00365
00371 class IntVar : public VarImpVar<Int::IntVarImp> {
00372 friend class IntVarArray;
00373 friend class IntVarArgs;
00374 private:
00375 using VarImpVar<Int::IntVarImp>::x;
00382 void _init(Space& home, int min, int max);
00389 void _init(Space& home, const IntSet& d);
00390 public:
00392
00393
00394 IntVar(void);
00396 IntVar(const IntVar& y);
00398 IntVar(const Int::IntView& y);
00410 GECODE_INT_EXPORT IntVar(Space& home, int min, int max);
00422 GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
00424
00426
00427
00428 int min(void) const;
00430 int max(void) const;
00432 int med(void) const;
00440 int val(void) const;
00441
00443 unsigned int size(void) const;
00445 unsigned int width(void) const;
00447 unsigned int regret_min(void) const;
00449 unsigned int regret_max(void) const;
00451
00453
00454
00455 bool range(void) const;
00457 bool in(int n) const;
00459 };
00460
00465 template<class Char, class Traits>
00466 std::basic_ostream<Char,Traits>&
00467 operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
00468
00473 class IntVarRanges : public Int::IntVarImpFwd {
00474 public:
00476
00477
00478 IntVarRanges(void);
00480 IntVarRanges(const IntVar& x);
00482 void init(const IntVar& x);
00484 };
00485
00490 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00491 public:
00493
00494
00495 IntVarValues(void);
00497 IntVarValues(const IntVar& x);
00499 void init(const IntVar& x);
00501 };
00502
00503 namespace Int {
00504 class BoolView;
00505 }
00506
00512 class BoolVar : public VarImpVar<Int::BoolVarImp> {
00513 friend class BoolVarArray;
00514 friend class BoolVarArgs;
00515 private:
00516 using VarImpVar<Int::BoolVarImp>::x;
00523 void _init(Space& home, int min, int max);
00524 public:
00526
00527
00528 BoolVar(void);
00530 BoolVar(const BoolVar& y);
00532 BoolVar(const Int::BoolView& y);
00544 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
00546
00548
00549
00550 int min(void) const;
00552 int max(void) const;
00554 int med(void) const;
00562 int val(void) const;
00563
00565 unsigned int size(void) const;
00567 unsigned int width(void) const;
00569 unsigned int regret_min(void) const;
00571 unsigned int regret_max(void) const;
00573
00575
00576
00577 bool range(void) const;
00579 bool in(int n) const;
00581
00583
00584
00585 bool zero(void) const;
00587 bool one(void) const;
00589 bool none(void) const;
00591 };
00592
00597 template<class Char, class Traits>
00598 std::basic_ostream<Char,Traits>&
00599 operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
00600
00601 }
00602
00603
00604 #include <gecode/int/view.hpp>
00605 #include <gecode/int/propagator.hpp>
00606
00607 namespace Gecode {
00608
00618
00619 typedef ArgArray<IntSet> IntSetArgs;
00620
00621 }
00622
00623 #include <gecode/int/array-traits.hpp>
00624
00625 namespace Gecode {
00626
00628 class IntArgs : public ArgArray<int> {
00629 public:
00631
00632
00633 IntArgs(void);
00635 explicit IntArgs(int n);
00637 IntArgs(const SharedArray<int>& x);
00639 IntArgs(const std::vector<int>& x);
00641 IntArgs(std::initializer_list<int> x);
00643 template<class InputIterator>
00644 IntArgs(InputIterator first, InputIterator last);
00646 IntArgs(int n, const int* e);
00648 IntArgs(const ArgArray<int>& a);
00649
00651 static IntArgs create(int n, int start, int inc=1);
00653 };
00654
00656 class IntVarArgs : public VarArgArray<IntVar> {
00657 public:
00659
00660
00661 IntVarArgs(void);
00663 explicit IntVarArgs(int n);
00665 IntVarArgs(const IntVarArgs& a);
00667 IntVarArgs(const VarArray<IntVar>& a);
00669 IntVarArgs(const std::vector<IntVar>& a);
00671 IntVarArgs(std::initializer_list<IntVar> a);
00673 template<class InputIterator>
00674 IntVarArgs(InputIterator first, InputIterator last);
00686 GECODE_INT_EXPORT
00687 IntVarArgs(Space& home, int n, int min, int max);
00699 GECODE_INT_EXPORT
00700 IntVarArgs(Space& home, int n, const IntSet& s);
00702 };
00703
00712 class BoolVarArgs : public VarArgArray<BoolVar> {
00713 public:
00715
00716
00717 BoolVarArgs(void);
00719 explicit BoolVarArgs(int n);
00721 BoolVarArgs(const BoolVarArgs& a);
00723 BoolVarArgs(const VarArray<BoolVar>& a);
00725 BoolVarArgs(const std::vector<BoolVar>& a);
00727 BoolVarArgs(std::initializer_list<BoolVar> a);
00729 template<class InputIterator>
00730 BoolVarArgs(InputIterator first, InputIterator last);
00742 GECODE_INT_EXPORT
00743 BoolVarArgs(Space& home, int n, int min, int max);
00745 };
00747
00763 class IntVarArray : public VarArray<IntVar> {
00764 public:
00766
00767
00768 IntVarArray(void);
00770 IntVarArray(Space& home, int n);
00772 IntVarArray(const IntVarArray& a);
00774 IntVarArray(Space& home, const IntVarArgs& a);
00786 GECODE_INT_EXPORT
00787 IntVarArray(Space& home, int n, int min, int max);
00799 GECODE_INT_EXPORT
00800 IntVarArray(Space& home, int n, const IntSet& s);
00802 };
00803
00808 class BoolVarArray : public VarArray<BoolVar> {
00809 public:
00811
00812
00813 BoolVarArray(void);
00815 BoolVarArray(Space& home, int n);
00817 BoolVarArray(const BoolVarArray& a);
00819 BoolVarArray(Space& home, const BoolVarArgs& a);
00831 GECODE_INT_EXPORT
00832 BoolVarArray(Space& home, int n, int min, int max);
00834 };
00835
00836 }
00837
00838 #include <gecode/int/int-set-2.hpp>
00839
00840 #include <gecode/int/array.hpp>
00841
00842 namespace Gecode {
00843
00848 enum ReifyMode {
00855 RM_EQV,
00862 RM_IMP,
00869 RM_PMI
00870 };
00871
00876 class Reify {
00877 protected:
00879 BoolVar x;
00881 ReifyMode rm;
00882 public:
00884 Reify(void);
00886 Reify(BoolVar x, ReifyMode rm=RM_EQV);
00888 BoolVar var(void) const;
00890 ReifyMode mode(void) const;
00892 void var(BoolVar x);
00894 void mode(ReifyMode rm);
00895 };
00896
00901 Reify eqv(BoolVar x);
00902
00907 Reify imp(BoolVar x);
00908
00913 Reify pmi(BoolVar x);
00914
00915 }
00916
00917 #include <gecode/int/reify.hpp>
00918
00919 namespace Gecode {
00920
00925 enum IntRelType {
00926 IRT_EQ,
00927 IRT_NQ,
00928 IRT_LQ,
00929 IRT_LE,
00930 IRT_GQ,
00931 IRT_GR
00932 };
00933
00935 IntRelType swap(IntRelType irt);
00936
00938 IntRelType neg(IntRelType irt);
00939
00940 }
00941
00942 #include <gecode/int/irt.hpp>
00943
00944 namespace Gecode {
00945
00950 enum BoolOpType {
00951 BOT_AND,
00952 BOT_OR,
00953 BOT_IMP,
00954 BOT_EQV,
00955 BOT_XOR
00956 };
00957
00974 enum IntPropLevel {
00976 IPL_DEF = 0,
00977 IPL_VAL = 1,
00978 IPL_BND = 2,
00979 IPL_DOM = 3,
00980
00981 IPL_BASIC = 4,
00982 IPL_ADVANCED = 8,
00983 IPL_BASIC_ADVANCED = IPL_BASIC | IPL_ADVANCED,
00984 _IPL_BITS = 4
00985 };
00986
00988 IntPropLevel vbd(IntPropLevel ipl);
00989
00991 IntPropLevel ba(IntPropLevel ipl);
00992
00993 }
00994
00995 #include <gecode/int/ipl.hpp>
00996
00997 namespace Gecode {
00998
01004 enum TaskType {
01005 TT_FIXP,
01006 TT_FIXS,
01007 TT_FIXE
01008 };
01009
01015 typedef ArgArray<TaskType> TaskTypeArgs;
01016
01018 template<>
01019 class ArrayTraits<ArgArray<TaskType> > {
01020 public:
01021 typedef TaskTypeArgs StorageType;
01022 typedef TaskType ValueType;
01023 typedef TaskTypeArgs ArgsType;
01024 };
01025
01026
01034
01035 GECODE_INT_EXPORT void
01036 dom(Home home, IntVar x, int n,
01037 IntPropLevel ipl=IPL_DEF);
01039 GECODE_INT_EXPORT void
01040 dom(Home home, const IntVarArgs& x, int n,
01041 IntPropLevel ipl=IPL_DEF);
01042
01044 GECODE_INT_EXPORT void
01045 dom(Home home, IntVar x, int l, int m,
01046 IntPropLevel ipl=IPL_DEF);
01048 GECODE_INT_EXPORT void
01049 dom(Home home, const IntVarArgs& x, int l, int m,
01050 IntPropLevel ipl=IPL_DEF);
01051
01053 GECODE_INT_EXPORT void
01054 dom(Home home, IntVar x, const IntSet& s,
01055 IntPropLevel ipl=IPL_DEF);
01057 GECODE_INT_EXPORT void
01058 dom(Home home, const IntVarArgs& x, const IntSet& s,
01059 IntPropLevel ipl=IPL_DEF);
01060
01062 GECODE_INT_EXPORT void
01063 dom(Home home, IntVar x, int n, Reify r,
01064 IntPropLevel ipl=IPL_DEF);
01066 GECODE_INT_EXPORT void
01067 dom(Home home, IntVar x, int l, int m, Reify r,
01068 IntPropLevel ipl=IPL_DEF);
01070 GECODE_INT_EXPORT void
01071 dom(Home home, IntVar x, const IntSet& s, Reify r,
01072 IntPropLevel ipl=IPL_DEF);
01073
01075 GECODE_INT_EXPORT void
01076 dom(Home home, IntVar x, IntVar d,
01077 IntPropLevel ipl=IPL_DEF);
01079 GECODE_INT_EXPORT void
01080 dom(Home home, BoolVar x, BoolVar d,
01081 IntPropLevel ipl=IPL_DEF);
01083 GECODE_INT_EXPORT void
01084 dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
01085 IntPropLevel ipl=IPL_DEF);
01087 GECODE_INT_EXPORT void
01088 dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
01089 IntPropLevel ipl=IPL_DEF);
01091
01092
01103 GECODE_INT_EXPORT void
01104 rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
01105 IntPropLevel ipl=IPL_DEF);
01112 GECODE_INT_EXPORT void
01113 rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01114 IntPropLevel ipl=IPL_DEF);
01118 GECODE_INT_EXPORT void
01119 rel(Home home, IntVar x, IntRelType irt, int c,
01120 IntPropLevel ipl=IPL_DEF);
01124 GECODE_INT_EXPORT void
01125 rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
01126 IntPropLevel ipl=IPL_DEF);
01133 GECODE_INT_EXPORT void
01134 rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
01135 IntPropLevel ipl=IPL_DEF);
01142 GECODE_INT_EXPORT void
01143 rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
01144 IntPropLevel ipl=IPL_DEF);
01159 GECODE_INT_EXPORT void
01160 rel(Home home, const IntVarArgs& x, IntRelType irt,
01161 IntPropLevel ipl=IPL_DEF);
01176 GECODE_INT_EXPORT void
01177 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
01178 IntPropLevel ipl=IPL_DEF);
01192 GECODE_INT_EXPORT void
01193 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
01194 IntPropLevel ipl=IPL_DEF);
01208 GECODE_INT_EXPORT void
01209 rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
01210 IntPropLevel ipl=IPL_DEF);
01211
01219 GECODE_INT_EXPORT void
01220 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
01221 IntPropLevel ipl=IPL_DEF);
01225 GECODE_INT_EXPORT void
01226 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
01227 IntPropLevel ipl=IPL_DEF);
01231 GECODE_INT_EXPORT void
01232 rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
01233 IntPropLevel ipl=IPL_DEF);
01241 GECODE_INT_EXPORT void
01242 rel(Home home, BoolVar x, IntRelType irt, int n,
01243 IntPropLevel ipl=IPL_DEF);
01251 GECODE_INT_EXPORT void
01252 rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
01253 IntPropLevel ipl=IPL_DEF);
01261 GECODE_INT_EXPORT void
01262 rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
01263 IntPropLevel ipl=IPL_DEF);
01276 GECODE_INT_EXPORT void
01277 rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
01278 IntPropLevel ipl=IPL_DEF);
01291 GECODE_INT_EXPORT void
01292 rel(Home home, const BoolVarArgs& x, IntRelType irt, const IntArgs& y,
01293 IntPropLevel ipl=IPL_DEF);
01306 GECODE_INT_EXPORT void
01307 rel(Home home, const IntArgs& x, IntRelType irt, const BoolVarArgs& y,
01308 IntPropLevel ipl=IPL_DEF);
01319 GECODE_INT_EXPORT void
01320 rel(Home home, const BoolVarArgs& x, IntRelType irt,
01321 IntPropLevel ipl=IPL_DEF);
01327 GECODE_INT_EXPORT void
01328 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
01329 IntPropLevel ipl=IPL_DEF);
01338 GECODE_INT_EXPORT void
01339 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
01340 IntPropLevel ipl=IPL_DEF);
01350 GECODE_INT_EXPORT void
01351 rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
01352 IntPropLevel ipl=IPL_DEF);
01365 GECODE_INT_EXPORT void
01366 rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
01367 IntPropLevel ipl=IPL_DEF);
01378 GECODE_INT_EXPORT void
01379 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01380 BoolVar z, IntPropLevel ipl=IPL_DEF);
01394 GECODE_INT_EXPORT void
01395 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01396 int n, IntPropLevel ipl=IPL_DEF);
01406 GECODE_INT_EXPORT void
01407 ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
01408 IntPropLevel ipl=IPL_DEF);
01415 GECODE_INT_EXPORT void
01416 ite(Home home, BoolVar b, BoolVar x, BoolVar y, BoolVar z,
01417 IntPropLevel ipl=IPL_DEF);
01418
01419
01431 GECODE_INT_EXPORT void
01432 precede(Home home, const IntVarArgs& x, int s, int t,
01433 IntPropLevel=IPL_DEF);
01441 GECODE_INT_EXPORT void
01442 precede(Home home, const IntVarArgs& x, const IntArgs& c,
01443 IntPropLevel=IPL_DEF);
01444
01445
01451
01452 GECODE_INT_EXPORT void
01453 member(Home home, const IntVarArgs& x, IntVar y,
01454 IntPropLevel ipl=IPL_DEF);
01456 GECODE_INT_EXPORT void
01457 member(Home home, const BoolVarArgs& x, BoolVar y,
01458 IntPropLevel ipl=IPL_DEF);
01460 GECODE_INT_EXPORT void
01461 member(Home home, const IntVarArgs& x, IntVar y, Reify r,
01462 IntPropLevel ipl=IPL_DEF);
01464 GECODE_INT_EXPORT void
01465 member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
01466 IntPropLevel ipl=IPL_DEF);
01468
01469
01476
01477 typedef SharedArray<int> IntSharedArray;
01483 GECODE_INT_EXPORT void
01484 element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01485 IntPropLevel ipl=IPL_DEF);
01491 GECODE_INT_EXPORT void
01492 element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01493 IntPropLevel ipl=IPL_DEF);
01499 GECODE_INT_EXPORT void
01500 element(Home home, IntSharedArray n, IntVar x0, int x1,
01501 IntPropLevel ipl=IPL_DEF);
01507 GECODE_INT_EXPORT void
01508 element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01509 IntPropLevel ipl=IPL_DEF);
01515 GECODE_INT_EXPORT void
01516 element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01517 IntPropLevel ipl=IPL_DEF);
01519 GECODE_INT_EXPORT void
01520 element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01521 IntPropLevel ipl=IPL_DEF);
01523 GECODE_INT_EXPORT void
01524 element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01525 IntPropLevel ipl=IPL_DEF);
01526
01539 GECODE_INT_EXPORT void
01540 element(Home home, IntSharedArray a,
01541 IntVar x, int w, IntVar y, int h, IntVar z,
01542 IntPropLevel ipl=IPL_DEF);
01555 GECODE_INT_EXPORT void
01556 element(Home home, IntSharedArray a,
01557 IntVar x, int w, IntVar y, int h, BoolVar z,
01558 IntPropLevel ipl=IPL_DEF);
01574 GECODE_INT_EXPORT void
01575 element(Home home, const IntVarArgs& a,
01576 IntVar x, int w, IntVar y, int h, IntVar z,
01577 IntPropLevel ipl=IPL_DEF);
01590 GECODE_INT_EXPORT void
01591 element(Home home, const BoolVarArgs& a,
01592 IntVar x, int w, IntVar y, int h, BoolVar z,
01593 IntPropLevel ipl=IPL_DEF);
01595
01596
01611 GECODE_INT_EXPORT void
01612 distinct(Home home, const IntVarArgs& x,
01613 IntPropLevel ipl=IPL_DEF);
01626 GECODE_INT_EXPORT void
01627 distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01628 IntPropLevel ipl=IPL_DEF);
01643 GECODE_INT_EXPORT void
01644 distinct(Home home, const BoolVarArgs& b, const IntVarArgs& x,
01645 IntPropLevel ipl=IPL_DEF);
01658 GECODE_INT_EXPORT void
01659 distinct(Home home, const IntVarArgs& x, int c,
01660 IntPropLevel ipl=IPL_DEF);
01662
01663
01681 GECODE_INT_EXPORT void
01682 channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01683 IntPropLevel ipl=IPL_DEF);
01684
01698 GECODE_INT_EXPORT void
01699 channel(Home home, const IntVarArgs& x, int xoff,
01700 const IntVarArgs& y, int yoff,
01701 IntPropLevel ipl=IPL_DEF);
01702
01704 GECODE_INT_EXPORT void
01705 channel(Home home, BoolVar x0, IntVar x1,
01706 IntPropLevel ipl=IPL_DEF);
01708 void
01709 channel(Home home, IntVar x0, BoolVar x1,
01710 IntPropLevel ipl=IPL_DEF);
01716 GECODE_INT_EXPORT void
01717 channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01718 IntPropLevel ipl=IPL_DEF);
01720
01721 }
01722
01723 #include <gecode/int/channel.hpp>
01724
01725 namespace Gecode {
01726
01743 GECODE_INT_EXPORT void
01744 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01745 IntPropLevel ipl=IPL_DEF);
01746
01758 GECODE_INT_EXPORT void
01759 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01760 const IntVarArgs& z,
01761 IntPropLevel ipl=IPL_DEF);
01763
01764
01783 GECODE_INT_EXPORT void
01784 count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
01785 IntPropLevel ipl=IPL_DEF);
01790 GECODE_INT_EXPORT void
01791 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
01792 IntPropLevel ipl=IPL_DEF);
01800 GECODE_INT_EXPORT void
01801 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
01802 IntPropLevel ipl=IPL_DEF);
01810 GECODE_INT_EXPORT void
01811 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
01812 IntPropLevel ipl=IPL_DEF);
01817 GECODE_INT_EXPORT void
01818 count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
01819 IntPropLevel ipl=IPL_DEF);
01824 GECODE_INT_EXPORT void
01825 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
01826 IntPropLevel ipl=IPL_DEF);
01834 GECODE_INT_EXPORT void
01835 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
01836 IntPropLevel ipl=IPL_DEF);
01844 GECODE_INT_EXPORT void
01845 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
01846 IntPropLevel ipl=IPL_DEF);
01847
01861 GECODE_INT_EXPORT void
01862 count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01863 IntPropLevel ipl=IPL_DEF);
01864
01878 GECODE_INT_EXPORT void
01879 count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01880 IntPropLevel ipl=IPL_DEF);
01881
01898 GECODE_INT_EXPORT void
01899 count(Home home, const IntVarArgs& x,
01900 const IntVarArgs& c, const IntArgs& v,
01901 IntPropLevel ipl=IPL_DEF);
01902
01919 GECODE_INT_EXPORT void
01920 count(Home home, const IntVarArgs& x,
01921 const IntSetArgs& c, const IntArgs& v,
01922 IntPropLevel ipl=IPL_DEF);
01923
01940 GECODE_INT_EXPORT void
01941 count(Home home, const IntVarArgs& x,
01942 const IntSet& c, const IntArgs& v,
01943 IntPropLevel ipl=IPL_DEF);
01944
01946
01961 GECODE_INT_EXPORT void
01962 nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
01963 IntPropLevel ipl=IPL_DEF);
01967 GECODE_INT_EXPORT void
01968 nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01969 IntPropLevel ipl=IPL_DEF);
01973 GECODE_INT_EXPORT void
01974 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
01975 IntPropLevel ipl=IPL_DEF);
01979 GECODE_INT_EXPORT void
01980 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
01981 IntPropLevel ipl=IPL_DEF);
01983
02004 GECODE_INT_EXPORT void
02005 sequence(Home home, const IntVarArgs& x, const IntSet& s,
02006 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
02007
02022 GECODE_INT_EXPORT void
02023 sequence(Home home, const BoolVarArgs& x, const IntSet& s,
02024 int q, int l, int u, IntPropLevel ipl=IPL_DEF);
02025
02027
02049 class DFA : public SharedHandle {
02050 private:
02052 class DFAI;
02054 GECODE_INT_EXPORT
02055 bool equal(const DFA& d) const;
02056 public:
02058 class Transition {
02059 public:
02060 int i_state;
02061 int symbol;
02062 int o_state;
02063
02064 Transition(void);
02066 Transition(int i_state0, int symbol0, int o_state0);
02067 };
02069 class Transitions {
02070 private:
02072 const Transition* c_trans;
02074 const Transition* e_trans;
02075 public:
02077 Transitions(const DFA& d);
02079 Transitions(const DFA& d, int n);
02081 bool operator ()(void) const;
02083 void operator ++(void);
02085 int i_state(void) const;
02087 int symbol(void) const;
02089 int o_state(void) const;
02090 };
02092 class Symbols {
02093 private:
02095 const Transition* c_trans;
02097 const Transition* e_trans;
02098 public:
02100 Symbols(const DFA& d);
02102 bool operator ()(void) const;
02104 void operator ++(void);
02106 int val(void) const;
02107 };
02119 GECODE_INT_EXPORT
02120 void init(int s, Transition t[], int f[], bool minimize=true);
02121 public:
02122 friend class Transitions;
02124 DFA(void);
02136 GECODE_INT_EXPORT
02137 DFA(int s, Transition t[], int f[], bool minimize=true);
02147 GECODE_INT_EXPORT
02148 DFA(int s, std::initializer_list<Transition> t,
02149 std::initializer_list<int> f, bool minimize=true);
02151 DFA(const DFA& d);
02153 GECODE_INT_EXPORT
02154 bool operator ==(const DFA& d) const;
02156 bool operator !=(const DFA& d) const;
02158 int n_states(void) const;
02160 int n_transitions(void) const;
02162 unsigned int n_symbols(void) const;
02164 unsigned int max_degree(void) const;
02166 int final_fst(void) const;
02168 int final_lst(void) const;
02170 int symbol_min(void) const;
02172 int symbol_max(void) const;
02174 std::size_t hash(void) const;
02175 };
02176
02177 }
02178
02179 #include <gecode/int/extensional/dfa.hpp>
02180
02181 namespace Gecode {
02182
02191 class TupleSet : public SharedHandle {
02192 public:
02197 typedef int* Tuple;
02199 typedef Gecode::Support::BitSetData BitSetData;
02201 class Range {
02202 public:
02204 int min;
02206 int max;
02208 BitSetData* s;
02210 unsigned int width(void) const;
02212 const BitSetData* supports(unsigned int n_words, int n) const;
02213 };
02214 protected:
02216 class ValueData {
02217 public:
02219 unsigned int n;
02221 Range* r;
02223 unsigned int start(int n) const;
02224 };
02229 class GECODE_VTABLE_EXPORT Data : public SharedHandle::Object {
02230 protected:
02232 static const int n_initial_free = 1024;
02233 public:
02235 int arity;
02237 unsigned int n_words;
02239 int n_tuples;
02241 int n_free;
02243 int min;
02245 int max;
02247 std::size_t key;
02249 int* td;
02251 ValueData* vd;
02253 Range* range;
02255 BitSetData* support;
02256
02258 Tuple add(void);
02260 Tuple get(int i) const;
02262 static void set(BitSetData* d, unsigned int n);
02264 static bool get(const BitSetData* d, unsigned int n);
02266 unsigned int tuple2idx(Tuple t) const;
02268 const Range* fst(int i) const;
02270 const Range* lst(int i) const;
02272 GECODE_INT_EXPORT
02273 void finalize(void);
02275 GECODE_INT_EXPORT
02276 void resize(void);
02278 bool finalized(void) const;
02280 Data(int a);
02282 GECODE_INT_EXPORT
02283 virtual ~Data(void);
02284 };
02285
02287 Data& data(void) const;
02289 Data& raw(void) const;
02291 GECODE_INT_EXPORT
02292 void _add(const IntArgs& t);
02294 GECODE_INT_EXPORT
02295 bool equal(const TupleSet& t) const;
02296 public:
02298
02299
02300 TupleSet(void);
02302 GECODE_INT_EXPORT
02303 TupleSet(int a);
02305 GECODE_INT_EXPORT
02306 void init(int a);
02308 GECODE_INT_EXPORT
02309 TupleSet(const TupleSet& t);
02311 GECODE_INT_EXPORT
02312 TupleSet& operator =(const TupleSet& t);
02314 GECODE_INT_EXPORT
02315 TupleSet(int a, const DFA& dfa);
02317 operator bool(void) const;
02319 bool operator ==(const TupleSet& t) const;
02321 bool operator !=(const TupleSet& t) const;
02323
02325
02326
02327 TupleSet& add(const IntArgs& t);
02329 bool finalized(void) const;
02331 void finalize(void);
02333
02335
02336
02337 int arity(void) const;
02339 int tuples(void) const;
02341 unsigned int words(void) const;
02343 Tuple operator [](int i) const;
02345 int min(void) const;
02347 int max(void) const;
02349 std::size_t hash(void) const;
02351
02353
02354
02355 const Range* fst(int i) const;
02357 const Range* lst(int i) const;
02359 class Ranges {
02360 protected:
02362 const Range* c;
02364 const Range* l;
02365 public:
02367
02368
02369 Ranges(const TupleSet& ts, int i);
02371
02373
02374
02375 bool operator ()(void) const;
02377 void operator ++(void);
02379
02381
02382
02383 int min(void) const;
02385 int max(void) const;
02387 unsigned int width(void) const;
02389 };
02391 };
02392
02393 }
02394
02395 #include <gecode/int/extensional/tuple-set.hpp>
02396
02397 namespace Gecode {
02398
02411 GECODE_INT_EXPORT void
02412 extensional(Home home, const IntVarArgs& x, DFA d,
02413 IntPropLevel ipl=IPL_DEF);
02414
02427 GECODE_INT_EXPORT void
02428 extensional(Home home, const BoolVarArgs& x, DFA d,
02429 IntPropLevel ipl=IPL_DEF);
02430
02441 void
02442 extensional(Home home, const IntVarArgs& x, const TupleSet& t,
02443 IntPropLevel ipl=IPL_DEF);
02444
02457 GECODE_INT_EXPORT void
02458 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
02459 IntPropLevel ipl=IPL_DEF);
02460
02471 void
02472 extensional(Home home, const IntVarArgs& x, const TupleSet& t, Reify r,
02473 IntPropLevel ipl=IPL_DEF);
02474
02487 GECODE_INT_EXPORT void
02488 extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
02489 Reify r,
02490 IntPropLevel ipl=IPL_DEF);
02491
02502 void
02503 extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
02504 IntPropLevel ipl=IPL_DEF);
02505
02518 GECODE_INT_EXPORT void
02519 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
02520 IntPropLevel ipl=IPL_DEF);
02521
02532 void
02533 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, Reify r,
02534 IntPropLevel ipl=IPL_DEF);
02535
02548 GECODE_INT_EXPORT void
02549 extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
02550 Reify r,
02551 IntPropLevel ipl=IPL_DEF);
02552
02553 }
02554
02555 #include <gecode/int/extensional.hpp>
02556
02557 namespace Gecode {
02558
02570 GECODE_INT_EXPORT void
02571 min(Home home, IntVar x0, IntVar x1, IntVar x2,
02572 IntPropLevel ipl=IPL_DEF);
02580 GECODE_INT_EXPORT void
02581 min(Home home, const IntVarArgs& x, IntVar y,
02582 IntPropLevel ipl=IPL_DEF);
02588 GECODE_INT_EXPORT void
02589 max(Home home, IntVar x0, IntVar x1, IntVar x2,
02590 IntPropLevel ipl=IPL_DEF);
02598 GECODE_INT_EXPORT void
02599 max(Home home, const IntVarArgs& x, IntVar y,
02600 IntPropLevel ipl=IPL_DEF);
02601
02611 GECODE_INT_EXPORT void
02612 argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02613 IntPropLevel ipl=IPL_DEF);
02623 GECODE_INT_EXPORT void
02624 argmin(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02625 IntPropLevel ipl=IPL_DEF);
02635 GECODE_INT_EXPORT void
02636 argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02637 IntPropLevel ipl=IPL_DEF);
02647 GECODE_INT_EXPORT void
02648 argmax(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02649 IntPropLevel ipl=IPL_DEF);
02659 GECODE_INT_EXPORT void
02660 argmin(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
02661 IntPropLevel ipl=IPL_DEF);
02671 GECODE_INT_EXPORT void
02672 argmin(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
02673 IntPropLevel ipl=IPL_DEF);
02683 GECODE_INT_EXPORT void
02684 argmax(Home home, const BoolVarArgs& x, IntVar y, bool tiebreak=true,
02685 IntPropLevel ipl=IPL_DEF);
02695 GECODE_INT_EXPORT void
02696 argmax(Home home, const BoolVarArgs& x, int o, IntVar y, bool tiebreak=true,
02697 IntPropLevel ipl=IPL_DEF);
02698
02704 GECODE_INT_EXPORT void
02705 abs(Home home, IntVar x0, IntVar x1,
02706 IntPropLevel ipl=IPL_DEF);
02707
02713 GECODE_INT_EXPORT void
02714 mult(Home home, IntVar x0, IntVar x1, IntVar x2,
02715 IntPropLevel ipl=IPL_DEF);
02716
02721 GECODE_INT_EXPORT void
02722 divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
02723 IntPropLevel ipl=IPL_DEF);
02724
02729 GECODE_INT_EXPORT void
02730 div(Home home, IntVar x0, IntVar x1, IntVar x2,
02731 IntPropLevel ipl=IPL_DEF);
02732
02737 GECODE_INT_EXPORT void
02738 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
02739 IntPropLevel ipl=IPL_DEF);
02740
02746 GECODE_INT_EXPORT void
02747 sqr(Home home, IntVar x0, IntVar x1,
02748 IntPropLevel ipl=IPL_DEF);
02749
02755 GECODE_INT_EXPORT void
02756 sqrt(Home home, IntVar x0, IntVar x1,
02757 IntPropLevel ipl=IPL_DEF);
02758
02767 GECODE_INT_EXPORT void
02768 pow(Home home, IntVar x0, int n, IntVar x1,
02769 IntPropLevel ipl=IPL_DEF);
02770
02779 GECODE_INT_EXPORT void
02780 nroot(Home home, IntVar x0, int n, IntVar x1,
02781 IntPropLevel ipl=IPL_DEF);
02782
02784
02820 GECODE_INT_EXPORT void
02821 linear(Home home, const IntVarArgs& x,
02822 IntRelType irt, int c,
02823 IntPropLevel ipl=IPL_DEF);
02827 GECODE_INT_EXPORT void
02828 linear(Home home, const IntVarArgs& x,
02829 IntRelType irt, IntVar y,
02830 IntPropLevel ipl=IPL_DEF);
02834 GECODE_INT_EXPORT void
02835 linear(Home home, const IntVarArgs& x,
02836 IntRelType irt, int c, Reify r,
02837 IntPropLevel ipl=IPL_DEF);
02841 GECODE_INT_EXPORT void
02842 linear(Home home, const IntVarArgs& x,
02843 IntRelType irt, IntVar y, Reify r,
02844 IntPropLevel ipl=IPL_DEF);
02851 GECODE_INT_EXPORT void
02852 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02853 IntRelType irt, int c,
02854 IntPropLevel ipl=IPL_DEF);
02861 GECODE_INT_EXPORT void
02862 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02863 IntRelType irt, IntVar y,
02864 IntPropLevel ipl=IPL_DEF);
02871 GECODE_INT_EXPORT void
02872 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02873 IntRelType irt, int c, Reify r,
02874 IntPropLevel ipl=IPL_DEF);
02881 GECODE_INT_EXPORT void
02882 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02883 IntRelType irt, IntVar y, Reify r,
02884 IntPropLevel ipl=IPL_DEF);
02885
02886
02914 GECODE_INT_EXPORT void
02915 linear(Home home, const BoolVarArgs& x,
02916 IntRelType irt, int c,
02917 IntPropLevel ipl=IPL_DEF);
02921 GECODE_INT_EXPORT void
02922 linear(Home home, const BoolVarArgs& x,
02923 IntRelType irt, int c, Reify r,
02924 IntPropLevel ipl=IPL_DEF);
02928 GECODE_INT_EXPORT void
02929 linear(Home home, const BoolVarArgs& x,
02930 IntRelType irt, IntVar y,
02931 IntPropLevel ipl=IPL_DEF);
02935 GECODE_INT_EXPORT void
02936 linear(Home home, const BoolVarArgs& x,
02937 IntRelType irt, IntVar y, Reify r,
02938 IntPropLevel ipl=IPL_DEF);
02945 GECODE_INT_EXPORT void
02946 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02947 IntRelType irt, int c,
02948 IntPropLevel ipl=IPL_DEF);
02955 GECODE_INT_EXPORT void
02956 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02957 IntRelType irt, int c, Reify r,
02958 IntPropLevel ipl=IPL_DEF);
02965 GECODE_INT_EXPORT void
02966 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02967 IntRelType irt, IntVar y,
02968 IntPropLevel ipl=IPL_DEF);
02975 GECODE_INT_EXPORT void
02976 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02977 IntRelType irt, IntVar y, Reify r,
02978 IntPropLevel ipl=IPL_DEF);
02979
02980
03007 GECODE_INT_EXPORT void
03008 binpacking(Home home,
03009 const IntVarArgs& l,
03010 const IntVarArgs& b, const IntArgs& s,
03011 IntPropLevel ipl=IPL_DEF);
03012
03013
03014
03015
03016
03017
03018
03019
03020
03021
03022
03023
03024
03025
03026
03027
03028
03029
03030
03031
03032
03033
03034
03035
03036
03037
03038
03039
03040
03041
03042
03043
03044
03045
03046
03047
03048
03049
03050 GECODE_INT_EXPORT IntSet
03051 binpacking(Home home, int d,
03052 const IntVarArgs& l, const IntVarArgs& b,
03053 const IntArgs& s, const IntArgs& c,
03054 IntPropLevel ipl=IPL_DEF);
03055
03056
03075 GECODE_INT_EXPORT void
03076 nooverlap(Home home,
03077 const IntVarArgs& x, const IntArgs& w,
03078 const IntVarArgs& y, const IntArgs& h,
03079 IntPropLevel ipl=IPL_DEF);
03093 GECODE_INT_EXPORT void
03094 nooverlap(Home home,
03095 const IntVarArgs& x, const IntArgs& w,
03096 const IntVarArgs& y, const IntArgs& h,
03097 const BoolVarArgs& o,
03098 IntPropLevel ipl=IPL_DEF);
03115 GECODE_INT_EXPORT void
03116 nooverlap(Home home,
03117 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
03118 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
03119 IntPropLevel ipl=IPL_DEF);
03137 GECODE_INT_EXPORT void
03138 nooverlap(Home home,
03139 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
03140 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
03141 const BoolVarArgs& o,
03142 IntPropLevel ipl=IPL_DEF);
03143
03144
03150
03161 GECODE_INT_EXPORT void
03162 order(Home home, IntVar s0, int p0, IntVar s1, int p1, BoolVar b,
03163 IntPropLevel ipl=IPL_DEF);
03164
03207 GECODE_INT_EXPORT void
03208 cumulatives(Home home, const IntVarArgs& m,
03209 const IntVarArgs& s, const IntVarArgs& p,
03210 const IntVarArgs& e, const IntVarArgs& u,
03211 const IntArgs& c, bool at_most,
03212 IntPropLevel ipl=IPL_DEF);
03217 GECODE_INT_EXPORT void
03218 cumulatives(Home home, const IntArgs& m,
03219 const IntVarArgs& s, const IntVarArgs& p,
03220 const IntVarArgs& e, const IntVarArgs& u,
03221 const IntArgs& c, bool at_most,
03222 IntPropLevel ipl=IPL_DEF);
03227 GECODE_INT_EXPORT void
03228 cumulatives(Home home, const IntVarArgs& m,
03229 const IntVarArgs& s, const IntArgs& p,
03230 const IntVarArgs& e, const IntVarArgs& u,
03231 const IntArgs& c, bool at_most,
03232 IntPropLevel ipl=IPL_DEF);
03237 GECODE_INT_EXPORT void
03238 cumulatives(Home home, const IntArgs& m,
03239 const IntVarArgs& s, const IntArgs& p,
03240 const IntVarArgs& e, const IntVarArgs& u,
03241 const IntArgs& c, bool at_most,
03242 IntPropLevel ipl=IPL_DEF);
03247 GECODE_INT_EXPORT void
03248 cumulatives(Home home, const IntVarArgs& m,
03249 const IntVarArgs& s, const IntVarArgs& p,
03250 const IntVarArgs& e, const IntArgs& u,
03251 const IntArgs& c, bool at_most,
03252 IntPropLevel ipl=IPL_DEF);
03257 GECODE_INT_EXPORT void
03258 cumulatives(Home home, const IntArgs& m,
03259 const IntVarArgs& s, const IntVarArgs& p,
03260 const IntVarArgs& e, const IntArgs& u,
03261 const IntArgs& c, bool at_most,
03262 IntPropLevel ipl=IPL_DEF);
03267 GECODE_INT_EXPORT void
03268 cumulatives(Home home, const IntVarArgs& m,
03269 const IntVarArgs& s, const IntArgs& p,
03270 const IntVarArgs& e, const IntArgs& u,
03271 const IntArgs& c, bool at_most,
03272 IntPropLevel ipl=IPL_DEF);
03277 GECODE_INT_EXPORT void
03278 cumulatives(Home home, const IntArgs& m,
03279 const IntVarArgs& s, const IntArgs& p,
03280 const IntVarArgs& e, const IntArgs& u,
03281 const IntArgs& c, bool at_most,
03282 IntPropLevel ipl=IPL_DEF);
03283
03310 GECODE_INT_EXPORT void
03311 unary(Home home, const IntVarArgs& s, const IntArgs& p,
03312 IntPropLevel ipl=IPL_DEF);
03313
03342 GECODE_INT_EXPORT void
03343 unary(Home home, const IntVarArgs& s, const IntArgs& p,
03344 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03345
03382 GECODE_INT_EXPORT void
03383 unary(Home home, const TaskTypeArgs& t,
03384 const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl=IPL_DEF);
03385
03424 GECODE_INT_EXPORT void
03425 unary(Home home, const TaskTypeArgs& t,
03426 const IntVarArgs& flex, const IntArgs& fix,
03427 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03428
03455 GECODE_INT_EXPORT void
03456 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03457 const IntVarArgs& e, IntPropLevel ipl=IPL_DEF);
03458
03487 GECODE_INT_EXPORT void
03488 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03489 const IntVarArgs& e, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03490
03491
03492
03535 GECODE_INT_EXPORT void
03536 cumulative(Home home, int c, const TaskTypeArgs& t,
03537 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03538 IntPropLevel ipl=IPL_DEF);
03539
03540
03545 GECODE_INT_EXPORT void
03546 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03547 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03548 IntPropLevel ipl=IPL_DEF);
03549
03594 GECODE_INT_EXPORT void
03595 cumulative(Home home, int c, const TaskTypeArgs& t,
03596 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03597 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03598
03602 GECODE_INT_EXPORT void
03603 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03604 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03605 const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03606
03639 GECODE_INT_EXPORT void
03640 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03641 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03642
03646 GECODE_INT_EXPORT void
03647 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03648 const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03649
03684 GECODE_INT_EXPORT void
03685 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03686 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03687
03691 GECODE_INT_EXPORT void
03692 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03693 const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03694
03731 GECODE_INT_EXPORT void
03732 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03733 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03734
03738 GECODE_INT_EXPORT void
03739 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03740 const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03741
03780 GECODE_INT_EXPORT void
03781 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03782 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03783 IntPropLevel ipl=IPL_DEF);
03784
03788 GECODE_INT_EXPORT void
03789 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03790 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03791 IntPropLevel ipl=IPL_DEF);
03793
03794
03814 GECODE_INT_EXPORT void
03815 circuit(Home home, const IntVarArgs& x,
03816 IntPropLevel ipl=IPL_DEF);
03832 GECODE_INT_EXPORT void
03833 circuit(Home home, int offset, const IntVarArgs& x,
03834 IntPropLevel ipl=IPL_DEF);
03856 GECODE_INT_EXPORT void
03857 circuit(Home home,
03858 const IntArgs& c,
03859 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03860 IntPropLevel ipl=IPL_DEF);
03883 GECODE_INT_EXPORT void
03884 circuit(Home home,
03885 const IntArgs& c, int offset,
03886 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03887 IntPropLevel ipl=IPL_DEF);
03906 GECODE_INT_EXPORT void
03907 circuit(Home home,
03908 const IntArgs& c,
03909 const IntVarArgs& x, IntVar z,
03910 IntPropLevel ipl=IPL_DEF);
03931 GECODE_INT_EXPORT void
03932 circuit(Home home,
03933 const IntArgs& c, int offset,
03934 const IntVarArgs& x, IntVar z,
03935 IntPropLevel ipl=IPL_DEF);
03951 GECODE_INT_EXPORT void
03952 path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
03953 IntPropLevel ipl=IPL_DEF);
03971 GECODE_INT_EXPORT void
03972 path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
03973 IntPropLevel ipl=IPL_DEF);
03996 GECODE_INT_EXPORT void
03997 path(Home home,
03998 const IntArgs& c,
03999 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
04000 IntPropLevel ipl=IPL_DEF);
04025 GECODE_INT_EXPORT void
04026 path(Home home,
04027 const IntArgs& c, int offset,
04028 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
04029 IntPropLevel ipl=IPL_DEF);
04050 GECODE_INT_EXPORT void
04051 path(Home home,
04052 const IntArgs& c,
04053 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
04054 IntPropLevel ipl=IPL_DEF);
04077 GECODE_INT_EXPORT void
04078 path(Home home,
04079 const IntArgs& c, int offset,
04080 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
04081 IntPropLevel ipl=IPL_DEF);
04083
04084
04085
04094
04095 GECODE_INT_EXPORT void
04096 wait(Home home, IntVar x, std::function<void(Space& home)> c,
04097 IntPropLevel ipl=IPL_DEF);
04099 GECODE_INT_EXPORT void
04100 wait(Home home, BoolVar x, std::function<void(Space& home)> c,
04101 IntPropLevel ipl=IPL_DEF);
04103 GECODE_INT_EXPORT void
04104 wait(Home home, const IntVarArgs& x, std::function<void(Space& home)> c,
04105 IntPropLevel ipl=IPL_DEF);
04107 GECODE_INT_EXPORT void
04108 wait(Home home, const BoolVarArgs& x,
04109 std::function<void(Space& home)> c,
04110 IntPropLevel ipl=IPL_DEF);
04112 GECODE_INT_EXPORT void
04113 when(Home home, BoolVar x,
04114 std::function<void(Space& home)> t,
04115 std::function<void(Space& home)> e,
04116 IntPropLevel ipl=IPL_DEF);
04118 GECODE_INT_EXPORT void
04119 when(Home home, BoolVar x,
04120 std::function<void(Space& home)> t,
04121 IntPropLevel ipl=IPL_DEF);
04123
04124
04149 GECODE_INT_EXPORT void
04150 unshare(Home home, IntVarArgs& x,
04151 IntPropLevel ipl=IPL_DEF);
04153 GECODE_INT_EXPORT void
04154 unshare(Home home, BoolVarArgs& x,
04155 IntPropLevel ipl=IPL_DEF);
04157
04158 }
04159
04160 namespace Gecode {
04161
04175 typedef std::function<bool(const Space& home, IntVar x, int i)>
04176 IntBranchFilter;
04185 typedef std::function<bool(const Space& home, BoolVar x, int i)>
04186 BoolBranchFilter;
04187
04197 typedef std::function<double(const Space& home, IntVar x, int i)>
04198 IntBranchMerit;
04208 typedef std::function<double(const Space& home, BoolVar x, int i)>
04209 BoolBranchMerit;
04210
04221 typedef std::function<int(const Space& home, IntVar x, int i)>
04222 IntBranchVal;
04233 typedef std::function<int(const Space& home, BoolVar x, int i)>
04234 BoolBranchVal;
04235
04247 typedef std::function<void(Space& home, unsigned int a,
04248 IntVar x, int i, int n)>
04249 IntBranchCommit;
04261 typedef std::function<void(Space& home, unsigned int a,
04262 BoolVar x, int i, int n)>
04263 BoolBranchCommit;
04264
04265 }
04266
04267 #include <gecode/int/branch/traits.hpp>
04268
04269 namespace Gecode {
04270
04276 class IntAFC : public AFC {
04277 public:
04285 IntAFC(void);
04287 IntAFC(const IntAFC& a);
04289 IntAFC& operator =(const IntAFC& a);
04297 IntAFC(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04308 void init(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04309 };
04310
04316 class BoolAFC : public AFC {
04317 public:
04325 BoolAFC(void);
04327 BoolAFC(const BoolAFC& a);
04329 BoolAFC& operator =(const BoolAFC& a);
04337 BoolAFC(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04348 void init(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04349 };
04350
04351 }
04352
04353 #include <gecode/int/branch/afc.hpp>
04354
04355 namespace Gecode {
04356
04362 class IntAction : public Action {
04363 public:
04371 IntAction(void);
04373 IntAction(const IntAction& a);
04375 IntAction& operator =(const IntAction& a);
04383 GECODE_INT_EXPORT
04384 IntAction(Home home, const IntVarArgs& x, double d=1.0,
04385 IntBranchMerit bm=nullptr);
04397 GECODE_INT_EXPORT void
04398 init(Home home, const IntVarArgs& x, double d=1.0,
04399 IntBranchMerit bm=nullptr);
04400 };
04401
04407 class BoolAction : public Action {
04408 public:
04416 BoolAction(void);
04418 BoolAction(const BoolAction& a);
04420 BoolAction& operator =(const BoolAction& a);
04428 GECODE_INT_EXPORT
04429 BoolAction(Home home, const BoolVarArgs& x, double d=1.0,
04430 BoolBranchMerit bm=nullptr);
04442 GECODE_INT_EXPORT void
04443 init(Home home, const BoolVarArgs& x, double d=1.0,
04444 BoolBranchMerit bm=nullptr);
04445 };
04446
04447 }
04448
04449 #include <gecode/int/branch/action.hpp>
04450
04451 namespace Gecode {
04452
04458 class IntCHB : public CHB {
04459 public:
04467 IntCHB(void);
04469 IntCHB(const IntCHB& chb);
04471 IntCHB& operator =(const IntCHB& chb);
04480 GECODE_INT_EXPORT
04481 IntCHB(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04493 GECODE_INT_EXPORT void
04494 init(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04495 };
04496
04502 class BoolCHB : public CHB {
04503 public:
04511 BoolCHB(void);
04513 BoolCHB(const BoolCHB& chb);
04515 BoolCHB& operator =(const BoolCHB& chb);
04524 GECODE_INT_EXPORT
04525 BoolCHB(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04537 GECODE_INT_EXPORT void
04538 init(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04539 };
04540
04541 }
04542
04543 #include <gecode/int/branch/chb.hpp>
04544
04545 namespace Gecode {
04546
04548 typedef std::function<void(const Space &home, const Brancher& b,
04549 unsigned int a,
04550 IntVar x, int i, const int& n,
04551 std::ostream& o)>
04552 IntVarValPrint;
04553
04555 typedef std::function<void(const Space &home, const Brancher& b,
04556 unsigned int a,
04557 BoolVar x, int i, const int& n,
04558 std::ostream& o)>
04559 BoolVarValPrint;
04560
04561 }
04562
04563 namespace Gecode {
04564
04570 class IntVarBranch : public VarBranch<IntVar> {
04571 public:
04573 enum Select {
04574 SEL_NONE = 0,
04575 SEL_RND,
04576 SEL_MERIT_MIN,
04577 SEL_MERIT_MAX,
04578 SEL_DEGREE_MIN,
04579 SEL_DEGREE_MAX,
04580 SEL_AFC_MIN,
04581 SEL_AFC_MAX,
04582 SEL_ACTION_MIN,
04583 SEL_ACTION_MAX,
04584 SEL_CHB_MIN,
04585 SEL_CHB_MAX,
04586 SEL_MIN_MIN,
04587 SEL_MIN_MAX,
04588 SEL_MAX_MIN,
04589 SEL_MAX_MAX,
04590 SEL_SIZE_MIN,
04591 SEL_SIZE_MAX,
04592 SEL_DEGREE_SIZE_MIN,
04593 SEL_DEGREE_SIZE_MAX,
04594 SEL_AFC_SIZE_MIN,
04595 SEL_AFC_SIZE_MAX,
04596 SEL_ACTION_SIZE_MIN,
04597 SEL_ACTION_SIZE_MAX,
04598 SEL_CHB_SIZE_MIN,
04599 SEL_CHB_SIZE_MAX,
04600
04605 SEL_REGRET_MIN_MIN,
04611 SEL_REGRET_MIN_MAX,
04617 SEL_REGRET_MAX_MIN,
04623 SEL_REGRET_MAX_MAX
04624 };
04625 protected:
04627 Select s;
04628 public:
04630 IntVarBranch(void);
04632 IntVarBranch(Rnd r);
04634 IntVarBranch(Select s, BranchTbl t);
04636 IntVarBranch(Select s, double d, BranchTbl t);
04638 IntVarBranch(Select s, IntAFC a, BranchTbl t);
04640 IntVarBranch(Select s, IntAction a, BranchTbl t);
04642 IntVarBranch(Select s, IntCHB c, BranchTbl t);
04644 IntVarBranch(Select s, IntBranchMerit mf, BranchTbl t);
04646 Select select(void) const;
04648 void expand(Home home, const IntVarArgs& x);
04649 };
04650
04656 class BoolVarBranch : public VarBranch<BoolVar> {
04657 public:
04659 enum Select {
04660 SEL_NONE = 0,
04661 SEL_RND,
04662 SEL_MERIT_MIN,
04663 SEL_MERIT_MAX,
04664 SEL_DEGREE_MIN,
04665 SEL_DEGREE_MAX,
04666 SEL_AFC_MIN,
04667 SEL_AFC_MAX,
04668 SEL_ACTION_MIN,
04669 SEL_ACTION_MAX,
04670 SEL_CHB_MIN,
04671 SEL_CHB_MAX
04672 };
04673 protected:
04675 Select s;
04676 public:
04678 BoolVarBranch(void);
04680 BoolVarBranch(Rnd r);
04682 BoolVarBranch(Select s, BranchTbl t);
04684 BoolVarBranch(Select s, double d, BranchTbl t);
04686 BoolVarBranch(Select s, BoolAFC a, BranchTbl t);
04688 BoolVarBranch(Select s, BoolAction a, BranchTbl t);
04690 BoolVarBranch(Select s, BoolCHB c, BranchTbl t);
04692 BoolVarBranch(Select s, BoolBranchMerit mf, BranchTbl t);
04694 Select select(void) const;
04696 void expand(Home home, const BoolVarArgs& x);
04697 };
04698
04704
04705 IntVarBranch INT_VAR_NONE(void);
04707 IntVarBranch INT_VAR_RND(Rnd r);
04709 IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=nullptr);
04711 IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=nullptr);
04713 IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04715 IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04717 IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04719 IntVarBranch INT_VAR_AFC_MIN(IntAFC a, BranchTbl tbl=nullptr);
04721 IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04723 IntVarBranch INT_VAR_AFC_MAX(IntAFC a, BranchTbl tbl=nullptr);
04725 IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04727 IntVarBranch INT_VAR_ACTION_MIN(IntAction a, BranchTbl tbl=nullptr);
04729 IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04731 IntVarBranch INT_VAR_ACTION_MAX(IntAction a, BranchTbl tbl=nullptr);
04733 IntVarBranch INT_VAR_CHB_MIN(IntCHB c, BranchTbl tbl=nullptr);
04735 IntVarBranch INT_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04737 IntVarBranch INT_VAR_CHB_MAX(IntCHB c, BranchTbl tbl=nullptr);
04739 IntVarBranch INT_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04741 IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=nullptr);
04743 IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=nullptr);
04745 IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=nullptr);
04747 IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=nullptr);
04749 IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr);
04751 IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=nullptr);
04753 IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr);
04755 IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr);
04757 IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04759 IntVarBranch INT_VAR_AFC_SIZE_MIN(IntAFC a, BranchTbl tbl=nullptr);
04761 IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04763 IntVarBranch INT_VAR_AFC_SIZE_MAX(IntAFC a, BranchTbl tbl=nullptr);
04765 IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04767 IntVarBranch INT_VAR_ACTION_SIZE_MIN(IntAction a, BranchTbl tbl=nullptr);
04769 IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04771 IntVarBranch INT_VAR_ACTION_SIZE_MAX(IntAction a, BranchTbl tbl=nullptr);
04773 IntVarBranch INT_VAR_CHB_SIZE_MIN(IntCHB c, BranchTbl tbl=nullptr);
04775 IntVarBranch INT_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr);
04777 IntVarBranch INT_VAR_CHB_SIZE_MAX(IntCHB c, BranchTbl tbl=nullptr);
04779 IntVarBranch INT_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr);
04785 IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=nullptr);
04791 IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=nullptr);
04797 IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=nullptr);
04803 IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=nullptr);
04804
04806 BoolVarBranch BOOL_VAR_NONE(void);
04808 BoolVarBranch BOOL_VAR_RND(Rnd r);
04810 BoolVarBranch BOOL_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04812 BoolVarBranch BOOL_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04814 BoolVarBranch BOOL_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04816 BoolVarBranch BOOL_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04818 BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04820 BoolVarBranch BOOL_VAR_AFC_MIN(BoolAFC a, BranchTbl tbl=nullptr);
04822 BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04824 BoolVarBranch BOOL_VAR_AFC_MAX(BoolAFC a, BranchTbl tbl=nullptr);
04826 BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04828 BoolVarBranch BOOL_VAR_ACTION_MIN(BoolAction a, BranchTbl tbl=nullptr);
04830 BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04832 BoolVarBranch BOOL_VAR_ACTION_MAX(BoolAction a, BranchTbl tbl=nullptr);
04834 BoolVarBranch BOOL_VAR_CHB_MIN(BoolCHB c, BranchTbl tbl=nullptr);
04836 BoolVarBranch BOOL_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04838 BoolVarBranch BOOL_VAR_CHB_MAX(BoolCHB c, BranchTbl tbl=nullptr);
04840 BoolVarBranch BOOL_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04842
04843 }
04844
04845 #include <gecode/int/branch/var.hpp>
04846
04847 namespace Gecode {
04848
04854 class IntValBranch : public ValBranch<IntVar> {
04855 public:
04857 enum Select {
04858 SEL_MIN,
04859 SEL_MED,
04860 SEL_MAX,
04861 SEL_RND,
04862 SEL_SPLIT_MIN,
04863 SEL_SPLIT_MAX,
04864 SEL_RANGE_MIN,
04865 SEL_RANGE_MAX,
04866 SEL_VAL_COMMIT,
04867 SEL_VALUES_MIN,
04868 SEL_VALUES_MAX
04869 };
04870 protected:
04872 Select s;
04873 public:
04875 IntValBranch(Select s = SEL_MIN);
04877 IntValBranch(Rnd r);
04879 IntValBranch(IntBranchVal v, IntBranchCommit c);
04881 Select select(void) const;
04882 };
04883
04889 class BoolValBranch : public ValBranch<BoolVar> {
04890 public:
04892 enum Select {
04893 SEL_MIN,
04894 SEL_MAX,
04895 SEL_RND,
04896 SEL_VAL_COMMIT
04897 };
04898 protected:
04900 Select s;
04901 public:
04903 BoolValBranch(Select s = SEL_MIN);
04905 BoolValBranch(Rnd r);
04907 BoolValBranch(BoolBranchVal v, BoolBranchCommit c);
04909 Select select(void) const;
04910 };
04911
04917
04918 IntValBranch INT_VAL_MIN(void);
04920 IntValBranch INT_VAL_MED(void);
04922 IntValBranch INT_VAL_MAX(void);
04924 IntValBranch INT_VAL_RND(Rnd r);
04926 IntValBranch INT_VAL_SPLIT_MIN(void);
04928 IntValBranch INT_VAL_SPLIT_MAX(void);
04930 IntValBranch INT_VAL_RANGE_MIN(void);
04932 IntValBranch INT_VAL_RANGE_MAX(void);
04939 IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=nullptr);
04941 IntValBranch INT_VALUES_MIN(void);
04943 IntValBranch INT_VALUES_MAX(void);
04944
04946 BoolValBranch BOOL_VAL_MIN(void);
04948 BoolValBranch BOOL_VAL_MAX(void);
04950 BoolValBranch BOOL_VAL_RND(Rnd r);
04957 BoolValBranch BOOL_VAL(BoolBranchVal v, BoolBranchCommit c=nullptr);
04959
04960 }
04961
04962 #include <gecode/int/branch/val.hpp>
04963
04964 namespace Gecode {
04965
04971 class IntAssign : public ValBranch<IntVar> {
04972 public:
04974 enum Select {
04975 SEL_MIN,
04976 SEL_MED,
04977 SEL_MAX,
04978 SEL_RND,
04979 SEL_VAL_COMMIT
04980 };
04981 protected:
04983 Select s;
04984 public:
04986 IntAssign(Select s = SEL_MIN);
04988 IntAssign(Rnd r);
04990 IntAssign(IntBranchVal v, IntBranchCommit c);
04992 Select select(void) const;
04993 };
04994
05000 class BoolAssign : public ValBranch<BoolVar> {
05001 public:
05003 enum Select {
05004 SEL_MIN,
05005 SEL_MAX,
05006 SEL_RND,
05007 SEL_VAL_COMMIT
05008 };
05009 protected:
05011 Select s;
05012 public:
05014 BoolAssign(Select s = SEL_MIN);
05016 BoolAssign(Rnd r);
05018 BoolAssign(BoolBranchVal v, BoolBranchCommit c);
05020 Select select(void) const;
05021 };
05022
05028
05029 IntAssign INT_ASSIGN_MIN(void);
05031 IntAssign INT_ASSIGN_MED(void);
05033 IntAssign INT_ASSIGN_MAX(void);
05035 IntAssign INT_ASSIGN_RND(Rnd r);
05042 IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=nullptr);
05043
05045 BoolAssign BOOL_ASSIGN_MIN(void);
05047 BoolAssign BOOL_ASSIGN_MAX(void);
05049 BoolAssign BOOL_ASSIGN_RND(Rnd r);
05056 BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c=nullptr);
05058
05059 }
05060
05061 #include <gecode/int/branch/assign.hpp>
05062
05063 namespace Gecode {
05064
05070 GECODE_INT_EXPORT void
05071 branch(Home home, const IntVarArgs& x,
05072 IntVarBranch vars, IntValBranch vals,
05073 IntBranchFilter bf=nullptr,
05074 IntVarValPrint vvp=nullptr);
05080 GECODE_INT_EXPORT void
05081 branch(Home home, const IntVarArgs& x,
05082 TieBreak<IntVarBranch> vars, IntValBranch vals,
05083 IntBranchFilter bf=nullptr,
05084 IntVarValPrint vvp=nullptr);
05090 GECODE_INT_EXPORT void
05091 branch(Home home, IntVar x, IntValBranch vals,
05092 IntVarValPrint vvp=nullptr);
05098 GECODE_INT_EXPORT void
05099 branch(Home home, const BoolVarArgs& x,
05100 BoolVarBranch vars, BoolValBranch vals,
05101 BoolBranchFilter bf=nullptr,
05102 BoolVarValPrint vvp=nullptr);
05108 GECODE_INT_EXPORT void
05109 branch(Home home, const BoolVarArgs& x,
05110 TieBreak<BoolVarBranch> vars, BoolValBranch vals,
05111 BoolBranchFilter bf=nullptr,
05112 BoolVarValPrint vvp=nullptr);
05118 GECODE_INT_EXPORT void
05119 branch(Home home, BoolVar x, BoolValBranch vals,
05120 BoolVarValPrint vvp=nullptr);
05121
05127 GECODE_INT_EXPORT void
05128 assign(Home home, const IntVarArgs& x,
05129 IntVarBranch vars, IntAssign vals,
05130 IntBranchFilter bf=nullptr,
05131 IntVarValPrint vvp=nullptr);
05137 GECODE_INT_EXPORT void
05138 assign(Home home, const IntVarArgs& x,
05139 TieBreak<IntVarBranch> vars, IntAssign vals,
05140 IntBranchFilter bf=nullptr,
05141 IntVarValPrint vvp=nullptr);
05147 GECODE_INT_EXPORT void
05148 assign(Home home, IntVar x, IntAssign vals,
05149 IntVarValPrint vvp=nullptr);
05155 GECODE_INT_EXPORT void
05156 assign(Home home, const BoolVarArgs& x,
05157 BoolVarBranch vars, BoolAssign vals,
05158 BoolBranchFilter bf=nullptr,
05159 BoolVarValPrint vvp=nullptr);
05165 GECODE_INT_EXPORT void
05166 assign(Home home, const BoolVarArgs& x,
05167 TieBreak<BoolVarBranch> vars, BoolAssign vals,
05168 IntBranchFilter bf=nullptr,
05169 IntVarValPrint vvp=nullptr);
05175 GECODE_INT_EXPORT void
05176 assign(Home home, BoolVar x, BoolAssign vals,
05177 BoolVarValPrint vvp=nullptr);
05178
05179 }
05180
05181 namespace Gecode {
05182
05188 void
05189 branch(Home home, const IntVarArgs& x, IntValBranch vals,
05190 IntBranchFilter bf=nullptr,
05191 IntVarValPrint vvp=nullptr);
05197 void
05198 branch(Home home, const BoolVarArgs& x, BoolValBranch vals,
05199 BoolBranchFilter bf=nullptr,
05200 BoolVarValPrint vvp=nullptr);
05201
05207 void
05208 assign(Home home, const IntVarArgs& x, IntAssign vals,
05209 IntBranchFilter bf=nullptr,
05210 IntVarValPrint vvp=nullptr);
05216 void
05217 assign(Home home, const BoolVarArgs& x, BoolAssign vals,
05218 BoolBranchFilter bf=nullptr,
05219 BoolVarValPrint vvp=nullptr);
05220
05221 }
05222
05223 #include <gecode/int/branch.hpp>
05224
05225 namespace Gecode {
05226
05230 template<class Char, class Traits>
05231 std::basic_ostream<Char,Traits>&
05232 operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
05233
05237 template<class Char, class Traits>
05238 std::basic_ostream<Char,Traits>&
05239 operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
05240
05241 }
05242
05243
05244 namespace Gecode {
05245
05246 namespace Int { namespace LDSB {
05247 class SymmetryObject;
05248 }}
05249
05255 class GECODE_INT_EXPORT SymmetryHandle {
05256 public:
05258 Int::LDSB::SymmetryObject* ref;
05260 void increment(void);
05262 void decrement(void);
05263 public:
05265 SymmetryHandle(void);
05267 SymmetryHandle(Int::LDSB::SymmetryObject* o);
05269 SymmetryHandle(const SymmetryHandle& h);
05271 const SymmetryHandle& operator=(const SymmetryHandle& h);
05273 ~SymmetryHandle(void);
05274 };
05275 class Symmetries;
05277 template<>
05278 class ArrayTraits<ArgArray<SymmetryHandle> > {
05279 public:
05280 typedef Symmetries StorageType;
05281 typedef SymmetryHandle ValueType;
05282 typedef Symmetries ArgsType;
05283 };
05284
05291
05292 class Symmetries : public ArgArray<SymmetryHandle> {};
05293
05294
05295
05297 GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x);
05299 GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const BoolVarArgs& x);
05301 GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x,
05302 const IntArgs& indices);
05304 GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntArgs& v);
05306 GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntSet& v);
05308 GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(IntVar vars);
05314 GECODE_INT_EXPORT
05315 SymmetryHandle VariableSequenceSymmetry(const IntVarArgs& x, int ss);
05321 GECODE_INT_EXPORT
05322 SymmetryHandle VariableSequenceSymmetry(const BoolVarArgs& x, int ss);
05328 GECODE_INT_EXPORT
05329 SymmetryHandle ValueSequenceSymmetry(const IntArgs& v, int ss);
05330
05332 GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
05334 GECODE_INT_EXPORT SymmetryHandle values_reflect(IntVar x);
05336
05348 GECODE_INT_EXPORT void
05349 branch(Home home, const IntVarArgs& x,
05350 IntVarBranch vars, IntValBranch vals,
05351 const Symmetries& syms,
05352 IntBranchFilter bf=nullptr,
05353 IntVarValPrint vvp=nullptr);
05365 GECODE_INT_EXPORT void
05366 branch(Home home, const IntVarArgs& x,
05367 TieBreak<IntVarBranch> vars, IntValBranch vals,
05368 const Symmetries& syms,
05369 IntBranchFilter bf=nullptr,
05370 IntVarValPrint vvp=nullptr);
05382 GECODE_INT_EXPORT void
05383 branch(Home home, const BoolVarArgs& x,
05384 BoolVarBranch vars, BoolValBranch vals,
05385 const Symmetries& syms,
05386 BoolBranchFilter bf=nullptr,
05387 BoolVarValPrint vvp=nullptr);
05399 GECODE_INT_EXPORT void
05400 branch(Home home, const BoolVarArgs& x,
05401 TieBreak<BoolVarBranch> vars, BoolValBranch vals,
05402 const Symmetries& syms,
05403 BoolBranchFilter bf=nullptr,
05404 BoolVarValPrint vvp=nullptr);
05405
05406 #ifdef GECODE_HAS_CBS
05407
05428 GECODE_INT_EXPORT void
05429 cbsbranch(Home home, const IntVarArgs& x);
05430
05431
05452 GECODE_INT_EXPORT void
05453 cbsbranch(Home home, const BoolVarArgs& x);
05454
05455 #endif
05456
05457 }
05458
05459 namespace Gecode {
05460
05461
05462
05463
05464
05465
05466
05467
05468
05469
05470
05471
05472
05473
05474
05475
05476
05477
05478
05479
05480
05481
05482 GECODE_INT_EXPORT void
05483 relax(Home home, const IntVarArgs& x, const IntVarArgs& sx,
05484 Rnd r, double p);
05485
05486
05487
05488
05489
05490
05491
05492
05493
05494
05495
05496
05497
05498
05499
05500
05501
05502
05503
05504
05505
05506
05507 GECODE_INT_EXPORT void
05508 relax(Home home, const BoolVarArgs& x, const BoolVarArgs& sx,
05509 Rnd r, double p);
05510
05511 }
05512
05513
05514 #include <gecode/int/trace/int-trace-view.hpp>
05515 #include <gecode/int/trace/bool-trace-view.hpp>
05516
05517 namespace Gecode {
05518
05528 class IntTraceDelta
05529 : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
05530 Int::ViewRanges<Int::IntView> > {
05531 protected:
05533 Int::ViewRanges<Int::IntView> rn;
05535 Iter::Ranges::RangeList ro;
05536 public:
05538
05539
05540 IntTraceDelta(Int::IntTraceView o, Int::IntView n, const Delta& d);
05542 };
05543
05548 class BoolTraceDelta {
05549 protected:
05551 int delta;
05552 public:
05554
05555
05556 BoolTraceDelta(Int::BoolTraceView o, Int::BoolView n, const Delta& d);
05558
05559
05560
05561 bool operator ()(void) const;
05563 void operator ++(void);
05565
05567
05568
05569 int min(void) const;
05571 int max(void) const;
05573 unsigned int width(void) const;
05575 };
05576
05577 }
05578
05579 #include <gecode/int/trace/int-delta.hpp>
05580 #include <gecode/int/trace/bool-delta.hpp>
05581
05582 #include <gecode/int/trace/traits.hpp>
05583
05584 namespace Gecode {
05585
05590 typedef ViewTracer<Int::IntView> IntTracer;
05595 typedef ViewTraceRecorder<Int::IntView> IntTraceRecorder;
05596
05601 class GECODE_INT_EXPORT StdIntTracer : public IntTracer {
05602 protected:
05604 std::ostream& os;
05605 public:
05607 StdIntTracer(std::ostream& os0 = std::cerr);
05609 virtual void init(const Space& home, const IntTraceRecorder& t);
05611 virtual void prune(const Space& home, const IntTraceRecorder& t,
05612 const ViewTraceInfo& vti, int i, IntTraceDelta& d);
05614 virtual void fix(const Space& home, const IntTraceRecorder& t);
05616 virtual void fail(const Space& home, const IntTraceRecorder& t);
05618 virtual void done(const Space& home, const IntTraceRecorder& t);
05620 static StdIntTracer def;
05621 };
05622
05623
05628 typedef ViewTracer<Int::BoolView> BoolTracer;
05633 typedef ViewTraceRecorder<Int::BoolView> BoolTraceRecorder;
05634
05639 class GECODE_INT_EXPORT StdBoolTracer : public BoolTracer {
05640 protected:
05642 std::ostream& os;
05643 public:
05645 StdBoolTracer(std::ostream& os0 = std::cerr);
05647 virtual void init(const Space& home, const BoolTraceRecorder& t);
05649 virtual void prune(const Space& home, const BoolTraceRecorder& t,
05650 const ViewTraceInfo& vti, int i, BoolTraceDelta& d);
05652 virtual void fix(const Space& home, const BoolTraceRecorder& t);
05654 virtual void fail(const Space& home, const BoolTraceRecorder& t);
05656 virtual void done(const Space& home, const BoolTraceRecorder& t);
05658 static StdBoolTracer def;
05659 };
05660
05665 GECODE_INT_EXPORT void
05666 trace(Home home, const IntVarArgs& x,
05667 TraceFilter tf,
05668 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05669 IntTracer& t = StdIntTracer::def);
05674 void
05675 trace(Home home, const IntVarArgs& x,
05676 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05677 IntTracer& t = StdIntTracer::def);
05678
05683 GECODE_INT_EXPORT void
05684 trace(Home home, const BoolVarArgs& x,
05685 TraceFilter tf,
05686 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05687 BoolTracer& t = StdBoolTracer::def);
05692 void
05693 trace(Home home, const BoolVarArgs& x,
05694 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05695 BoolTracer& t = StdBoolTracer::def);
05696
05697 }
05698
05699 #include <gecode/int/trace.hpp>
05700
05701 #endif
05702
05703
05704
05705