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 #include <iostream>
00052
00053 #include <gecode/kernel.hh>
00054 #include <gecode/iter.hh>
00055
00056
00057
00058
00059
00060 #if !defined(GECODE_STATIC_LIBS) && \
00061 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00062
00063 #ifdef GECODE_BUILD_INT
00064 #define GECODE_INT_EXPORT __declspec( dllexport )
00065 #else
00066 #define GECODE_INT_EXPORT __declspec( dllimport )
00067 #endif
00068
00069 #else
00070
00071 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00072 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00073 #else
00074 #define GECODE_INT_EXPORT
00075 #endif
00076
00077 #endif
00078
00079
00080 #ifndef GECODE_BUILD_INT
00081 #define GECODE_LIBRARY_NAME "Int"
00082 #include <gecode/support/auto-link.hpp>
00083 #endif
00084
00096 #include <gecode/int/exception.hpp>
00097
00098 namespace Gecode { namespace Int {
00099
00107 namespace Limits {
00109 const int max = INT_MAX - 1;
00111 const int min = -max;
00113 const int infinity = max + 1;
00115 void check(int n, const char* l);
00117 void check(double n, const char* l);
00119 void positive(int n, const char* l);
00121 void positive(double n, const char* l);
00123 void nonnegative(int n, const char* l);
00125 void nonnegative(double n, const char* l);
00127 const double double_max = 9007199254740991.0;
00129 const double double_min = -9007199254740991.0;
00131 void double_check(double n, const char* l);
00133 const double double_infinity = DBL_MAX;
00134 }
00135
00136 }}
00137
00138 #include <gecode/int/limits.hpp>
00139
00140 namespace Gecode {
00141
00142 class IntSetRanges;
00143
00151 class IntSet : public SharedHandle {
00152 friend class IntSetRanges;
00153 private:
00155 class Range {
00156 public:
00157 int min, max;
00158 };
00159 class IntSetObject : public SharedHandle::Object {
00160 public:
00162 unsigned int size;
00164 int n;
00166 Range* r;
00168 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00170 GECODE_INT_EXPORT SharedHandle::Object* copy(void) const;
00172 GECODE_INT_EXPORT bool in(int n) const;
00174 GECODE_INT_EXPORT virtual ~IntSetObject(void);
00175 };
00177 class MinInc;
00179 GECODE_INT_EXPORT void normalize(Range* r, int n);
00181 GECODE_INT_EXPORT void init(int n, int m);
00183 GECODE_INT_EXPORT void init(const int r[], int n);
00185 GECODE_INT_EXPORT void init(const int r[][2], int n);
00186 public:
00188
00189
00190 IntSet(void);
00195 IntSet(int n, int m);
00197 IntSet(const int r[], int n);
00203 IntSet(const int r[][2], int n);
00205 template<class I>
00206 explicit IntSet(I& i);
00207 #ifdef __INTEL_COMPILER
00208
00209 IntSet(const IntSet& s);
00211 IntSet(IntSet& s);
00213 IntSet(const PrimArgArray<int>& i);
00215 IntSet(PrimArgArray<int>& i);
00216 #endif
00217
00218
00220
00221
00222 int ranges(void) const;
00224 int min(int i) const;
00226 int max(int i) const;
00228 unsigned int width(int i) const;
00230
00232
00233
00234 bool in(int n) const;
00236 unsigned int size(void) const;
00238 unsigned int width(void) const;
00240 int min(void) const;
00242 int max(void) const;
00244
00246
00247
00248 GECODE_INT_EXPORT static const IntSet empty;
00250 };
00251
00257 class IntSetRanges {
00258 private:
00260 const IntSet::Range* i;
00262 const IntSet::Range* e;
00263 public:
00265
00266
00267 IntSetRanges(void);
00269 IntSetRanges(const IntSet& s);
00271 void init(const IntSet& s);
00273
00275
00276
00277 bool operator ()(void) const;
00279 void operator ++(void);
00281
00283
00284
00285 int min(void) const;
00287 int max(void) const;
00289 unsigned int width(void) const;
00291 };
00292
00298 class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00299 public:
00301
00302
00303 IntSetValues(void);
00305 IntSetValues(const IntSet& s);
00307 void init(const IntSet& s);
00309 };
00310
00315 template<class Char, class Traits>
00316 std::basic_ostream<Char,Traits>&
00317 operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
00318
00319 }
00320
00321 #include <gecode/int/int-set-1.hpp>
00322
00323 #include <gecode/int/var-imp.hpp>
00324
00325 namespace Gecode {
00326
00327 namespace Int {
00328 class IntView;
00329 }
00330
00336 class IntVar : public VarBase<Int::IntVarImp> {
00337 friend class IntVarArray;
00338 private:
00339 using VarBase<Int::IntVarImp>::varimp;
00346 void _init(Space& home, int min, int max);
00353 void _init(Space& home, const IntSet& d);
00354 public:
00356
00357
00358 IntVar(void);
00360 IntVar(const IntVar& x);
00362 IntVar(const Int::IntView& x);
00374 GECODE_INT_EXPORT IntVar(Space& home, int min ,int max);
00386 GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
00398 GECODE_INT_EXPORT void init(Space& home, int min, int max);
00410 GECODE_INT_EXPORT void init(Space& home, const IntSet& d);
00412
00414
00415
00416 int min(void) const;
00418 int max(void) const;
00420 int med(void) const;
00428 int val(void) const;
00429
00431 unsigned int size(void) const;
00433 unsigned int width(void) const;
00435 unsigned int regret_min(void) const;
00437 unsigned int regret_max(void) const;
00439
00441
00442
00443 bool range(void) const;
00445 bool assigned(void) const;
00446
00448 bool in(int n) const;
00450
00452
00453
00454 void update(Space& home, bool share, IntVar& x);
00456 };
00457
00462 template<class Char, class Traits>
00463 std::basic_ostream<Char,Traits>&
00464 operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
00465
00470 class IntVarRanges : public Int::IntVarImpFwd {
00471 public:
00473
00474
00475 IntVarRanges(void);
00477 IntVarRanges(const IntVar& x);
00479 void init(const IntVar& x);
00481 };
00482
00487 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00488 public:
00490
00491
00492 IntVarValues(void);
00494 IntVarValues(const IntVar& x);
00496 void init(const IntVar& x);
00498 };
00499
00500 namespace Int {
00501 class BoolView;
00502 }
00503
00509 class BoolVar : public VarBase<Int::BoolVarImp> {
00510 friend class BoolVarArray;
00511 private:
00512 using VarBase<Int::BoolVarImp>::varimp;
00519 void _init(Space& home, int min, int max);
00520 public:
00522
00523
00524 BoolVar(void);
00526 BoolVar(const BoolVar& x);
00528 BoolVar(const Int::BoolView& x);
00540 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
00552 GECODE_INT_EXPORT void init(Space& home, int min, int max);
00554
00556
00557
00558 int min(void) const;
00560 int max(void) const;
00562 int med(void) const;
00570 int val(void) const;
00571
00573 unsigned int size(void) const;
00575 unsigned int width(void) const;
00577 unsigned int regret_min(void) const;
00579 unsigned int regret_max(void) const;
00581
00583
00584
00585 bool range(void) const;
00587 bool assigned(void) const;
00588
00590 bool in(int n) const;
00592
00594
00595
00596 bool zero(void) const;
00598 bool one(void) const;
00600 bool none(void) const;
00602
00604
00605
00606 void update(Space& home, bool share, BoolVar& x);
00608
00609 };
00610
00615 template<class Char, class Traits>
00616 std::basic_ostream<Char,Traits>&
00617 operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
00618
00619 }
00620
00621
00622 #include <gecode/int/view.hpp>
00623 #include <gecode/int/propagator.hpp>
00624
00625 namespace Gecode {
00626
00636
00637 typedef PrimArgArray<int> IntArgs;
00646 class IntVarArgs : public VarArgArray<IntVar> {
00647 public:
00649
00650
00651 explicit IntVarArgs(int n) : VarArgArray<IntVar>(n) {}
00653 IntVarArgs(const IntVarArgs& a) : VarArgArray<IntVar>(a) {}
00655 IntVarArgs(const VarArray<IntVar>& a) : VarArgArray<IntVar>(a) {}
00657 };
00666 class BoolVarArgs : public VarArgArray<BoolVar> {
00667 public:
00669
00670
00671 explicit BoolVarArgs(int n) : VarArgArray<BoolVar>(n) {}
00673 BoolVarArgs(const BoolVarArgs& a) : VarArgArray<BoolVar>(a) {}
00675 BoolVarArgs(const VarArray<BoolVar>& a) : VarArgArray<BoolVar>(a) {}
00677 };
00679 typedef ArgArray<IntSet> IntSetArgs;
00681
00697 class IntVarArray : public VarArray<IntVar> {
00698 public:
00700
00701
00702 IntVarArray(void);
00704 IntVarArray(Space& home, int n);
00706 IntVarArray(const IntVarArray& a);
00718 GECODE_INT_EXPORT
00719 IntVarArray(Space& home, int n, int min, int max);
00731 GECODE_INT_EXPORT
00732 IntVarArray(Space& home, int n, const IntSet& s);
00734 };
00735
00740 class BoolVarArray : public VarArray<BoolVar> {
00741 public:
00743
00744
00745 BoolVarArray(void);
00747 BoolVarArray(Space& home, int n);
00749 BoolVarArray(const BoolVarArray& a);
00761 GECODE_INT_EXPORT
00762 BoolVarArray(Space& home, int n, int min, int max);
00764 };
00765
00766 }
00767
00768 #include <gecode/int/int-set-2.hpp>
00769
00770 #include <gecode/int/array.hpp>
00771
00772 namespace Gecode {
00773
00778 enum IntRelType {
00779 IRT_EQ,
00780 IRT_NQ,
00781 IRT_LQ,
00782 IRT_LE,
00783 IRT_GQ,
00784 IRT_GR
00785 };
00786
00791 enum BoolOpType {
00792 BOT_AND,
00793 BOT_OR,
00794 BOT_IMP,
00795 BOT_EQV,
00796 BOT_XOR
00797 };
00798
00812 enum IntConLevel {
00813 ICL_VAL,
00814 ICL_BND,
00815 ICL_DOM,
00816 ICL_DEF
00817 };
00818
00819
00827
00828 GECODE_INT_EXPORT void
00829 dom(Home home, IntVar x, int n,
00830 IntConLevel icl=ICL_DEF);
00832 GECODE_INT_EXPORT void
00833 dom(Home home, const IntVarArgs& x, int n,
00834 IntConLevel icl=ICL_DEF);
00835
00837 GECODE_INT_EXPORT void
00838 dom(Home home, IntVar x, int l, int m,
00839 IntConLevel icl=ICL_DEF);
00841 GECODE_INT_EXPORT void
00842 dom(Home home, const IntVarArgs& x, int l, int m,
00843 IntConLevel icl=ICL_DEF);
00844
00846 GECODE_INT_EXPORT void
00847 dom(Home home, IntVar x, const IntSet& s,
00848 IntConLevel icl=ICL_DEF);
00850 GECODE_INT_EXPORT void
00851 dom(Home home, const IntVarArgs& x, const IntSet& s,
00852 IntConLevel icl=ICL_DEF);
00853
00855 GECODE_INT_EXPORT void
00856 dom(Home home, IntVar x, int n, BoolVar b,
00857 IntConLevel icl=ICL_DEF);
00859 GECODE_INT_EXPORT void
00860 dom(Home home, IntVar x, int l, int m, BoolVar b,
00861 IntConLevel icl=ICL_DEF);
00863 GECODE_INT_EXPORT void
00864 dom(Home home, IntVar x, const IntSet& s, BoolVar b,
00865 IntConLevel icl=ICL_DEF);
00867
00868
00879 GECODE_INT_EXPORT void
00880 rel(Home home, IntVar x0, IntRelType r, IntVar x1,
00881 IntConLevel icl=ICL_DEF);
00888 GECODE_INT_EXPORT void
00889 rel(Home home, const IntVarArgs& x, IntRelType r, IntVar y,
00890 IntConLevel icl=ICL_DEF);
00894 GECODE_INT_EXPORT void
00895 rel(Home home, IntVar x, IntRelType r, int c,
00896 IntConLevel icl=ICL_DEF);
00900 GECODE_INT_EXPORT void
00901 rel(Home home, const IntVarArgs& x, IntRelType r, int c,
00902 IntConLevel icl=ICL_DEF);
00909 GECODE_INT_EXPORT void
00910 rel(Home home, IntVar x0, IntRelType r, IntVar x1, BoolVar b,
00911 IntConLevel icl=ICL_DEF);
00918 GECODE_INT_EXPORT void
00919 rel(Home home, IntVar x, IntRelType r, int c, BoolVar b,
00920 IntConLevel icl=ICL_DEF);
00939 GECODE_INT_EXPORT void
00940 rel(Home home, const IntVarArgs& x, IntRelType r,
00941 IntConLevel icl=ICL_DEF);
00954 GECODE_INT_EXPORT void
00955 rel(Home home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
00956 IntConLevel icl=ICL_DEF);
00957
00965 GECODE_INT_EXPORT void
00966 rel(Home home, BoolVar x0, IntRelType r, BoolVar x1,
00967 IntConLevel icl=ICL_DEF);
00971 GECODE_INT_EXPORT void
00972 rel(Home home, BoolVar x0, IntRelType r, BoolVar x1, BoolVar b,
00973 IntConLevel icl=ICL_DEF);
00977 GECODE_INT_EXPORT void
00978 rel(Home home, const BoolVarArgs& x, IntRelType r, BoolVar y,
00979 IntConLevel icl=ICL_DEF);
00987 GECODE_INT_EXPORT void
00988 rel(Home home, BoolVar x, IntRelType r, int n,
00989 IntConLevel icl=ICL_DEF);
00997 GECODE_INT_EXPORT void
00998 rel(Home home, BoolVar x, IntRelType r, int n, BoolVar b,
00999 IntConLevel icl=ICL_DEF);
01007 GECODE_INT_EXPORT void
01008 rel(Home home, const BoolVarArgs& x, IntRelType r, int n,
01009 IntConLevel icl=ICL_DEF);
01019 GECODE_INT_EXPORT void
01020 rel(Home home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
01021 IntConLevel icl=ICL_DEF);
01033 GECODE_INT_EXPORT void
01034 rel(Home home, const BoolVarArgs& x, IntRelType r,
01035 IntConLevel icl=ICL_DEF);
01041 GECODE_INT_EXPORT void
01042 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
01043 IntConLevel icl=ICL_DEF);
01052 GECODE_INT_EXPORT void
01053 rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
01054 IntConLevel icl=ICL_DEF);
01064 GECODE_INT_EXPORT void
01065 rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
01066 IntConLevel icl=ICL_DEF);
01079 GECODE_INT_EXPORT void
01080 rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
01081 IntConLevel icl=ICL_DEF);
01092 GECODE_INT_EXPORT void
01093 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01094 BoolVar z, IntConLevel icl=ICL_DEF);
01108 GECODE_INT_EXPORT void
01109 clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01110 int n, IntConLevel icl=ICL_DEF);
01111
01112
01119
01120 typedef SharedArray<int> IntSharedArray;
01126 GECODE_INT_EXPORT void
01127 element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01128 IntConLevel icl=ICL_DEF);
01134 GECODE_INT_EXPORT void
01135 element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01136 IntConLevel icl=ICL_DEF);
01142 GECODE_INT_EXPORT void
01143 element(Home home, IntSharedArray n, IntVar x0, int x1,
01144 IntConLevel icl=ICL_DEF);
01150 GECODE_INT_EXPORT void
01151 element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01152 IntConLevel icl=ICL_DEF);
01158 GECODE_INT_EXPORT void
01159 element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01160 IntConLevel icl=ICL_DEF);
01162 GECODE_INT_EXPORT void
01163 element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01164 IntConLevel icl=ICL_DEF);
01166 GECODE_INT_EXPORT void
01167 element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01168 IntConLevel icl=ICL_DEF);
01169
01178 GECODE_INT_EXPORT void
01179 element(Home home, IntSharedArray a,
01180 IntVar x, int w, IntVar y, int h, IntVar z,
01181 IntConLevel icl=ICL_DEF);
01190 GECODE_INT_EXPORT void
01191 element(Home home, IntSharedArray a,
01192 IntVar x, int w, IntVar y, int h, BoolVar z,
01193 IntConLevel icl=ICL_DEF);
01205 GECODE_INT_EXPORT void
01206 element(Home home, const IntVarArgs& a,
01207 IntVar x, int w, IntVar y, int h, IntVar z,
01208 IntConLevel icl=ICL_DEF);
01217 GECODE_INT_EXPORT void
01218 element(Home home, const BoolVarArgs& a,
01219 IntVar x, int w, IntVar y, int h, BoolVar z,
01220 IntConLevel icl=ICL_DEF);
01222
01223
01238 GECODE_INT_EXPORT void
01239 distinct(Home home, const IntVarArgs& x,
01240 IntConLevel icl=ICL_DEF);
01253 GECODE_INT_EXPORT void
01254 distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01255 IntConLevel icl=ICL_DEF);
01257
01258
01276 GECODE_INT_EXPORT void
01277 channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01278 IntConLevel icl=ICL_DEF);
01279
01293 GECODE_INT_EXPORT void
01294 channel(Home home, const IntVarArgs& x, int xoff,
01295 const IntVarArgs& y, int yoff,
01296 IntConLevel icl=ICL_DEF);
01297
01299 GECODE_INT_EXPORT void
01300 channel(Home home, BoolVar x0, IntVar x1,
01301 IntConLevel icl=ICL_DEF);
01303 forceinline void
01304 channel(Home home, IntVar x0, BoolVar x1,
01305 IntConLevel icl=ICL_DEF) {
01306 channel(home,x1,x0,icl);
01307 }
01313 GECODE_INT_EXPORT void
01314 channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01315 IntConLevel icl=ICL_DEF);
01317
01318
01335 GECODE_INT_EXPORT void
01336 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01337 IntConLevel icl=ICL_DEF);
01338
01350 GECODE_INT_EXPORT void
01351 sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01352 const IntVarArgs& z,
01353 IntConLevel icl=ICL_DEF);
01355
01356
01375 GECODE_INT_EXPORT void
01376 count(Home home, const IntVarArgs& x, int n, IntRelType r, int m,
01377 IntConLevel icl=ICL_DEF);
01382 GECODE_INT_EXPORT void
01383 count(Home home, const IntVarArgs& x, IntVar y, IntRelType r, int m,
01384 IntConLevel icl=ICL_DEF);
01392 GECODE_INT_EXPORT void
01393 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType r, int m,
01394 IntConLevel icl=ICL_DEF);
01399 GECODE_INT_EXPORT void
01400 count(Home home, const IntVarArgs& x, int n, IntRelType r, IntVar z,
01401 IntConLevel icl=ICL_DEF);
01406 GECODE_INT_EXPORT void
01407 count(Home home, const IntVarArgs& x, IntVar y, IntRelType r, IntVar z,
01408 IntConLevel icl=ICL_DEF);
01416 GECODE_INT_EXPORT void
01417 count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType r, IntVar z,
01418 IntConLevel icl=ICL_DEF);
01419
01433 GECODE_INT_EXPORT void
01434 count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01435 IntConLevel icl=ICL_DEF);
01436
01450 GECODE_INT_EXPORT void
01451 count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01452 IntConLevel icl=ICL_DEF);
01453
01470 GECODE_INT_EXPORT void
01471 count(Home home, const IntVarArgs& x,
01472 const IntVarArgs& c, const IntArgs& v,
01473 IntConLevel icl=ICL_DEF);
01474
01491 GECODE_INT_EXPORT void
01492 count(Home home, const IntVarArgs& x,
01493 const IntSetArgs& c, const IntArgs& v,
01494 IntConLevel icl=ICL_DEF);
01495
01512 GECODE_INT_EXPORT void
01513 count(Home home, const IntVarArgs& x,
01514 const IntSet& c, const IntArgs& v,
01515 IntConLevel icl=ICL_DEF);
01516
01518
01539 GECODE_INT_EXPORT void
01540 sequence(Home home, const IntVarArgs& x, const IntSet& s,
01541 int q, int l, int u, IntConLevel icl=ICL_DEF);
01542
01557 GECODE_INT_EXPORT void
01558 sequence(Home home, const BoolVarArgs& x, const IntSet& s,
01559 int q, int l, int u, IntConLevel icl=ICL_DEF);
01560
01562
01575
01583 class DFA : public SharedHandle {
01584 private:
01586 class DFAI;
01587 public:
01589 class Transition {
01590 public:
01591 int i_state;
01592 int symbol;
01593 int o_state;
01594 };
01596 class Transitions {
01597 private:
01599 const Transition* c_trans;
01601 const Transition* e_trans;
01602 public:
01604 Transitions(const DFA& d);
01606 Transitions(const DFA& d, int n);
01608 bool operator ()(void) const;
01610 void operator ++(void);
01612 int i_state(void) const;
01614 int symbol(void) const;
01616 int o_state(void) const;
01617 };
01619 class Symbols {
01620 private:
01622 const Transition* c_trans;
01624 const Transition* e_trans;
01625 public:
01627 Symbols(const DFA& d);
01629 bool operator ()(void) const;
01631 void operator ++(void);
01633 int val(void) const;
01634 };
01635 public:
01636 friend class Transitions;
01638 DFA(void);
01650 GECODE_INT_EXPORT
01651 DFA(int s, Transition t[], int f[], bool minimize=true);
01653 DFA(const DFA& d);
01655 int n_states(void) const;
01657 int n_transitions(void) const;
01659 unsigned int n_symbols(void) const;
01661 unsigned int max_degree(void) const;
01663 int final_fst(void) const;
01665 int final_lst(void) const;
01667 int symbol_min(void) const;
01669 int symbol_max(void) const;
01670 };
01671
01672
01680 enum ExtensionalPropKind {
01681 EPK_DEF,
01682 EPK_SPEED,
01683 EPK_MEMORY
01684 };
01685
01696 GECODE_INT_EXPORT void
01697 extensional(Home home, const IntVarArgs& x, DFA d,
01698 IntConLevel icl=ICL_DEF);
01699
01710 GECODE_INT_EXPORT void
01711 extensional(Home home, const BoolVarArgs& x, DFA d,
01712 IntConLevel icl=ICL_DEF);
01713
01720 class TupleSet : public SharedHandle {
01721 public:
01726 typedef int* Tuple;
01727
01732 class GECODE_VTABLE_EXPORT TupleSetI
01733 : public SharedHandle::Object {
01734 public:
01736 int arity;
01738 int size;
01740 Tuple** tuples;
01742 Tuple* tuple_data;
01744 int* data;
01746 int excess;
01748 int min, max;
01750 unsigned int domsize;
01752 Tuple** last;
01754 Tuple* nullpointer;
01755
01757 template<class T>
01758 void add(T t);
01760 GECODE_INT_EXPORT void finalize(void);
01762 GECODE_INT_EXPORT void resize(void);
01764 bool finalized(void) const;
01766 TupleSetI(void);
01768 GECODE_INT_EXPORT virtual ~TupleSetI(void);
01770 GECODE_INT_EXPORT virtual SharedHandle::Object* copy(void) const;
01771 };
01772
01774 TupleSetI* implementation(void);
01775
01777 TupleSet(void);
01779 TupleSet(const TupleSet& d);
01780
01782 void add(const IntArgs& tuple);
01784 void finalize(void);
01786 bool finalized(void) const;
01788 int arity(void) const;
01790 int tuples(void) const;
01792 Tuple operator [](int i) const;
01794 int min(void) const;
01796 int max(void) const;
01797 };
01798
01817 GECODE_INT_EXPORT void
01818 extensional(Home home, const IntVarArgs& x, const TupleSet& t,
01819 ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
01820
01831 GECODE_INT_EXPORT void
01832 extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
01833 ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
01835
01836 }
01837
01838 #include <gecode/int/extensional/dfa.hpp>
01839 #include <gecode/int/extensional/tuple-set.hpp>
01840
01841 namespace Gecode {
01842
01854 GECODE_INT_EXPORT void
01855 min(Home home, IntVar x0, IntVar x1, IntVar x2,
01856 IntConLevel icl=ICL_DEF);
01864 GECODE_INT_EXPORT void
01865 min(Home home, const IntVarArgs& x, IntVar y,
01866 IntConLevel icl=ICL_DEF);
01872 GECODE_INT_EXPORT void
01873 max(Home home, IntVar x0, IntVar x1, IntVar x2,
01874 IntConLevel icl=ICL_DEF);
01882 GECODE_INT_EXPORT void
01883 max(Home home, const IntVarArgs& x, IntVar y,
01884 IntConLevel icl=ICL_DEF);
01885
01891 GECODE_INT_EXPORT void
01892 abs(Home home, IntVar x0, IntVar x1,
01893 IntConLevel icl=ICL_DEF);
01894
01900 GECODE_INT_EXPORT void
01901 mult(Home home, IntVar x0, IntVar x1, IntVar x2,
01902 IntConLevel icl=ICL_DEF);
01903
01909 GECODE_INT_EXPORT void
01910 sqr(Home home, IntVar x0, IntVar x1,
01911 IntConLevel icl=ICL_DEF);
01912
01918 GECODE_INT_EXPORT void
01919 sqrt(Home home, IntVar x0, IntVar x1,
01920 IntConLevel icl=ICL_DEF);
01921
01926 GECODE_INT_EXPORT void
01927 divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
01928 IntConLevel icl=ICL_DEF);
01929
01934 GECODE_INT_EXPORT void
01935 div(Home home, IntVar x0, IntVar x1, IntVar x2,
01936 IntConLevel icl=ICL_DEF);
01937
01942 GECODE_INT_EXPORT void
01943 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
01944 IntConLevel icl=ICL_DEF);
01946
01978 GECODE_INT_EXPORT void
01979 linear(Home home, const IntVarArgs& x,
01980 IntRelType r, int c,
01981 IntConLevel icl=ICL_DEF);
01985 GECODE_INT_EXPORT void
01986 linear(Home home, const IntVarArgs& x,
01987 IntRelType r, IntVar y,
01988 IntConLevel icl=ICL_DEF);
01992 GECODE_INT_EXPORT void
01993 linear(Home home, const IntVarArgs& x,
01994 IntRelType r, int c, BoolVar b,
01995 IntConLevel icl=ICL_DEF);
01999 GECODE_INT_EXPORT void
02000 linear(Home home, const IntVarArgs& x,
02001 IntRelType r, IntVar y, BoolVar b,
02002 IntConLevel icl=ICL_DEF);
02009 GECODE_INT_EXPORT void
02010 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02011 IntRelType r, int c,
02012 IntConLevel icl=ICL_DEF);
02019 GECODE_INT_EXPORT void
02020 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02021 IntRelType r, IntVar y,
02022 IntConLevel icl=ICL_DEF);
02029 GECODE_INT_EXPORT void
02030 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02031 IntRelType r, int c, BoolVar b,
02032 IntConLevel icl=ICL_DEF);
02039 GECODE_INT_EXPORT void
02040 linear(Home home, const IntArgs& a, const IntVarArgs& x,
02041 IntRelType r, IntVar y, BoolVar b,
02042 IntConLevel icl=ICL_DEF);
02043
02044
02072 GECODE_INT_EXPORT void
02073 linear(Home home, const BoolVarArgs& x,
02074 IntRelType r, int c,
02075 IntConLevel icl=ICL_DEF);
02079 GECODE_INT_EXPORT void
02080 linear(Home home, const BoolVarArgs& x,
02081 IntRelType r, int c, BoolVar b,
02082 IntConLevel icl=ICL_DEF);
02086 GECODE_INT_EXPORT void
02087 linear(Home home, const BoolVarArgs& x,
02088 IntRelType r, IntVar y,
02089 IntConLevel icl=ICL_DEF);
02093 GECODE_INT_EXPORT void
02094 linear(Home home, const BoolVarArgs& x,
02095 IntRelType r, IntVar y, BoolVar b,
02096 IntConLevel icl=ICL_DEF);
02103 GECODE_INT_EXPORT void
02104 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02105 IntRelType r, int c,
02106 IntConLevel icl=ICL_DEF);
02113 GECODE_INT_EXPORT void
02114 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02115 IntRelType r, int c, BoolVar b,
02116 IntConLevel icl=ICL_DEF);
02123 GECODE_INT_EXPORT void
02124 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02125 IntRelType r, IntVar y,
02126 IntConLevel icl=ICL_DEF);
02133 GECODE_INT_EXPORT void
02134 linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02135 IntRelType r, IntVar y, BoolVar b,
02136 IntConLevel icl=ICL_DEF);
02137
02138
02139
02148
02149 GECODE_INT_EXPORT void
02150 wait(Home home, IntVar x, void (*c)(Space& home),
02151 IntConLevel icl=ICL_DEF);
02153 GECODE_INT_EXPORT void
02154 wait(Home home, BoolVar x, void (*c)(Space& home),
02155 IntConLevel icl=ICL_DEF);
02157 GECODE_INT_EXPORT void
02158 wait(Home home, const IntVarArgs& x, void (*c)(Space& home),
02159 IntConLevel icl=ICL_DEF);
02161 GECODE_INT_EXPORT void
02162 wait(Home home, const BoolVarArgs& x, void (*c)(Space& home),
02163 IntConLevel icl=ICL_DEF);
02165 GECODE_INT_EXPORT void
02166 when(Home home, BoolVar x,
02167 void (*t)(Space& home), void (*e)(Space& home)= NULL,
02168 IntConLevel icl=ICL_DEF);
02170
02171
02196 GECODE_INT_EXPORT void
02197 unshare(Home home, IntVarArgs& x,
02198 IntConLevel icl=ICL_DEF);
02200 GECODE_INT_EXPORT void
02201 unshare(Home home, BoolVarArgs& x,
02202 IntConLevel icl=ICL_DEF);
02204
02205
02211
02212 enum IntVarBranch {
02213 INT_VAR_NONE = 0,
02214 INT_VAR_RND,
02215 INT_VAR_DEGREE_MIN,
02216 INT_VAR_DEGREE_MAX,
02217 INT_VAR_AFC_MIN,
02218 INT_VAR_AFC_MAX,
02219 INT_VAR_MIN_MIN,
02220 INT_VAR_MIN_MAX,
02221 INT_VAR_MAX_MIN,
02222 INT_VAR_MAX_MAX,
02223 INT_VAR_SIZE_MIN,
02224 INT_VAR_SIZE_MAX,
02225 INT_VAR_SIZE_DEGREE_MIN,
02226 INT_VAR_SIZE_DEGREE_MAX,
02227 INT_VAR_SIZE_AFC_MIN,
02228 INT_VAR_SIZE_AFC_MAX,
02229
02234 INT_VAR_REGRET_MIN_MIN,
02240 INT_VAR_REGRET_MIN_MAX,
02246 INT_VAR_REGRET_MAX_MIN,
02252 INT_VAR_REGRET_MAX_MAX
02253 };
02254
02256 enum IntValBranch {
02257 INT_VAL_MIN,
02258 INT_VAL_MED,
02259 INT_VAL_MAX,
02260 INT_VAL_RND,
02261 INT_VAL_SPLIT_MIN,
02262 INT_VAL_SPLIT_MAX,
02263 INT_VAL_RANGE_MIN,
02264 INT_VAL_RANGE_MAX,
02265 INT_VALUES_MIN,
02266 INT_VALUES_MAX
02267 };
02268
02270 GECODE_INT_EXPORT void
02271 branch(Home home, const IntVarArgs& x,
02272 IntVarBranch vars, IntValBranch vals,
02273 const VarBranchOptions& o_vars = VarBranchOptions::def,
02274 const ValBranchOptions& o_vals = ValBranchOptions::def);
02276 GECODE_INT_EXPORT void
02277 branch(Home home, const IntVarArgs& x,
02278 const TieBreakVarBranch<IntVarBranch>& vars, IntValBranch vals,
02279 const TieBreakVarBranchOptions& o_vars = TieBreakVarBranchOptions::def,
02280 const ValBranchOptions& o_vals = ValBranchOptions::def);
02282 GECODE_INT_EXPORT void
02283 branch(Home home, IntVar x, IntValBranch vals,
02284 const ValBranchOptions& o_vals = ValBranchOptions::def);
02286 GECODE_INT_EXPORT void
02287 branch(Home home, const BoolVarArgs& x,
02288 IntVarBranch vars, IntValBranch vals,
02289 const VarBranchOptions& o_vars = VarBranchOptions::def,
02290 const ValBranchOptions& o_vals = ValBranchOptions::def);
02292 GECODE_INT_EXPORT void
02293 branch(Home home, const BoolVarArgs& x,
02294 const TieBreakVarBranch<IntVarBranch>& vars, IntValBranch vals,
02295 const TieBreakVarBranchOptions& o_vars = TieBreakVarBranchOptions::def,
02296 const ValBranchOptions& o_vals = ValBranchOptions::def);
02298 GECODE_INT_EXPORT void
02299 branch(Home home, BoolVar x, IntValBranch vals,
02300 const ValBranchOptions& o_vals = ValBranchOptions::def);
02302
02308
02309 enum IntAssign {
02310 INT_ASSIGN_MIN,
02311 INT_ASSIGN_MED,
02312 INT_ASSIGN_MAX,
02313 INT_ASSIGN_RND
02314 };
02315
02317 GECODE_INT_EXPORT void
02318 assign(Home home, const IntVarArgs& x, IntAssign vals,
02319 const ValBranchOptions& o_vals = ValBranchOptions::def);
02321 GECODE_INT_EXPORT void
02322 assign(Home home, IntVar x, IntAssign vals,
02323 const ValBranchOptions& o_vals = ValBranchOptions::def);
02325 GECODE_INT_EXPORT void
02326 assign(Home home, const BoolVarArgs& x, IntAssign vals,
02327 const ValBranchOptions& o_vals = ValBranchOptions::def);
02329 GECODE_INT_EXPORT void
02330 assign(Home home, BoolVar x, IntAssign vals,
02331 const ValBranchOptions& o_vals = ValBranchOptions::def);
02332
02334
02338 template<class Char, class Traits>
02339 std::basic_ostream<Char,Traits>&
02340 operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
02341
02345 template<class Char, class Traits>
02346 std::basic_ostream<Char,Traits>&
02347 operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
02348
02349 }
02350
02351 #endif
02352
02353
02354
02355