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
00047
00048 #ifndef __GECODE_INT_HH__
00049 #define __GECODE_INT_HH__
00050
00051 #include <climits>
00052 #include <cfloat>
00053 #include <iostream>
00054
00055 #include <vector>
00056
00057 #include <gecode/kernel.hh>
00058 #include <gecode/iter.hh>
00059
00060
00061
00062
00063
00064 #if !defined(GECODE_STATIC_LIBS) && \
00065 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00066
00067 #ifdef GECODE_BUILD_INT
00068 #define GECODE_INT_EXPORT __declspec( dllexport )
00069 #else
00070 #define GECODE_INT_EXPORT __declspec( dllimport )
00071 #endif
00072
00073 #else
00074
00075 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00076 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00077 #else
00078 #define GECODE_INT_EXPORT
00079 #endif
00080
00081 #endif
00082
00083
00084 #ifndef GECODE_BUILD_INT
00085 #define GECODE_LIBRARY_NAME "Int"
00086 #include <gecode/support/auto-link.hpp>
00087 #endif
00088
00100 #include <gecode/int/exception.hpp>
00101
00102 namespace Gecode { namespace Int {
00103
00111 namespace Limits {
00113 const int max = INT_MAX - 1;
00115 const int min = -max;
00117 const int infinity = max + 1;
00119 const long long int llmax = LLONG_MAX - 1;
00121 const long long int llmin = -llmax;
00123 const long long int llinfinity = llmax + 1;
00125 bool valid(int n);
00127 bool valid(long long int n);
00129 void check(int n, const char* l);
00131 void check(long long int n, const char* l);
00133 void positive(int n, const char* l);
00135 void positive(long long int n, const char* l);
00137 void nonnegative(int n, const char* l);
00139 void nonnegative(long long int n, const char* l);
00141 bool overflow_add(int n, int m);
00143 bool overflow_add(long long int n, long long int m);
00145 bool overflow_sub(int n, int m);
00147 bool overflow_sub(long long int n, long long int m);
00149 bool overflow_mul(int n, int m);
00151 bool overflow_mul(long long int n, long long int m);
00152 }
00153
00154 }}
00155
00156 #include <gecode/int/limits.hpp>
00157
00158 namespace Gecode {
00159
00160 class IntSetRanges;
00161
00162 template<class I> class IntSetInit;
00163
00171 class IntSet : public SharedHandle {
00172 friend class IntSetRanges;
00173 template<class I> friend class IntSetInit;
00174 private:
00176 class Range {
00177 public:
00178 int min, max;
00179 };
00180 class IntSetObject : public SharedHandle::Object {
00181 public:
00183 unsigned int size;
00185 int n;
00187 Range* r;
00189 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00191 GECODE_INT_EXPORT SharedHandle::Object* copy(void) const;
00193 GECODE_INT_EXPORT bool in(int n) const;
00195 GECODE_INT_EXPORT virtual ~IntSetObject(void);
00196 };
00198 class MinInc;
00200 GECODE_INT_EXPORT void normalize(Range* r, int n);
00202 GECODE_INT_EXPORT void init(int n, int m);
00204 GECODE_INT_EXPORT void init(const int r[], int n);
00206 GECODE_INT_EXPORT void init(const int r[][2], int n);
00207 public:
00209
00210
00211 IntSet(void);
00216 IntSet(int n, int m);
00218 IntSet(const int r[], int n);
00224 IntSet(const int r[][2], int n);
00226 template<class I>
00227 explicit IntSet(I& i);
00229 template<class I>
00230 explicit IntSet(const I& i);
00232
00234
00235
00236 int ranges(void) const;
00238 int min(int i) const;
00240 int max(int i) const;
00242 unsigned int width(int i) const;
00244
00246
00247
00248 bool in(int n) const;
00250 unsigned int size(void) const;
00252 unsigned int width(void) const;
00254 int min(void) const;
00256 int max(void) const;
00258
00260
00261
00262 GECODE_INT_EXPORT static const IntSet empty;
00264 };
00265
00271 class IntSetRanges {
00272 private:
00274 const IntSet::Range* i;
00276 const IntSet::Range* e;
00277 public:
00279
00280
00281 IntSetRanges(void);
00283 IntSetRanges(const IntSet& s);
00285 void init(const IntSet& s);
00287
00289
00290
00291 bool operator ()(void) const;
00293 void operator ++(void);
00295
00297
00298
00299 int min(void) const;
00301 int max(void) const;
00303 unsigned int width(void) const;
00305 };
00306
00312 class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00313 public:
00315
00316
00317 IntSetValues(void);
00319 IntSetValues(const IntSet& s);
00321 void init(const IntSet& s);
00323 };
00324
00329 template<class Char, class Traits>
00330 std::basic_ostream<Char,Traits>&
00331 operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
00332
00333 }
00334
00335 #include <gecode/int/int-set-1.hpp>
00336
00337 #include <gecode/int/var-imp.hpp>
00338
00339 namespace Gecode {
00340
00341 namespace Int {
00342 class IntView;
00343 }
00344
00350 class IntVar : public VarImpVar<Int::IntVarImp> {
00351 friend class IntVarArray;
00352 friend class IntVarArgs;
00353 private:
00354 using VarImpVar<Int::IntVarImp>::x;
00361 void _init(Space& home, int min, int max);
00368 void _init(Space& home, const IntSet& d);
00369 public:
00371
00372
00373 IntVar(void);
00375 IntVar(const IntVar& y);
00377 IntVar(const Int::IntView& y);
00389 GECODE_INT_EXPORT IntVar(Space& home, int min, int max);
00401 GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
00403
00405
00406
00407 int min(void) const;
00409 int max(void) const;
00411 int med(void) const;
00419 int val(void) const;
00420
00422 unsigned int size(void) const;
00424 unsigned int width(void) const;
00426 unsigned int regret_min(void) const;
00428 unsigned int regret_max(void) const;
00430
00432
00433
00434 bool range(void) const;
00436 bool in(int n) const;
00438 };
00439
00444 template<class Char, class Traits>
00445 std::basic_ostream<Char,Traits>&
00446 operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
00447
00452 class IntVarRanges : public Int::IntVarImpFwd {
00453 public:
00455
00456
00457 IntVarRanges(void);
00459 IntVarRanges(const IntVar& x);
00461 void init(const IntVar& x);
00463 };
00464
00469 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00470 public:
00472
00473
00474 IntVarValues(void);
00476 IntVarValues(const IntVar& x);
00478 void init(const IntVar& x);
00480 };
00481
00482 namespace Int {
00483 class BoolView;
00484 }
00485
00491 class BoolVar : public VarImpVar<Int::BoolVarImp> {
00492 friend class BoolVarArray;
00493 friend class BoolVarArgs;
00494 private:
00495 using VarImpVar<Int::BoolVarImp>::x;
00502 void _init(Space& home, int min, int max);
00503 public:
00505
00506
00507 BoolVar(void);
00509 BoolVar(const BoolVar& y);
00511 BoolVar(const Int::BoolView& y);
00523 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
00525
00527
00528
00529 int min(void) const;
00531 int max(void) const;
00533 int med(void) const;
00541 int val(void) const;
00542
00544 unsigned int size(void) const;
00546 unsigned int width(void) const;
00548 unsigned int regret_min(void) const;
00550 unsigned int regret_max(void) const;
00552
00554
00555
00556 bool range(void) const;
00558 bool in(int n) const;
00560
00562
00563
00564 bool zero(void) const;
00566 bool one(void) const;
00568 bool none(void) const;
00570 };
00571
00576 template<class Char, class Traits>
00577 std::basic_ostream<Char,Traits>&
00578 operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
00579
00580 }
00581
00582
00583 #include <gecode/int/view.hpp>
00584 #include <gecode/int/propagator.hpp>
00585
00586 namespace Gecode {
00587
00597
00598 typedef ArgArray<IntSet> IntSetArgs;
00599
00600 }
00601
00602 #include <gecode/int/array-traits.hpp>
00603
00604 namespace Gecode {
00605
00607 class IntArgs : public PrimArgArray<int> {
00608 public:
00610
00611
00612 IntArgs(void);
00614 explicit IntArgs(int n);
00616 IntArgs(const SharedArray<int>& x);
00618 IntArgs(const std::vector<int>& x);
00620 template<class InputIterator>
00621 IntArgs(InputIterator first, InputIterator last);
00623 GECODE_INT_EXPORT
00624 IntArgs(int n, int e0, ...);
00626 IntArgs(int n, const int* e);
00628 IntArgs(const PrimArgArray<int>& a);
00629
00631 static IntArgs create(int n, int start, int inc=1);
00633 };
00634
00636 class IntVarArgs : public VarArgArray<IntVar> {
00637 public:
00639
00640
00641 IntVarArgs(void) {}
00643 explicit IntVarArgs(int n) : VarArgArray<IntVar>(n) {}
00645 IntVarArgs(const IntVarArgs& a) : VarArgArray<IntVar>(a) {}
00647 IntVarArgs(const VarArray<IntVar>& a) : VarArgArray<IntVar>(a) {}
00649 IntVarArgs(const std::vector<IntVar>& a) : VarArgArray<IntVar>(a) {}
00651 template<class InputIterator>
00652 IntVarArgs(InputIterator first, InputIterator last)
00653 : VarArgArray<IntVar>(first,last) {}
00665 GECODE_INT_EXPORT
00666 IntVarArgs(Space& home, int n, int min, int max);
00678 GECODE_INT_EXPORT
00679 IntVarArgs(Space& home, int n, const IntSet& s);
00681 };
00690 class BoolVarArgs : public VarArgArray<BoolVar> {
00691 public:
00693
00694
00695 BoolVarArgs(void) {}
00697 explicit BoolVarArgs(int n) : VarArgArray<BoolVar>(n) {}
00699 BoolVarArgs(const BoolVarArgs& a) : VarArgArray<BoolVar>(a) {}
00701 BoolVarArgs(const VarArray<BoolVar>& a)
00702 : VarArgArray<BoolVar>(a) {}
00704 BoolVarArgs(const std::vector<BoolVar>& a) : VarArgArray<BoolVar>(a) {}
00706 template<class InputIterator>
00707 BoolVarArgs(InputIterator first, InputIterator last)
00708 : VarArgArray<BoolVar>(first,last) {}
00720 GECODE_INT_EXPORT
00721 BoolVarArgs(Space& home, int n, int min, int max);
00723 };
00725
00741 class IntVarArray : public VarArray<IntVar> {
00742 public:
00744
00745
00746 IntVarArray(void);
00748 IntVarArray(Space& home, int n);
00750 IntVarArray(const IntVarArray& a);
00752 IntVarArray(Space& home, const IntVarArgs& a);
00764 GECODE_INT_EXPORT
00765 IntVarArray(Space& home, int n, int min, int max);
00777 GECODE_INT_EXPORT
00778 IntVarArray(Space& home, int n, const IntSet& s);
00780 };
00781
00786 class BoolVarArray : public VarArray<BoolVar> {
00787 public:
00789
00790
00791 BoolVarArray(void);
00793 BoolVarArray(Space& home, int n);
00795 BoolVarArray(const BoolVarArray& a);
00797 BoolVarArray(Space& home, const BoolVarArgs& a);
00809 GECODE_INT_EXPORT
00810 BoolVarArray(Space& home, int n, int min, int max);
00812 };
00813
00814 }
00815
00816 #include <gecode/int/int-set-2.hpp>
00817
00818 #include <gecode/int/array.hpp>
00819
00820 namespace Gecode {
00821
00826 enum ReifyMode {
00833 RM_EQV,
00840 RM_IMP,
00847 RM_PMI
00848 };
00849
00854 class Reify {
00855 protected:
00857 BoolVar x;
00859 ReifyMode rm;
00860 public:
00862 Reify(void);
00864 Reify(BoolVar x, ReifyMode rm=RM_EQV);
00866 BoolVar var(void) const;
00868 ReifyMode mode(void) const;
00870 void var(BoolVar x);
00872 void mode(ReifyMode rm);
00873 };
00874
00879 Reify eqv(BoolVar x);
00880
00885 Reify imp(BoolVar x);
00886
00891 Reify pmi(BoolVar x);
00892
00893 }
00894
00895 #include <gecode/int/reify.hpp>
00896
00897 namespace Gecode {
00898
00903 enum IntRelType {
00904 IRT_EQ,
00905 IRT_NQ,
00906 IRT_LQ,
00907 IRT_LE,
00908 IRT_GQ,
00909 IRT_GR
00910 };
00911
00916 enum BoolOpType {
00917 BOT_AND,
00918 BOT_OR,
00919 BOT_IMP,
00920 BOT_EQV,
00921 BOT_XOR
00922 };
00923
00937 enum IntConLevel {
00938 ICL_VAL,
00939 ICL_BND,
00940 ICL_DOM,
00941 ICL_DEF
00942 };
00943
00949 enum TaskType {
00950 TT_FIXP,
00951 TT_FIXS,
00952 TT_FIXE
00953 };
00954
00960 typedef PrimArgArray<TaskType> TaskTypeArgs;
00961
00963 template<>
00964 class ArrayTraits<PrimArgArray<TaskType> > {
00965 public:
00966 typedef TaskTypeArgs StorageType;
00967 typedef TaskType ValueType;
00968 typedef TaskTypeArgs ArgsType;
00969 };
00970
00971
00979
00980 GECODE_INT_EXPORT void
00981 dom(Home home, IntVar x, int n,
00982 IntConLevel icl=ICL_DEF);
00984 GECODE_INT_EXPORT void
00985 dom(Home home, const IntVarArgs& x, int n,
00986 IntConLevel icl=ICL_DEF);
00987
00989 GECODE_INT_EXPORT void
00990 dom(Home home, IntVar x, int l, int m,
00991 IntConLevel icl=ICL_DEF);
00993 GECODE_INT_EXPORT void
00994 dom(Home home, const IntVarArgs& x, int l, int m,
00995 IntConLevel icl=ICL_DEF);
00996
00998 GECODE_INT_EXPORT void
00999 dom(Home home, IntVar x, const IntSet& s,
01000 IntConLevel icl=ICL_DEF);
01002 GECODE_INT_EXPORT void
01003 dom(Home home, const IntVarArgs& x, const IntSet& s,
01004 IntConLevel icl=ICL_DEF);
01005
01007 GECODE_INT_EXPORT void
01008 dom(Home home, IntVar x, int n, Reify r,
01009 IntConLevel icl=ICL_DEF);
01011 GECODE_INT_EXPORT void
01012 dom(Home home, IntVar x, int l, int m, Reify r,
01013 IntConLevel icl=ICL_DEF);
01015 GECODE_INT_EXPORT void
01016 dom(Home home, IntVar x, const IntSet& s, Reify r,
01017 IntConLevel icl=ICL_DEF);
01018
01020 GECODE_INT_EXPORT void
01021 dom(Home home, IntVar x, IntVar d,
01022 IntConLevel icl=ICL_DEF);
01024 GECODE_INT_EXPORT void
01025 dom(Home home, BoolVar x, BoolVar d,
01026 IntConLevel icl=ICL_DEF);
01028 GECODE_INT_EXPORT void
01029 dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
01030 IntConLevel icl=ICL_DEF);
01032 GECODE_INT_EXPORT void
01033 dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
01034 IntConLevel icl=ICL_DEF);
01036
01037
01048 GECODE_INT_EXPORT void
01049 rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
01050 IntConLevel icl=ICL_DEF);
01057 GECODE_INT_EXPORT void
01058 rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01059 IntConLevel icl=ICL_DEF);
01063 GECODE_INT_EXPORT void
01064 rel(Home home, IntVar x, IntRelType irt, int c,
01065 IntConLevel icl=ICL_DEF);
01069 GECODE_INT_EXPORT void
01070 rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
01071 IntConLevel icl=ICL_DEF);
01078 GECODE_INT_EXPORT void
01079 rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
01080 IntConLevel icl=ICL_DEF);
01087 GECODE_INT_EXPORT void
01088 rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
01089 IntConLevel icl=ICL_DEF);
01104 GECODE_INT_EXPORT void
01105 rel(Home home, const IntVarArgs& x, IntRelType irt,
01106 IntConLevel icl=ICL_DEF);
01121 GECODE_INT_EXPORT void
01122 rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
01123 IntConLevel icl=ICL_DEF);
01124
01132 GECODE_INT_EXPORT void
01133 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
01134 IntConLevel icl=ICL_DEF);
01138 GECODE_INT_EXPORT void
01139 rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
01140 IntConLevel icl=ICL_DEF);
01144 GECODE_INT_EXPORT void
01145 rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
01146 IntConLevel icl=ICL_DEF);
01154 GECODE_INT_EXPORT void
01155 rel(Home home, BoolVar x, IntRelType irt, int n,
01156 IntConLevel icl=ICL_DEF);
01164 GECODE_INT_EXPORT void
01165 rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
01166 IntConLevel icl=ICL_DEF);
01174 GECODE_INT_EXPORT void
01175 rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
01176 IntConLevel icl=ICL_DEF);
01186 GECODE_INT_EXPORT void
01187 rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
01188 IntConLevel icl=ICL_DEF);
01199 GECODE_INT_EXPORT void
01200 rel(Home home, const BoolVarArgs& x, IntRelType irt,
01201 IntConLevel icl=ICL_DEF);
01207 GECODE_INT_EXPORT void
01208 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
01209 IntConLevel icl=ICL_DEF);
01218 GECODE_INT_EXPORT void
01219 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
01220 IntConLevel icl=ICL_DEF);
01230 GECODE_INT_EXPORT void
01231 rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
01232 IntConLevel icl=ICL_DEF);
01245 GECODE_INT_EXPORT void
01246 rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
01247 IntConLevel icl=ICL_DEF);
01258 GECODE_INT_EXPORT void
01259 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01260 BoolVar z, IntConLevel icl=ICL_DEF);
01274 GECODE_INT_EXPORT void
01275 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01276 int n, IntConLevel icl=ICL_DEF);
01283 GECODE_INT_EXPORT void
01284 ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
01285 IntConLevel icl=ICL_DEF);
01286
01287
01299 GECODE_INT_EXPORT void
01300 precede(Home home, const IntVarArgs& x, int s, int t,
01301 IntConLevel=ICL_DEF);
01309 GECODE_INT_EXPORT void
01310 precede(Home home, const IntVarArgs& x, const IntArgs& c,
01311 IntConLevel=ICL_DEF);
01312
01313
01319
01320 GECODE_INT_EXPORT void
01321 member(Home home, const IntVarArgs& x, IntVar y,
01322 IntConLevel icl=ICL_DEF);
01324 GECODE_INT_EXPORT void
01325 member(Home home, const BoolVarArgs& x, BoolVar y,
01326 IntConLevel icl=ICL_DEF);
01328 GECODE_INT_EXPORT void
01329 member(Home home, const IntVarArgs& x, IntVar y, Reify r,
01330 IntConLevel icl=ICL_DEF);
01332 GECODE_INT_EXPORT void
01333 member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
01334 IntConLevel icl=ICL_DEF);
01336
01337
01344
01345 typedef SharedArray<int> IntSharedArray;
01351 GECODE_INT_EXPORT void
01352 element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01353 IntConLevel icl=ICL_DEF);
01359 GECODE_INT_EXPORT void
01360 element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01361 IntConLevel icl=ICL_DEF);
01367 GECODE_INT_EXPORT void
01368 element(Home home, IntSharedArray n, IntVar x0, int x1,
01369 IntConLevel icl=ICL_DEF);
01375 GECODE_INT_EXPORT void
01376 element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01377 IntConLevel icl=ICL_DEF);
01383 GECODE_INT_EXPORT void
01384 element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01385 IntConLevel icl=ICL_DEF);
01387 GECODE_INT_EXPORT void
01388 element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01389 IntConLevel icl=ICL_DEF);
01391 GECODE_INT_EXPORT void
01392 element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01393 IntConLevel icl=ICL_DEF);
01394
01407 GECODE_INT_EXPORT void
01408 element(Home home, IntSharedArray a,
01409 IntVar x, int w, IntVar y, int h, IntVar z,
01410 IntConLevel icl=ICL_DEF);
01423 GECODE_INT_EXPORT void
01424 element(Home home, IntSharedArray a,
01425 IntVar x, int w, IntVar y, int h, BoolVar z,
01426 IntConLevel icl=ICL_DEF);
01442 GECODE_INT_EXPORT void
01443 element(Home home, const IntVarArgs& a,
01444 IntVar x, int w, IntVar y, int h, IntVar z,
01445 IntConLevel icl=ICL_DEF);
01458 GECODE_INT_EXPORT void
01459 element(Home home, const BoolVarArgs& a,
01460 IntVar x, int w, IntVar y, int h, BoolVar z,
01461 IntConLevel icl=ICL_DEF);
01463
01464
01479 GECODE_INT_EXPORT void
01480 distinct(Home home, const IntVarArgs& x,
01481 IntConLevel icl=ICL_DEF);
01494 GECODE_INT_EXPORT void
01495 distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01496 IntConLevel icl=ICL_DEF);
01498
01499
01517 GECODE_INT_EXPORT void
01518 channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01519 IntConLevel icl=ICL_DEF);
01520
01534 GECODE_INT_EXPORT void
01535 channel(Home home, const IntVarArgs& x, int xoff,
01536 const IntVarArgs& y, int yoff,
01537 IntConLevel icl=ICL_DEF);
01538
01540 GECODE_INT_EXPORT void
01541 channel(Home home, BoolVar x0, IntVar x1,
01542 IntConLevel icl=ICL_DEF);
01544 forceinline void
01545 channel(Home home, IntVar x0, BoolVar x1,
01546 IntConLevel icl=ICL_DEF) {
01547 channel(home,x1,x0,icl);
01548 }
01554 GECODE_INT_EXPORT void
01555 channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01556 IntConLevel icl=ICL_DEF);
01558
01559
01576 GECODE_INT_EXPORT void
01577 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01578 IntConLevel icl=ICL_DEF);
01579
01591 GECODE_INT_EXPORT void
01592 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01593 const IntVarArgs& z,
01594 IntConLevel icl=ICL_DEF);
01596
01597
01616 GECODE_INT_EXPORT void
01617 count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
01618 IntConLevel icl=ICL_DEF);
01623 GECODE_INT_EXPORT void
01624 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
01625 IntConLevel icl=ICL_DEF);
01633 GECODE_INT_EXPORT void
01634 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
01635 IntConLevel icl=ICL_DEF);
01643 GECODE_INT_EXPORT void
01644 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
01645 IntConLevel icl=ICL_DEF);
01650 GECODE_INT_EXPORT void
01651 count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
01652 IntConLevel icl=ICL_DEF);
01657 GECODE_INT_EXPORT void
01658 count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
01659 IntConLevel icl=ICL_DEF);
01667 GECODE_INT_EXPORT void
01668 count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
01669 IntConLevel icl=ICL_DEF);
01677 GECODE_INT_EXPORT void
01678 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
01679 IntConLevel icl=ICL_DEF);
01680
01694 GECODE_INT_EXPORT void
01695 count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01696 IntConLevel icl=ICL_DEF);
01697
01711 GECODE_INT_EXPORT void
01712 count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01713 IntConLevel icl=ICL_DEF);
01714
01731 GECODE_INT_EXPORT void
01732 count(Home home, const IntVarArgs& x,
01733 const IntVarArgs& c, const IntArgs& v,
01734 IntConLevel icl=ICL_DEF);
01735
01752 GECODE_INT_EXPORT void
01753 count(Home home, const IntVarArgs& x,
01754 const IntSetArgs& c, const IntArgs& v,
01755 IntConLevel icl=ICL_DEF);
01756
01773 GECODE_INT_EXPORT void
01774 count(Home home, const IntVarArgs& x,
01775 const IntSet& c, const IntArgs& v,
01776 IntConLevel icl=ICL_DEF);
01777
01779
01794 GECODE_INT_EXPORT void
01795 nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
01796 IntConLevel icl=ICL_DEF);
01800 GECODE_INT_EXPORT void
01801 nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01802 IntConLevel icl=ICL_DEF);
01806 GECODE_INT_EXPORT void
01807 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
01808 IntConLevel icl=ICL_DEF);
01812 GECODE_INT_EXPORT void
01813 nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
01814 IntConLevel icl=ICL_DEF);
01816
01837 GECODE_INT_EXPORT void
01838 sequence(Home home, const IntVarArgs& x, const IntSet& s,
01839 int q, int l, int u, IntConLevel icl=ICL_DEF);
01840
01855 GECODE_INT_EXPORT void
01856 sequence(Home home, const BoolVarArgs& x, const IntSet& s,
01857 int q, int l, int u, IntConLevel icl=ICL_DEF);
01858
01860
01873
01881 class DFA : public SharedHandle {
01882 private:
01884 class DFAI;
01885 public:
01887 class Transition {
01888 public:
01889 int i_state;
01890 int symbol;
01891 int o_state;
01892
01893 Transition();
01895 Transition(int i_state0, int symbol0, int o_state0);
01896 };
01898 class Transitions {
01899 private:
01901 const Transition* c_trans;
01903 const Transition* e_trans;
01904 public:
01906 Transitions(const DFA& d);
01908 Transitions(const DFA& d, int n);
01910 bool operator ()(void) const;
01912 void operator ++(void);
01914 int i_state(void) const;
01916 int symbol(void) const;
01918 int o_state(void) const;
01919 };
01921 class Symbols {
01922 private:
01924 const Transition* c_trans;
01926 const Transition* e_trans;
01927 public:
01929 Symbols(const DFA& d);
01931 bool operator ()(void) const;
01933 void operator ++(void);
01935 int val(void) const;
01936 };
01937 public:
01938 friend class Transitions;
01940 DFA(void);
01952 GECODE_INT_EXPORT
01953 DFA(int s, Transition t[], int f[], bool minimize=true);
01955 DFA(const DFA& d);
01957 int n_states(void) const;
01959 int n_transitions(void) const;
01961 unsigned int n_symbols(void) const;
01963 unsigned int max_degree(void) const;
01965 int final_fst(void) const;
01967 int final_lst(void) const;
01969 int symbol_min(void) const;
01971 int symbol_max(void) const;
01972 };
01973
01974
01982 enum ExtensionalPropKind {
01983 EPK_DEF,
01984 EPK_SPEED,
01985 EPK_MEMORY
01986 };
01987
01998 GECODE_INT_EXPORT void
01999 extensional(Home home, const IntVarArgs& x, DFA d,
02000 IntConLevel icl=ICL_DEF);
02001
02012 GECODE_INT_EXPORT void
02013 extensional(Home home, const BoolVarArgs& x, DFA d,
02014 IntConLevel icl=ICL_DEF);
02015
02022 class TupleSet : public SharedHandle {
02023 public:
02028 typedef int* Tuple;
02029
02034 class GECODE_VTABLE_EXPORT TupleSetI
02035 : public SharedHandle::Object {
02036 public:
02038 int arity;
02040 int size;
02042 Tuple** tuples;
02044 Tuple* tuple_data;
02046 int* data;
02048 int excess;
02050 int min, max;
02052 unsigned int domsize;
02054 Tuple** last;
02056 Tuple* nullpointer;
02057
02059 template<class T>
02060 void add(T t);
02062 GECODE_INT_EXPORT void finalize(void);
02064 GECODE_INT_EXPORT void resize(void);
02066 bool finalized(void) const;
02068 TupleSetI(void);
02070 GECODE_INT_EXPORT virtual ~TupleSetI(void);
02072 GECODE_INT_EXPORT virtual SharedHandle::Object* copy(void) const;
02073 };
02074
02076 TupleSetI* implementation(void);
02077
02079 TupleSet(void);
02081 TupleSet(const TupleSet& d);
02082
02084 void add(const IntArgs& tuple);
02086 void finalize(void);
02088 bool finalized(void) const;
02090 int arity(void) const;
02092 int tuples(void) const;
02094 Tuple operator [](int i) const;
02096 int min(void) const;
02098 int max(void) const;
02099 };
02100
02119 GECODE_INT_EXPORT void
02120 extensional(Home home, const IntVarArgs& x, const TupleSet& t,
02121 ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
02122
02133 GECODE_INT_EXPORT void
02134 extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
02135 ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
02137
02138 }
02139
02140 #include <gecode/int/extensional/dfa.hpp>
02141 #include <gecode/int/extensional/tuple-set.hpp>
02142
02143 namespace Gecode {
02144
02156 GECODE_INT_EXPORT void
02157 min(Home home, IntVar x0, IntVar x1, IntVar x2,
02158 IntConLevel icl=ICL_DEF);
02166 GECODE_INT_EXPORT void
02167 min(Home home, const IntVarArgs& x, IntVar y,
02168 IntConLevel icl=ICL_DEF);
02174 GECODE_INT_EXPORT void
02175 max(Home home, IntVar x0, IntVar x1, IntVar x2,
02176 IntConLevel icl=ICL_DEF);
02184 GECODE_INT_EXPORT void
02185 max(Home home, const IntVarArgs& x, IntVar y,
02186 IntConLevel icl=ICL_DEF);
02187
02197 GECODE_INT_EXPORT void
02198 argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02199 IntConLevel icl=ICL_DEF);
02209 GECODE_INT_EXPORT void
02210 argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02211 IntConLevel icl=ICL_DEF);
02212
02218 GECODE_INT_EXPORT void
02219 abs(Home home, IntVar x0, IntVar x1,
02220 IntConLevel icl=ICL_DEF);
02221
02227 GECODE_INT_EXPORT void
02228 mult(Home home, IntVar x0, IntVar x1, IntVar x2,
02229 IntConLevel icl=ICL_DEF);
02230
02235 GECODE_INT_EXPORT void
02236 divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
02237 IntConLevel icl=ICL_DEF);
02238
02243 GECODE_INT_EXPORT void
02244 div(Home home, IntVar x0, IntVar x1, IntVar x2,
02245 IntConLevel icl=ICL_DEF);
02246
02251 GECODE_INT_EXPORT void
02252 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
02253 IntConLevel icl=ICL_DEF);
02254
02260 GECODE_INT_EXPORT void
02261 sqr(Home home, IntVar x0, IntVar x1,
02262 IntConLevel icl=ICL_DEF);
02263
02269 GECODE_INT_EXPORT void
02270 sqrt(Home home, IntVar x0, IntVar x1,
02271 IntConLevel icl=ICL_DEF);
02272
02281 GECODE_INT_EXPORT void
02282 pow(Home home, IntVar x0, int n, IntVar x1,
02283 IntConLevel icl=ICL_DEF);
02284
02293 GECODE_INT_EXPORT void
02294 nroot(Home home, IntVar x0, int n, IntVar x1,
02295 IntConLevel icl=ICL_DEF);
02296
02298
02330 GECODE_INT_EXPORT void
02331 linear(Home home, const IntVarArgs& x,
02332 IntRelType irt, int c,
02333 IntConLevel icl=ICL_DEF);
02337 GECODE_INT_EXPORT void
02338 linear(Home home, const IntVarArgs& x,
02339 IntRelType irt, IntVar y,
02340 IntConLevel icl=ICL_DEF);
02344 GECODE_INT_EXPORT void
02345 linear(Home home, const IntVarArgs& x,
02346 IntRelType irt, int c, Reify r,
02347 IntConLevel icl=ICL_DEF);
02351 GECODE_INT_EXPORT void
02352 linear(Home home, const IntVarArgs& x,
02353 IntRelType irt, IntVar y, Reify r,
02354 IntConLevel icl=ICL_DEF);
02361 GECODE_INT_EXPORT void
02362 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02363 IntRelType irt, int c,
02364 IntConLevel icl=ICL_DEF);
02371 GECODE_INT_EXPORT void
02372 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02373 IntRelType irt, IntVar y,
02374 IntConLevel icl=ICL_DEF);
02381 GECODE_INT_EXPORT void
02382 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02383 IntRelType irt, int c, Reify r,
02384 IntConLevel icl=ICL_DEF);
02391 GECODE_INT_EXPORT void
02392 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02393 IntRelType irt, IntVar y, Reify r,
02394 IntConLevel icl=ICL_DEF);
02395
02396
02424 GECODE_INT_EXPORT void
02425 linear(Home home, const BoolVarArgs& x,
02426 IntRelType irt, int c,
02427 IntConLevel icl=ICL_DEF);
02431 GECODE_INT_EXPORT void
02432 linear(Home home, const BoolVarArgs& x,
02433 IntRelType irt, int c, Reify r,
02434 IntConLevel icl=ICL_DEF);
02438 GECODE_INT_EXPORT void
02439 linear(Home home, const BoolVarArgs& x,
02440 IntRelType irt, IntVar y,
02441 IntConLevel icl=ICL_DEF);
02445 GECODE_INT_EXPORT void
02446 linear(Home home, const BoolVarArgs& x,
02447 IntRelType irt, IntVar y, Reify r,
02448 IntConLevel icl=ICL_DEF);
02455 GECODE_INT_EXPORT void
02456 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02457 IntRelType irt, int c,
02458 IntConLevel icl=ICL_DEF);
02465 GECODE_INT_EXPORT void
02466 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02467 IntRelType irt, int c, Reify r,
02468 IntConLevel icl=ICL_DEF);
02475 GECODE_INT_EXPORT void
02476 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02477 IntRelType irt, IntVar y,
02478 IntConLevel icl=ICL_DEF);
02485 GECODE_INT_EXPORT void
02486 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02487 IntRelType irt, IntVar y, Reify r,
02488 IntConLevel icl=ICL_DEF);
02489
02490
02517 GECODE_INT_EXPORT void
02518 binpacking(Home home,
02519 const IntVarArgs& l,
02520 const IntVarArgs& b, const IntArgs& s,
02521 IntConLevel icl=ICL_DEF);
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560 GECODE_INT_EXPORT IntSet
02561 binpacking(Home home, int d,
02562 const IntVarArgs& l, const IntVarArgs& b,
02563 const IntArgs& s, const IntArgs& c,
02564 IntConLevel icl=ICL_DEF);
02565
02566
02585 GECODE_INT_EXPORT void
02586 nooverlap(Home home,
02587 const IntVarArgs& x, const IntArgs& w,
02588 const IntVarArgs& y, const IntArgs& h,
02589 IntConLevel icl=ICL_DEF);
02603 GECODE_INT_EXPORT void
02604 nooverlap(Home home,
02605 const IntVarArgs& x, const IntArgs& w,
02606 const IntVarArgs& y, const IntArgs& h,
02607 const BoolVarArgs& o,
02608 IntConLevel icl=ICL_DEF);
02625 GECODE_INT_EXPORT void
02626 nooverlap(Home home,
02627 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02628 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02629 IntConLevel icl=ICL_DEF);
02647 GECODE_INT_EXPORT void
02648 nooverlap(Home home,
02649 const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02650 const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02651 const BoolVarArgs& o,
02652 IntConLevel icl=ICL_DEF);
02653
02654
02660
02703 GECODE_INT_EXPORT void
02704 cumulatives(Home home, const IntVarArgs& m,
02705 const IntVarArgs& s, const IntVarArgs& p,
02706 const IntVarArgs& e, const IntVarArgs& u,
02707 const IntArgs& c, bool at_most,
02708 IntConLevel icl=ICL_DEF);
02713 GECODE_INT_EXPORT void
02714 cumulatives(Home home, const IntArgs& m,
02715 const IntVarArgs& s, const IntVarArgs& p,
02716 const IntVarArgs& e, const IntVarArgs& u,
02717 const IntArgs& c, bool at_most,
02718 IntConLevel icl=ICL_DEF);
02723 GECODE_INT_EXPORT void
02724 cumulatives(Home home, const IntVarArgs& m,
02725 const IntVarArgs& s, const IntArgs& p,
02726 const IntVarArgs& e, const IntVarArgs& u,
02727 const IntArgs& c, bool at_most,
02728 IntConLevel icl=ICL_DEF);
02733 GECODE_INT_EXPORT void
02734 cumulatives(Home home, const IntArgs& m,
02735 const IntVarArgs& s, const IntArgs& p,
02736 const IntVarArgs& e, const IntVarArgs& u,
02737 const IntArgs& c, bool at_most,
02738 IntConLevel icl=ICL_DEF);
02743 GECODE_INT_EXPORT void
02744 cumulatives(Home home, const IntVarArgs& m,
02745 const IntVarArgs& s, const IntVarArgs& p,
02746 const IntVarArgs& e, const IntArgs& u,
02747 const IntArgs& c, bool at_most,
02748 IntConLevel icl=ICL_DEF);
02753 GECODE_INT_EXPORT void
02754 cumulatives(Home home, const IntArgs& m,
02755 const IntVarArgs& s, const IntVarArgs& p,
02756 const IntVarArgs& e, const IntArgs& u,
02757 const IntArgs& c, bool at_most,
02758 IntConLevel icl=ICL_DEF);
02763 GECODE_INT_EXPORT void
02764 cumulatives(Home home, const IntVarArgs& m,
02765 const IntVarArgs& s, const IntArgs& p,
02766 const IntVarArgs& e, const IntArgs& u,
02767 const IntArgs& c, bool at_most,
02768 IntConLevel icl=ICL_DEF);
02773 GECODE_INT_EXPORT void
02774 cumulatives(Home home, const IntArgs& m,
02775 const IntVarArgs& s, const IntArgs& p,
02776 const IntVarArgs& e, const IntArgs& u,
02777 const IntArgs& c, bool at_most,
02778 IntConLevel icl=ICL_DEF);
02779
02798 GECODE_INT_EXPORT void
02799 unary(Home home, const IntVarArgs& s, const IntArgs& p,
02800 IntConLevel icl=ICL_DEF);
02801
02822 GECODE_INT_EXPORT void
02823 unary(Home home, const IntVarArgs& s, const IntArgs& p,
02824 const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02825
02854 GECODE_INT_EXPORT void
02855 unary(Home home, const TaskTypeArgs& t,
02856 const IntVarArgs& flex, const IntArgs& fix, IntConLevel icl=ICL_DEF);
02857
02888 GECODE_INT_EXPORT void
02889 unary(Home home, const TaskTypeArgs& t,
02890 const IntVarArgs& flex, const IntArgs& fix,
02891 const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02892
02912 GECODE_INT_EXPORT void
02913 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
02914 const IntVarArgs& e, IntConLevel icl=ICL_DEF);
02915
02937 GECODE_INT_EXPORT void
02938 unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
02939 const IntVarArgs& e, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02940
02975 GECODE_INT_EXPORT void
02976 cumulative(Home home, int c, const TaskTypeArgs& t,
02977 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02978 IntConLevel icl=ICL_DEF);
02979
02980
02985 GECODE_INT_EXPORT void
02986 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
02987 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02988 IntConLevel icl=ICL_DEF);
02989
03026 GECODE_INT_EXPORT void
03027 cumulative(Home home, int c, const TaskTypeArgs& t,
03028 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03029 const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03030
03034 GECODE_INT_EXPORT void
03035 cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03036 const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03037 const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03038
03063 GECODE_INT_EXPORT void
03064 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03065 const IntArgs& u, IntConLevel icl=ICL_DEF);
03066
03070 GECODE_INT_EXPORT void
03071 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03072 const IntArgs& u, IntConLevel icl=ICL_DEF);
03073
03100 GECODE_INT_EXPORT void
03101 cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03102 const IntArgs& u, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03103
03107 GECODE_INT_EXPORT void
03108 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03109 const IntArgs& u, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03110
03139 GECODE_INT_EXPORT void
03140 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03141 const IntVarArgs& e, const IntArgs& u, IntConLevel icl=ICL_DEF);
03142
03146 GECODE_INT_EXPORT void
03147 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03148 const IntVarArgs& e, const IntArgs& u, IntConLevel icl=ICL_DEF);
03149
03180 GECODE_INT_EXPORT void
03181 cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03182 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03183 IntConLevel icl=ICL_DEF);
03184
03188 GECODE_INT_EXPORT void
03189 cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03190 const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03191 IntConLevel icl=ICL_DEF);
03193
03194
03214 GECODE_INT_EXPORT void
03215 circuit(Home home, const IntVarArgs& x,
03216 IntConLevel icl=ICL_DEF);
03232 GECODE_INT_EXPORT void
03233 circuit(Home home, int offset, const IntVarArgs& x,
03234 IntConLevel icl=ICL_DEF);
03256 GECODE_INT_EXPORT void
03257 circuit(Home home,
03258 const IntArgs& c,
03259 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03260 IntConLevel icl=ICL_DEF);
03283 GECODE_INT_EXPORT void
03284 circuit(Home home,
03285 const IntArgs& c, int offset,
03286 const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03287 IntConLevel icl=ICL_DEF);
03306 GECODE_INT_EXPORT void
03307 circuit(Home home,
03308 const IntArgs& c,
03309 const IntVarArgs& x, IntVar z,
03310 IntConLevel icl=ICL_DEF);
03331 GECODE_INT_EXPORT void
03332 circuit(Home home,
03333 const IntArgs& c, int offset,
03334 const IntVarArgs& x, IntVar z,
03335 IntConLevel icl=ICL_DEF);
03351 GECODE_INT_EXPORT void
03352 path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
03353 IntConLevel icl=ICL_DEF);
03371 GECODE_INT_EXPORT void
03372 path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
03373 IntConLevel icl=ICL_DEF);
03396 GECODE_INT_EXPORT void
03397 path(Home home,
03398 const IntArgs& c,
03399 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03400 IntConLevel icl=ICL_DEF);
03425 GECODE_INT_EXPORT void
03426 path(Home home,
03427 const IntArgs& c, int offset,
03428 const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03429 IntConLevel icl=ICL_DEF);
03450 GECODE_INT_EXPORT void
03451 path(Home home,
03452 const IntArgs& c,
03453 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03454 IntConLevel icl=ICL_DEF);
03477 GECODE_INT_EXPORT void
03478 path(Home home,
03479 const IntArgs& c, int offset,
03480 const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03481 IntConLevel icl=ICL_DEF);
03483
03484
03485
03494
03495 GECODE_INT_EXPORT void
03496 wait(Home home, IntVar x, void (*c)(Space& home),
03497 IntConLevel icl=ICL_DEF);
03499 GECODE_INT_EXPORT void
03500 wait(Home home, BoolVar x, void (*c)(Space& home),
03501 IntConLevel icl=ICL_DEF);
03503 GECODE_INT_EXPORT void
03504 wait(Home home, const IntVarArgs& x, void (*c)(Space& home),
03505 IntConLevel icl=ICL_DEF);
03507 GECODE_INT_EXPORT void
03508 wait(Home home, const BoolVarArgs& x, void (*c)(Space& home),
03509 IntConLevel icl=ICL_DEF);
03511 GECODE_INT_EXPORT void
03512 when(Home home, BoolVar x,
03513 void (*t)(Space& home), void (*e)(Space& home)= NULL,
03514 IntConLevel icl=ICL_DEF);
03516
03517
03542 GECODE_INT_EXPORT void
03543 unshare(Home home, IntVarArgs& x,
03544 IntConLevel icl=ICL_DEF);
03546 GECODE_INT_EXPORT void
03547 unshare(Home home, BoolVarArgs& x,
03548 IntConLevel icl=ICL_DEF);
03550
03551 }
03552
03553 namespace Gecode {
03554
03568 typedef bool (*IntBranchFilter)(const Space& home, IntVar x, int i);
03577 typedef bool (*BoolBranchFilter)(const Space& home, BoolVar x, int i);
03578
03588 typedef double (*IntBranchMerit)(const Space& home, IntVar x, int i);
03598 typedef double (*BoolBranchMerit)(const Space& home, BoolVar x, int i);
03599
03610 typedef int (*IntBranchVal)(const Space& home, IntVar x, int i);
03621 typedef int (*BoolBranchVal)(const Space& home, BoolVar x, int i);
03622
03634 typedef void (*IntBranchCommit)(Space& home, unsigned int a,
03635 IntVar x, int i, int n);
03647 typedef void (*BoolBranchCommit)(Space& home, unsigned int a,
03648 BoolVar x, int i, int n);
03649 }
03650
03651 #include <gecode/int/branch/traits.hpp>
03652
03653 namespace Gecode {
03654
03660 class IntAFC : public AFC {
03661 public:
03669 IntAFC(void);
03671 IntAFC(const IntAFC& a);
03673 IntAFC& operator =(const IntAFC& a);
03675 IntAFC(Home home, const IntVarArgs& x, double d=1.0);
03677 IntAFC(Home home, const BoolVarArgs& x, double d=1.0);
03685 void init(Home, const IntVarArgs& x, double d=1.0);
03693 void init(Home, const BoolVarArgs& x, double d=1.0);
03694 };
03695
03696 }
03697
03698 #include <gecode/int/branch/afc.hpp>
03699
03700 namespace Gecode {
03701
03707 class IntActivity : public Activity {
03708 public:
03716 IntActivity(void);
03718 IntActivity(const IntActivity& a);
03720 IntActivity& operator =(const IntActivity& a);
03728 GECODE_INT_EXPORT
03729 IntActivity(Home home, const IntVarArgs& x, double d=1.0,
03730 IntBranchMerit bm=NULL);
03738 GECODE_INT_EXPORT
03739 IntActivity(Home home, const BoolVarArgs& x, double d=1.0,
03740 BoolBranchMerit bm=NULL);
03752 GECODE_INT_EXPORT void
03753 init(Home home, const IntVarArgs& x, double d=1.0,
03754 IntBranchMerit bm=NULL);
03766 GECODE_INT_EXPORT void
03767 init(Home home, const BoolVarArgs& x, double d=1.0,
03768 BoolBranchMerit bm=NULL);
03769 };
03770
03771 }
03772
03773 #include <gecode/int/branch/activity.hpp>
03774
03775 namespace Gecode {
03776
03778 typedef void (*IntVarValPrint)(const Space &home, const BrancherHandle& bh,
03779 unsigned int a,
03780 IntVar x, int i, const int& n,
03781 std::ostream& o);
03782
03784 typedef void (*BoolVarValPrint)(const Space &home, const BrancherHandle& bh,
03785 unsigned int a,
03786 BoolVar x, int i, const int& n,
03787 std::ostream& o);
03788
03789 }
03790
03791 namespace Gecode {
03792
03798 class IntVarBranch : public VarBranch {
03799 public:
03801 enum Select {
03802 SEL_NONE = 0,
03803 SEL_RND,
03804 SEL_MERIT_MIN,
03805 SEL_MERIT_MAX,
03806 SEL_DEGREE_MIN,
03807 SEL_DEGREE_MAX,
03808 SEL_AFC_MIN,
03809 SEL_AFC_MAX,
03810 SEL_ACTIVITY_MIN,
03811 SEL_ACTIVITY_MAX,
03812 SEL_MIN_MIN,
03813 SEL_MIN_MAX,
03814 SEL_MAX_MIN,
03815 SEL_MAX_MAX,
03816 SEL_SIZE_MIN,
03817 SEL_SIZE_MAX,
03818 SEL_DEGREE_SIZE_MIN,
03819 SEL_DEGREE_SIZE_MAX,
03820 SEL_AFC_SIZE_MIN,
03821 SEL_AFC_SIZE_MAX,
03822 SEL_ACTIVITY_SIZE_MIN,
03823 SEL_ACTIVITY_SIZE_MAX,
03824
03829 SEL_REGRET_MIN_MIN,
03835 SEL_REGRET_MIN_MAX,
03841 SEL_REGRET_MAX_MIN,
03847 SEL_REGRET_MAX_MAX
03848 };
03849 protected:
03851 Select s;
03852 public:
03854 IntVarBranch(void);
03856 IntVarBranch(Rnd r);
03858 IntVarBranch(Select s, BranchTbl t);
03860 IntVarBranch(Select s, double d, BranchTbl t);
03862 IntVarBranch(Select s, AFC a, BranchTbl t);
03864 IntVarBranch(Select s, Activity a, BranchTbl t);
03866 IntVarBranch(Select s, VoidFunction mf, BranchTbl t);
03868 Select select(void) const;
03870 void expand(Home home, const IntVarArgs& x);
03872 void expand(Home home, const BoolVarArgs& x);
03873 };
03874
03880
03881 IntVarBranch INT_VAR_NONE(void);
03883 IntVarBranch INT_VAR_RND(Rnd r);
03885 IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=NULL);
03887 IntVarBranch INT_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=NULL);
03889 IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=NULL);
03891 IntVarBranch INT_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=NULL);
03893 IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=NULL);
03895 IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=NULL);
03897 IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=NULL);
03899 IntVarBranch INT_VAR_AFC_MIN(IntAFC a, BranchTbl tbl=NULL);
03901 IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=NULL);
03903 IntVarBranch INT_VAR_AFC_MAX(IntAFC a, BranchTbl tbl=NULL);
03905 IntVarBranch INT_VAR_ACTIVITY_MIN(double d=1.0, BranchTbl tbl=NULL);
03907 IntVarBranch INT_VAR_ACTIVITY_MIN(IntActivity a, BranchTbl tbl=NULL);
03909 IntVarBranch INT_VAR_ACTIVITY_MAX(double d=1.0, BranchTbl tbl=NULL);
03911 IntVarBranch INT_VAR_ACTIVITY_MAX(IntActivity a, BranchTbl tbl=NULL);
03913 IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=NULL);
03915 IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=NULL);
03917 IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=NULL);
03919 IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=NULL);
03921 IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=NULL);
03923 IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=NULL);
03925 IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=NULL);
03927 IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=NULL);
03929 IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
03931 IntVarBranch INT_VAR_AFC_SIZE_MIN(IntAFC a, BranchTbl tbl=NULL);
03933 IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
03935 IntVarBranch INT_VAR_AFC_SIZE_MAX(IntAFC a, BranchTbl tbl=NULL);
03937 IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
03939 IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(IntActivity a, BranchTbl tbl=NULL);
03941 IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
03943 IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(IntActivity a, BranchTbl tbl=NULL);
03949 IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=NULL);
03955 IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=NULL);
03961 IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=NULL);
03967 IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=NULL);
03969
03970 }
03971
03972 #include <gecode/int/branch/var.hpp>
03973
03974 namespace Gecode {
03975
03981 class IntValBranch : public ValBranch {
03982 public:
03984 enum Select {
03985 SEL_MIN,
03986 SEL_MED,
03987 SEL_MAX,
03988 SEL_RND,
03989 SEL_SPLIT_MIN,
03990 SEL_SPLIT_MAX,
03991 SEL_RANGE_MIN,
03992 SEL_RANGE_MAX,
03993 SEL_VAL_COMMIT,
03994 SEL_VALUES_MIN,
03995 SEL_VALUES_MAX,
03996 SEL_NEAR_MIN,
03997 SEL_NEAR_MAX,
03998 SEL_NEAR_INC,
03999 SEL_NEAR_DEC
04000 };
04001 protected:
04003 IntSharedArray n;
04005 Select s;
04006 public:
04008 IntValBranch(Select s = SEL_MIN);
04010 IntValBranch(Rnd r);
04012 IntValBranch(VoidFunction v, VoidFunction c);
04014 IntValBranch(Select s, IntSharedArray n);
04016 Select select(void) const;
04018 IntSharedArray values(void) const;
04019 };
04020
04026
04027 IntValBranch INT_VAL_MIN(void);
04029 IntValBranch INT_VAL_MED(void);
04031 IntValBranch INT_VAL_MAX(void);
04033 IntValBranch INT_VAL_RND(Rnd r);
04035 IntValBranch INT_VAL_SPLIT_MIN(void);
04037 IntValBranch INT_VAL_SPLIT_MAX(void);
04039 IntValBranch INT_VAL_RANGE_MIN(void);
04041 IntValBranch INT_VAL_RANGE_MAX(void);
04048 IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=NULL);
04055 IntValBranch INT_VAL(BoolBranchVal v, BoolBranchCommit c=NULL);
04057 IntValBranch INT_VALUES_MIN(void);
04059 IntValBranch INT_VALUES_MAX(void);
04061 IntValBranch INT_VAL_NEAR_MIN(IntSharedArray n);
04063 IntValBranch INT_VAL_NEAR_MAX(IntSharedArray n);
04065 IntValBranch INT_VAL_NEAR_INC(IntSharedArray n);
04067 IntValBranch INT_VAL_NEAR_DEC(IntSharedArray n);
04069
04070 }
04071
04072 #include <gecode/int/branch/val.hpp>
04073
04074 namespace Gecode {
04075
04081 class IntAssign : public ValBranch {
04082 public:
04084 enum Select {
04085 SEL_MIN,
04086 SEL_MED,
04087 SEL_MAX,
04088 SEL_RND,
04089 SEL_VAL_COMMIT
04090 };
04091 protected:
04093 Select s;
04094 public:
04096 IntAssign(Select s = SEL_MIN);
04098 IntAssign(Rnd r);
04100 IntAssign(VoidFunction v, VoidFunction c);
04102 Select select(void) const;
04103 };
04104
04110
04111 IntAssign INT_ASSIGN_MIN(void);
04113 IntAssign INT_ASSIGN_MED(void);
04115 IntAssign INT_ASSIGN_MAX(void);
04117 IntAssign INT_ASSIGN_RND(Rnd r);
04124 IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=NULL);
04131 IntAssign INT_ASSIGN(BoolBranchVal v, BoolBranchCommit c=NULL);
04133
04134 }
04135
04136 #include <gecode/int/branch/assign.hpp>
04137
04138 namespace Gecode {
04144 GECODE_INT_EXPORT BrancherHandle
04145 branch(Home home, const IntVarArgs& x,
04146 IntVarBranch vars, IntValBranch vals,
04147 IntBranchFilter bf=NULL,
04148 IntVarValPrint vvp=NULL);
04154 GECODE_INT_EXPORT BrancherHandle
04155 branch(Home home, const IntVarArgs& x,
04156 TieBreak<IntVarBranch> vars, IntValBranch vals,
04157 IntBranchFilter bf=NULL,
04158 IntVarValPrint vvp=NULL);
04164 GECODE_INT_EXPORT BrancherHandle
04165 branch(Home home, IntVar x, IntValBranch vals,
04166 IntVarValPrint vvp=NULL);
04172 GECODE_INT_EXPORT BrancherHandle
04173 branch(Home home, const BoolVarArgs& x,
04174 IntVarBranch vars, IntValBranch vals,
04175 BoolBranchFilter bf=NULL,
04176 BoolVarValPrint vvp=NULL);
04182 GECODE_INT_EXPORT BrancherHandle
04183 branch(Home home, const BoolVarArgs& x,
04184 TieBreak<IntVarBranch> vars, IntValBranch vals,
04185 BoolBranchFilter bf=NULL,
04186 BoolVarValPrint vvp=NULL);
04192 GECODE_INT_EXPORT BrancherHandle
04193 branch(Home home, BoolVar x, IntValBranch vals,
04194 BoolVarValPrint vvp=NULL);
04195
04201 GECODE_INT_EXPORT BrancherHandle
04202 assign(Home home, const IntVarArgs& x, IntAssign vals,
04203 IntBranchFilter ibf=NULL,
04204 IntVarValPrint vvp=NULL);
04210 GECODE_INT_EXPORT BrancherHandle
04211 assign(Home home, IntVar x, IntAssign vals,
04212 IntVarValPrint vvp=NULL);
04218 GECODE_INT_EXPORT BrancherHandle
04219 assign(Home home, const BoolVarArgs& x, IntAssign vals,
04220 BoolBranchFilter bbf=NULL,
04221 BoolVarValPrint vvp=NULL);
04227 GECODE_INT_EXPORT BrancherHandle
04228 assign(Home home, BoolVar x, IntAssign vals,
04229 BoolVarValPrint vvp=NULL);
04230
04231 }
04232
04233 namespace Gecode {
04234
04238 template<class Char, class Traits>
04239 std::basic_ostream<Char,Traits>&
04240 operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
04241
04245 template<class Char, class Traits>
04246 std::basic_ostream<Char,Traits>&
04247 operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
04248
04249 }
04250
04251
04252 namespace Gecode {
04253
04254 namespace Int { namespace LDSB {
04255 class SymmetryObject;
04256 }}
04257
04263 class GECODE_INT_EXPORT SymmetryHandle {
04264 public:
04266 Int::LDSB::SymmetryObject* ref;
04268 void increment(void);
04270 void decrement(void);
04271 public:
04273 SymmetryHandle(void);
04275 SymmetryHandle(Int::LDSB::SymmetryObject* o);
04277 SymmetryHandle(const SymmetryHandle& h);
04279 const SymmetryHandle& operator=(const SymmetryHandle& h);
04281 ~SymmetryHandle(void);
04282 };
04283 class Symmetries;
04285 template<>
04286 class ArrayTraits<ArgArray<SymmetryHandle> > {
04287 public:
04288 typedef Symmetries StorageType;
04289 typedef SymmetryHandle ValueType;
04290 typedef Symmetries ArgsType;
04291 };
04292
04299
04300 class Symmetries : public ArgArray<SymmetryHandle> {};
04301
04302
04303
04305 GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x);
04307 GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const BoolVarArgs& x);
04309 GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x,
04310 const IntArgs& indices);
04312 GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntArgs& v);
04314 GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntSet& v);
04316 GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(IntVar vars);
04322 GECODE_INT_EXPORT
04323 SymmetryHandle VariableSequenceSymmetry(const IntVarArgs& x, int ss);
04329 GECODE_INT_EXPORT
04330 SymmetryHandle VariableSequenceSymmetry(const BoolVarArgs& x, int ss);
04336 GECODE_INT_EXPORT
04337 SymmetryHandle ValueSequenceSymmetry(const IntArgs& v, int ss);
04338
04340 GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
04342 GECODE_INT_EXPORT SymmetryHandle values_reflect(IntVar x);
04344
04356 GECODE_INT_EXPORT BrancherHandle
04357 branch(Home home, const IntVarArgs& x,
04358 IntVarBranch vars, IntValBranch vals,
04359 const Symmetries& syms,
04360 IntBranchFilter bf=NULL, IntVarValPrint vvp=NULL);
04372 GECODE_INT_EXPORT BrancherHandle
04373 branch(Home home, const IntVarArgs& x,
04374 TieBreak<IntVarBranch> vars, IntValBranch vals,
04375 const Symmetries& syms,
04376 IntBranchFilter bf=NULL, IntVarValPrint vvp=NULL);
04388 GECODE_INT_EXPORT BrancherHandle
04389 branch(Home home, const BoolVarArgs& x,
04390 IntVarBranch vars, IntValBranch vals,
04391 const Symmetries& syms,
04392 BoolBranchFilter bf=NULL, BoolVarValPrint vvp=NULL);
04404 GECODE_INT_EXPORT BrancherHandle
04405 branch(Home home, const BoolVarArgs& x,
04406 TieBreak<IntVarBranch> vars, IntValBranch vals,
04407 const Symmetries& syms,
04408 BoolBranchFilter bf=NULL, BoolVarValPrint vvp=NULL);
04409 }
04410
04411 #endif
04412
04413
04414
04415