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 #ifndef __GECODE_INT_HH__
00044 #define __GECODE_INT_HH__
00045
00046 #include <climits>
00047 #include <iostream>
00048
00049 #include <gecode/kernel.hh>
00050 #include <gecode/iter.hh>
00051
00052
00053
00054
00055
00056 #if !defined(GECODE_STATIC_LIBS) && \
00057 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00058
00059 #ifdef GECODE_BUILD_INT
00060 #define GECODE_INT_EXPORT __declspec( dllexport )
00061 #else
00062 #define GECODE_INT_EXPORT __declspec( dllimport )
00063 #endif
00064
00065 #else
00066
00067 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00068 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00069 #else
00070 #define GECODE_INT_EXPORT
00071 #endif
00072
00073 #endif
00074
00075
00076 #ifndef GECODE_BUILD_INT
00077 #define GECODE_LIBRARY_NAME "Int"
00078 #include <gecode/support/auto-link.hpp>
00079 #endif
00080
00092 #include <gecode/int/exception.hpp>
00093
00094 namespace Gecode { namespace Int {
00095
00103 namespace Limits {
00105 const int max = INT_MAX - 1;
00107 const int min = -max;
00109 void check(int n, const char* l);
00111 void check(double n, const char* l);
00112 }
00113
00114 }}
00115
00116 #include <gecode/int/limits.hpp>
00117
00118 namespace Gecode {
00119
00120 class IntSetRanges;
00121
00129 class IntSet : public SharedHandle {
00130 friend class IntSetRanges;
00131 private:
00133 class Range {
00134 public:
00135 int min, max;
00136 };
00137 class IntSetObject : public SharedHandle::Object {
00138 public:
00140 unsigned int size;
00142 int n;
00144 Range* r;
00146 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00148 GECODE_INT_EXPORT SharedHandle::Object* copy(void) const;
00150 GECODE_INT_EXPORT virtual ~IntSetObject(void);
00151 };
00153 class MinInc;
00155 GECODE_INT_EXPORT void normalize(Range* r, int n);
00157 GECODE_INT_EXPORT void init(int n, int m);
00159 GECODE_INT_EXPORT void init(const int r[], int n);
00161 GECODE_INT_EXPORT void init(const int r[][2], int n);
00162 public:
00164
00165
00166 IntSet(void);
00171 IntSet(int n, int m);
00173 IntSet(const int r[], int n);
00179 IntSet(const int r[][2], int n);
00181 template <class I>
00182 explicit IntSet(I& i);
00183 #ifdef __INTEL_COMPILER
00185 IntSet(const IntSet& s);
00187 IntSet(IntSet& s);
00189 IntSet(const PrimArgArray<int>& i);
00191 IntSet(PrimArgArray<int>& i);
00192 #endif
00193
00194
00196
00197
00198 int ranges(void) const;
00200 int min(int i) const;
00202 int max(int i) const;
00204 unsigned int width(int i) const;
00206
00208
00209
00210 unsigned int size(void) const;
00212 unsigned int width(void) const;
00214 int min(void) const;
00216 int max(void) const;
00218
00220
00221
00222 GECODE_INT_EXPORT static const IntSet empty;
00224 };
00225
00231 class IntSetRanges {
00232 private:
00234 const IntSet::Range* i;
00236 const IntSet::Range* e;
00237 public:
00239
00240
00241 IntSetRanges(void);
00243 IntSetRanges(const IntSet& s);
00245 void init(const IntSet& s);
00247
00249
00250
00251 bool operator ()(void) const;
00253 void operator ++(void);
00255
00257
00258
00259 int min(void) const;
00261 int max(void) const;
00263 unsigned int width(void) const;
00265 };
00266
00272 class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00273 public:
00275
00276
00277 IntSetValues(void);
00279 IntSetValues(const IntSet& s);
00281 void init(const IntSet& s);
00283 };
00284
00289 template<class Char, class Traits>
00290 std::basic_ostream<Char,Traits>&
00291 operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
00292
00293 }
00294
00295 #include <gecode/int/int-set-1.hpp>
00296
00297 #include <gecode/int/var-imp.hpp>
00298
00299 namespace Gecode {
00300
00301 namespace Int {
00302 class IntView;
00303 }
00304
00310 class IntVar : public VarBase<Int::IntVarImp> {
00311 friend class IntVarArray;
00312 private:
00313 using VarBase<Int::IntVarImp>::varimp;
00320 void _init(Space& home, int min, int max);
00327 void _init(Space& home, const IntSet& d);
00328 public:
00330
00331
00332 IntVar(void);
00334 IntVar(const IntVar& x);
00336 IntVar(const Int::IntView& x);
00348 GECODE_INT_EXPORT IntVar(Space& home, int min ,int max);
00360 GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
00372 GECODE_INT_EXPORT void init(Space& home, int min, int max);
00384 GECODE_INT_EXPORT void init(Space& home, const IntSet& d);
00386
00388
00389
00390 int min(void) const;
00392 int max(void) const;
00394 int med(void) const;
00402 int val(void) const;
00403
00405 unsigned int size(void) const;
00407 unsigned int width(void) const;
00409
00411
00412
00413 bool range(void) const;
00415 bool assigned(void) const;
00416
00418 bool in(int n) const;
00420
00422
00423
00424 void update(Space& home, bool share, IntVar& x);
00426 };
00427
00432 template<class Char, class Traits>
00433 std::basic_ostream<Char,Traits>&
00434 operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
00435
00440 class IntVarRanges : public Int::IntVarImpFwd {
00441 public:
00443
00444
00445 IntVarRanges(void);
00447 IntVarRanges(const IntVar& x);
00449 void init(const IntVar& x);
00451 };
00452
00457 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00458 public:
00460
00461
00462 IntVarValues(void);
00464 IntVarValues(const IntVar& x);
00466 void init(const IntVar& x);
00468 };
00469
00470 namespace Int {
00471 class BoolView;
00472 }
00473
00479 class BoolVar : public VarBase<Int::BoolVarImp> {
00480 friend class BoolVarArray;
00481 private:
00482 using VarBase<Int::BoolVarImp>::varimp;
00489 void _init(Space& home, int min, int max);
00490 public:
00492
00493
00494 BoolVar(void);
00496 BoolVar(const BoolVar& x);
00498 BoolVar(const Int::BoolView& x);
00510 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
00522 GECODE_INT_EXPORT void init(Space& home, int min, int max);
00524
00526
00527
00528 int min(void) const;
00530 int max(void) const;
00532 int med(void) const;
00540 int val(void) const;
00541
00543 unsigned int size(void) const;
00545 unsigned int width(void) const;
00547
00549
00550
00551 bool range(void) const;
00553 bool assigned(void) const;
00554
00556 bool in(int n) const;
00558
00560
00561
00562 bool zero(void) const;
00564 bool one(void) const;
00566 bool none(void) const;
00568
00570
00571
00572 void update(Space& home, bool share, BoolVar& x);
00574
00575 };
00576
00581 template<class Char, class Traits>
00582 std::basic_ostream<Char,Traits>&
00583 operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
00584
00585 }
00586
00587
00588 #include <gecode/int/view.hpp>
00589 #include <gecode/int/propagator.hpp>
00590
00591 namespace Gecode {
00592
00602
00603 typedef PrimArgArray<int> IntArgs;
00605 typedef VarArgArray<IntVar> IntVarArgs;
00607 typedef VarArgArray<BoolVar> BoolVarArgs;
00609 typedef ArgArray<IntSet> IntSetArgs;
00611
00627 class IntVarArray : public VarArray<IntVar> {
00628 public:
00630
00631
00632 IntVarArray(void);
00634 IntVarArray(Space& home, int n);
00636 IntVarArray(const IntVarArray& a);
00648 GECODE_INT_EXPORT
00649 IntVarArray(Space& home, int n, int min, int max);
00661 GECODE_INT_EXPORT
00662 IntVarArray(Space& home, int n, const IntSet& s);
00664 };
00665
00670 class BoolVarArray : public VarArray<BoolVar> {
00671 public:
00673
00674
00675 BoolVarArray(void);
00677 BoolVarArray(Space& home, int n);
00679 BoolVarArray(const BoolVarArray& a);
00691 GECODE_INT_EXPORT
00692 BoolVarArray(Space& home, int n, int min, int max);
00694 };
00695
00696 }
00697
00698 #include <gecode/int/int-set-2.hpp>
00699
00700 #include <gecode/int/array.hpp>
00701
00702 namespace Gecode {
00703
00708 enum IntRelType {
00709 IRT_EQ,
00710 IRT_NQ,
00711 IRT_LQ,
00712 IRT_LE,
00713 IRT_GQ,
00714 IRT_GR
00715 };
00716
00721 enum BoolOpType {
00722 BOT_AND,
00723 BOT_OR,
00724 BOT_IMP,
00725 BOT_EQV,
00726 BOT_XOR
00727 };
00728
00742 enum IntConLevel {
00743 ICL_VAL,
00744 ICL_BND,
00745 ICL_DOM,
00746 ICL_DEF
00747 };
00748
00749
00750
00758
00759 GECODE_INT_EXPORT void
00760 dom(Space& home, IntVar x, int n,
00761 IntConLevel icl=ICL_DEF);
00763 GECODE_INT_EXPORT void
00764 dom(Space& home, const IntVarArgs& x, int n,
00765 IntConLevel icl=ICL_DEF);
00766
00768 GECODE_INT_EXPORT void
00769 dom(Space& home, IntVar x, int l, int m,
00770 IntConLevel icl=ICL_DEF);
00772 GECODE_INT_EXPORT void
00773 dom(Space& home, const IntVarArgs& x, int l, int m,
00774 IntConLevel icl=ICL_DEF);
00775
00777 GECODE_INT_EXPORT void
00778 dom(Space& home, IntVar x, const IntSet& s,
00779 IntConLevel icl=ICL_DEF);
00781 GECODE_INT_EXPORT void
00782 dom(Space& home, const IntVarArgs& x, const IntSet& s,
00783 IntConLevel icl=ICL_DEF);
00784
00786 GECODE_INT_EXPORT void
00787 dom(Space& home, IntVar x, int n, BoolVar b,
00788 IntConLevel icl=ICL_DEF);
00790 GECODE_INT_EXPORT void
00791 dom(Space& home, IntVar x, int l, int m, BoolVar b,
00792 IntConLevel icl=ICL_DEF);
00794 GECODE_INT_EXPORT void
00795 dom(Space& home, IntVar x, const IntSet& s, BoolVar b,
00796 IntConLevel icl=ICL_DEF);
00798
00799
00810 GECODE_INT_EXPORT void
00811 rel(Space& home, IntVar x0, IntRelType r, IntVar x1,
00812 IntConLevel icl=ICL_DEF);
00818 GECODE_INT_EXPORT void
00819 rel(Space& home, const IntVarArgs& x, IntRelType r, IntVar y,
00820 IntConLevel icl=ICL_DEF);
00822 GECODE_INT_EXPORT void
00823 rel(Space& home, IntVar x, IntRelType r, int c,
00824 IntConLevel icl=ICL_DEF);
00826 GECODE_INT_EXPORT void
00827 rel(Space& home, const IntVarArgs& x, IntRelType r, int c,
00828 IntConLevel icl=ICL_DEF);
00834 GECODE_INT_EXPORT void
00835 rel(Space& home, IntVar x0, IntRelType r, IntVar x1, BoolVar b,
00836 IntConLevel icl=ICL_DEF);
00842 GECODE_INT_EXPORT void
00843 rel(Space& home, IntVar x, IntRelType r, int c, BoolVar b,
00844 IntConLevel icl=ICL_DEF);
00862 GECODE_INT_EXPORT void
00863 rel(Space& home, const IntVarArgs& x, IntRelType r,
00864 IntConLevel icl=ICL_DEF);
00876 GECODE_INT_EXPORT void
00877 rel(Space& home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
00878 IntConLevel icl=ICL_DEF);
00880
00881
00887
00888 GECODE_INT_EXPORT void
00889 rel(Space& home, BoolVar x0, IntRelType r, BoolVar x1,
00890 IntConLevel icl=ICL_DEF);
00892 GECODE_INT_EXPORT void
00893 rel(Space& home, BoolVar x0, IntRelType r, BoolVar x1, BoolVar b,
00894 IntConLevel icl=ICL_DEF);
00896 GECODE_INT_EXPORT void
00897 rel(Space& home, const BoolVarArgs& x, IntRelType r, BoolVar y,
00898 IntConLevel icl=ICL_DEF);
00905 GECODE_INT_EXPORT void
00906 rel(Space& home, BoolVar x, IntRelType r, int n,
00907 IntConLevel icl=ICL_DEF);
00914 GECODE_INT_EXPORT void
00915 rel(Space& home, BoolVar x, IntRelType r, int n, BoolVar b,
00916 IntConLevel icl=ICL_DEF);
00923 GECODE_INT_EXPORT void
00924 rel(Space& home, const BoolVarArgs& x, IntRelType r, int n,
00925 IntConLevel icl=ICL_DEF);
00934 GECODE_INT_EXPORT void
00935 rel(Space& home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
00936 IntConLevel icl=ICL_DEF);
00947 GECODE_INT_EXPORT void
00948 rel(Space& home, const BoolVarArgs& x, IntRelType r,
00949 IntConLevel icl=ICL_DEF);
00954 GECODE_INT_EXPORT void
00955 rel(Space& home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
00956 IntConLevel icl=ICL_DEF);
00964 GECODE_INT_EXPORT void
00965 rel(Space& home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
00966 IntConLevel icl=ICL_DEF);
00975 GECODE_INT_EXPORT void
00976 rel(Space& home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
00977 IntConLevel icl=ICL_DEF);
00989 GECODE_INT_EXPORT void
00990 rel(Space& home, BoolOpType o, const BoolVarArgs& x, int n,
00991 IntConLevel icl=ICL_DEF);
01001 GECODE_INT_EXPORT void
01002 clause(Space& home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01003 BoolVar z, IntConLevel icl=ICL_DEF);
01016 GECODE_INT_EXPORT void
01017 clause(Space& home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01018 int n, IntConLevel icl=ICL_DEF);
01020
01021
01033 GECODE_INT_EXPORT void
01034 element(Space& home, const IntArgs& n, IntVar x0, IntVar x1,
01035 IntConLevel icl=ICL_DEF);
01041 GECODE_INT_EXPORT void
01042 element(Space& home, const IntArgs& n, IntVar x0, BoolVar x1,
01043 IntConLevel icl=ICL_DEF);
01049 GECODE_INT_EXPORT void
01050 element(Space& home, const IntArgs& n, IntVar x0, int x1,
01051 IntConLevel icl=ICL_DEF);
01057 GECODE_INT_EXPORT void
01058 element(Space& home, const IntVarArgs& x, IntVar y0, IntVar y1,
01059 IntConLevel icl=ICL_DEF);
01065 GECODE_INT_EXPORT void
01066 element(Space& home, const IntVarArgs& x, IntVar y0, int y1,
01067 IntConLevel icl=ICL_DEF);
01069 GECODE_INT_EXPORT void
01070 element(Space& home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01071 IntConLevel icl=ICL_DEF);
01073 GECODE_INT_EXPORT void
01074 element(Space& home, const BoolVarArgs& x, IntVar y0, int y1,
01075 IntConLevel icl=ICL_DEF);
01077
01078
01093 GECODE_INT_EXPORT void
01094 distinct(Space& home, const IntVarArgs& x,
01095 IntConLevel icl=ICL_DEF);
01108 GECODE_INT_EXPORT void
01109 distinct(Space& home, const IntArgs& n, const IntVarArgs& x,
01110 IntConLevel icl=ICL_DEF);
01112
01113
01131 GECODE_INT_EXPORT void
01132 channel(Space& home, const IntVarArgs& x, const IntVarArgs& y,
01133 IntConLevel icl=ICL_DEF);
01134
01148 GECODE_INT_EXPORT void
01149 channel(Space& home, const IntVarArgs& x, int xoff,
01150 const IntVarArgs& y, int yoff,
01151 IntConLevel icl=ICL_DEF);
01152
01154 GECODE_INT_EXPORT void
01155 channel(Space& home, BoolVar x0, IntVar x1,
01156 IntConLevel icl=ICL_DEF);
01158 forceinline void
01159 channel(Space& home, IntVar x0, BoolVar x1,
01160 IntConLevel icl=ICL_DEF) {
01161 channel(home,x1,x0,icl);
01162 }
01168 GECODE_INT_EXPORT void
01169 channel(Space& home, const BoolVarArgs& x, IntVar y, int o=0,
01170 IntConLevel icl=ICL_DEF);
01172
01173
01192 GECODE_INT_EXPORT void
01193 circuit(Space& home, const IntVarArgs& x,
01194 IntConLevel icl=ICL_DEF);
01196
01197
01241 GECODE_INT_EXPORT void
01242 cumulatives(Space& home, const IntVarArgs& machine,
01243 const IntVarArgs& start, const IntVarArgs& duration,
01244 const IntVarArgs& end, const IntVarArgs& height,
01245 const IntArgs& limit, bool at_most,
01246 IntConLevel icl=ICL_DEF);
01251 GECODE_INT_EXPORT void
01252 cumulatives(Space& home, const IntArgs& machine,
01253 const IntVarArgs& start, const IntVarArgs& duration,
01254 const IntVarArgs& end, const IntVarArgs& height,
01255 const IntArgs& limit, bool at_most,
01256 IntConLevel icl=ICL_DEF);
01261 GECODE_INT_EXPORT void
01262 cumulatives(Space& home, const IntVarArgs& machine,
01263 const IntVarArgs& start, const IntArgs& duration,
01264 const IntVarArgs& end, const IntVarArgs& height,
01265 const IntArgs& limit, bool at_most,
01266 IntConLevel icl=ICL_DEF);
01271 GECODE_INT_EXPORT void
01272 cumulatives(Space& home, const IntArgs& machine,
01273 const IntVarArgs& start, const IntArgs& duration,
01274 const IntVarArgs& end, const IntVarArgs& height,
01275 const IntArgs& limit, bool at_most,
01276 IntConLevel icl=ICL_DEF);
01281 GECODE_INT_EXPORT void
01282 cumulatives(Space& home, const IntVarArgs& machine,
01283 const IntVarArgs& start, const IntVarArgs& duration,
01284 const IntVarArgs& end, const IntArgs& height,
01285 const IntArgs& limit, bool at_most,
01286 IntConLevel icl=ICL_DEF);
01291 GECODE_INT_EXPORT void
01292 cumulatives(Space& home, const IntArgs& machine,
01293 const IntVarArgs& start, const IntVarArgs& duration,
01294 const IntVarArgs& end, const IntArgs& height,
01295 const IntArgs& limit, bool at_most,
01296 IntConLevel icl=ICL_DEF);
01301 GECODE_INT_EXPORT void
01302 cumulatives(Space& home, const IntVarArgs& machine,
01303 const IntVarArgs& start, const IntArgs& duration,
01304 const IntVarArgs& end, const IntArgs& height,
01305 const IntArgs& limit, bool at_most,
01306 IntConLevel icl=ICL_DEF);
01311 GECODE_INT_EXPORT void
01312 cumulatives(Space& home, const IntArgs& machine,
01313 const IntVarArgs& start, const IntArgs& duration,
01314 const IntVarArgs& end, const IntArgs& height,
01315 const IntArgs& limit, bool at_most,
01316 IntConLevel icl=ICL_DEF);
01318
01319
01336 GECODE_INT_EXPORT void
01337 sorted(Space& home, const IntVarArgs& x, const IntVarArgs& y,
01338 IntConLevel icl=ICL_DEF);
01339
01351 GECODE_INT_EXPORT void
01352 sorted(Space&, const IntVarArgs& x, const IntVarArgs& y,
01353 const IntVarArgs& z,
01354 IntConLevel icl=ICL_DEF);
01356
01357
01376 GECODE_INT_EXPORT void
01377 count(Space& home, const IntVarArgs& x, int n, IntRelType r, int m,
01378 IntConLevel icl=ICL_DEF);
01383 GECODE_INT_EXPORT void
01384 count(Space& home, const IntVarArgs& x, IntVar y, IntRelType r, int m,
01385 IntConLevel icl=ICL_DEF);
01393 GECODE_INT_EXPORT void
01394 count(Space& home, const IntVarArgs& x, const IntArgs& y, IntRelType r, int m,
01395 IntConLevel icl=ICL_DEF);
01400 GECODE_INT_EXPORT void
01401 count(Space& home, const IntVarArgs& x, int n, IntRelType r, IntVar z,
01402 IntConLevel icl=ICL_DEF);
01407 GECODE_INT_EXPORT void
01408 count(Space& home, const IntVarArgs& x, IntVar y, IntRelType r, IntVar z,
01409 IntConLevel icl=ICL_DEF);
01417 GECODE_INT_EXPORT void
01418 count(Space& home, const IntVarArgs& x, const IntArgs& y, IntRelType r, IntVar z,
01419 IntConLevel icl=ICL_DEF);
01420
01434 GECODE_INT_EXPORT void
01435 count(Space& home, const IntVarArgs& x, const IntVarArgs& c,
01436 IntConLevel icl=ICL_DEF);
01437
01451 GECODE_INT_EXPORT void
01452 count(Space& home, const IntVarArgs& x, const IntSetArgs& c,
01453 IntConLevel icl=ICL_DEF);
01454
01471 GECODE_INT_EXPORT void
01472 count(Space& home, const IntVarArgs& x,
01473 const IntVarArgs& c, const IntArgs& v,
01474 IntConLevel icl=ICL_DEF);
01475
01492 GECODE_INT_EXPORT void
01493 count(Space& home, const IntVarArgs& x,
01494 const IntSetArgs& c, const IntArgs& v,
01495 IntConLevel icl=ICL_DEF);
01496
01513 GECODE_INT_EXPORT void
01514 count(Space& home, const IntVarArgs& x,
01515 const IntSet& c, const IntArgs& v,
01516 IntConLevel icl=ICL_DEF);
01517
01519
01532
01540 class DFA : public SharedHandle {
01541 private:
01543 class DFAI;
01544 public:
01546 class Transition {
01547 public:
01548 int i_state;
01549 int symbol;
01550 int o_state;
01551 };
01553 class Transitions {
01554 private:
01556 const Transition* c_trans;
01558 const Transition* e_trans;
01559 public:
01561 Transitions(const DFA& d);
01563 Transitions(const DFA& d, int n);
01565 bool operator ()(void) const;
01567 void operator ++(void);
01569 int i_state(void) const;
01571 int symbol(void) const;
01573 int o_state(void) const;
01574 };
01576 class Symbols {
01577 private:
01579 const Transition* c_trans;
01581 const Transition* e_trans;
01582 public:
01584 Symbols(const DFA& d);
01586 bool operator ()(void) const;
01588 void operator ++(void);
01590 int val(void) const;
01591 };
01592 public:
01593 friend class Transitions;
01595 DFA(void);
01607 GECODE_INT_EXPORT
01608 DFA(int s, Transition t[], int f[], bool minimize=true);
01610 DFA(const DFA& d);
01612 int n_states(void) const;
01614 int n_transitions(void) const;
01616 unsigned int n_symbols(void) const;
01618 unsigned int max_degree(void) const;
01620 int final_fst(void) const;
01622 int final_lst(void) const;
01624 int symbol_min(void) const;
01626 int symbol_max(void) const;
01627 };
01628
01629
01637 enum ExtensionalPropKind {
01638 EPK_DEF,
01639 EPK_SPEED,
01640 EPK_MEMORY
01641 };
01642
01653 GECODE_INT_EXPORT void
01654 extensional(Space& home, const IntVarArgs& x, DFA d,
01655 IntConLevel icl=ICL_DEF);
01656
01667 GECODE_INT_EXPORT void
01668 extensional(Space& home, const BoolVarArgs& x, DFA d,
01669 IntConLevel icl=ICL_DEF);
01670
01677 class TupleSet : public SharedHandle {
01678 public:
01683 typedef int* Tuple;
01684
01686 class TupleSetI;
01688 TupleSetI* implementation(void);
01689
01691 TupleSet(void);
01693 TupleSet(const TupleSet& d);
01694
01696 void add(const IntArgs& tuple);
01698 void finalize(void);
01700 bool finalized(void) const;
01702 int arity(void) const;
01704 int tuples(void) const;
01706 Tuple operator [](int i) const;
01708 int min(void) const;
01710 int max(void) const;
01711 };
01712
01731 GECODE_INT_EXPORT void
01732 extensional(Space& home, const IntVarArgs& x, const TupleSet& t,
01733 ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
01734
01745 GECODE_INT_EXPORT void
01746 extensional(Space& home, const BoolVarArgs& x, const TupleSet& t,
01747 ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
01749 }
01750
01751 #include <gecode/int/extensional/dfa.hpp>
01752 #include <gecode/int/extensional/tuple-set.hpp>
01753
01754 namespace Gecode {
01755
01767 GECODE_INT_EXPORT void
01768 min(Space& home, IntVar x0, IntVar x1, IntVar x2,
01769 IntConLevel icl=ICL_DEF);
01777 GECODE_INT_EXPORT void
01778 min(Space& home, const IntVarArgs& x, IntVar y,
01779 IntConLevel icl=ICL_DEF);
01785 GECODE_INT_EXPORT void
01786 max(Space& home, IntVar x0, IntVar x1, IntVar x2,
01787 IntConLevel icl=ICL_DEF);
01795 GECODE_INT_EXPORT void
01796 max(Space& home, const IntVarArgs& x, IntVar y,
01797 IntConLevel icl=ICL_DEF);
01798
01804 GECODE_INT_EXPORT void
01805 abs(Space& home, IntVar x0, IntVar x1,
01806 IntConLevel icl=ICL_DEF);
01807
01813 GECODE_INT_EXPORT void
01814 mult(Space& home, IntVar x0, IntVar x1, IntVar x2,
01815 IntConLevel icl=ICL_DEF);
01816
01822 GECODE_INT_EXPORT void
01823 sqr(Space& home, IntVar x0, IntVar x1,
01824 IntConLevel icl=ICL_DEF);
01825
01831 GECODE_INT_EXPORT void
01832 sqrt(Space& home, IntVar x0, IntVar x1,
01833 IntConLevel icl=ICL_DEF);
01834
01839 GECODE_INT_EXPORT void
01840 divmod(Space& home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
01841 IntConLevel icl=ICL_DEF);
01842
01847 GECODE_INT_EXPORT void
01848 div(Space& home, IntVar x0, IntVar x1, IntVar x2,
01849 IntConLevel icl=ICL_DEF);
01850
01855 GECODE_INT_EXPORT void
01856 mod(Space& home, IntVar x0, IntVar x1, IntVar x2,
01857 IntConLevel icl=ICL_DEF);
01859
01889
01890 GECODE_INT_EXPORT void
01891 linear(Space& home, const IntVarArgs& x,
01892 IntRelType r, int c,
01893 IntConLevel icl=ICL_DEF);
01895 GECODE_INT_EXPORT void
01896 linear(Space& home, const IntVarArgs& x,
01897 IntRelType r, IntVar y,
01898 IntConLevel icl=ICL_DEF);
01900 GECODE_INT_EXPORT void
01901 linear(Space& home, const IntVarArgs& x,
01902 IntRelType r, int c, BoolVar b,
01903 IntConLevel icl=ICL_DEF);
01905 GECODE_INT_EXPORT void
01906 linear(Space& home, const IntVarArgs& x,
01907 IntRelType r, IntVar y, BoolVar b,
01908 IntConLevel icl=ICL_DEF);
01914 GECODE_INT_EXPORT void
01915 linear(Space& home, const IntArgs& a, const IntVarArgs& x,
01916 IntRelType r, int c,
01917 IntConLevel icl=ICL_DEF);
01923 GECODE_INT_EXPORT void
01924 linear(Space& home, const IntArgs& a, const IntVarArgs& x,
01925 IntRelType r, IntVar y,
01926 IntConLevel icl=ICL_DEF);
01932 GECODE_INT_EXPORT void
01933 linear(Space& home, const IntArgs& a, const IntVarArgs& x,
01934 IntRelType r, int c, BoolVar b,
01935 IntConLevel icl=ICL_DEF);
01941 GECODE_INT_EXPORT void
01942 linear(Space& home, const IntArgs& a, const IntVarArgs& x,
01943 IntRelType r, IntVar y, BoolVar b,
01944 IntConLevel icl=ICL_DEF);
01946
01947
01973
01974 GECODE_INT_EXPORT void
01975 linear(Space& home, const BoolVarArgs& x,
01976 IntRelType r, int c,
01977 IntConLevel icl=ICL_DEF);
01979 GECODE_INT_EXPORT void
01980 linear(Space& home, const BoolVarArgs& x,
01981 IntRelType r, int c, BoolVar b,
01982 IntConLevel icl=ICL_DEF);
01984 GECODE_INT_EXPORT void
01985 linear(Space& home, const BoolVarArgs& x,
01986 IntRelType r, IntVar y,
01987 IntConLevel icl=ICL_DEF);
01989 GECODE_INT_EXPORT void
01990 linear(Space& home, const BoolVarArgs& x,
01991 IntRelType r, IntVar y, BoolVar b,
01992 IntConLevel icl=ICL_DEF);
01998 GECODE_INT_EXPORT void
01999 linear(Space& home, const IntArgs& a, const BoolVarArgs& x,
02000 IntRelType r, int c,
02001 IntConLevel icl=ICL_DEF);
02007 GECODE_INT_EXPORT void
02008 linear(Space& home, const IntArgs& a, const BoolVarArgs& x,
02009 IntRelType r, int c, BoolVar b,
02010 IntConLevel icl=ICL_DEF);
02016 GECODE_INT_EXPORT void
02017 linear(Space& home, const IntArgs& a, const BoolVarArgs& x,
02018 IntRelType r, IntVar y,
02019 IntConLevel icl=ICL_DEF);
02025 GECODE_INT_EXPORT void
02026 linear(Space& home, const IntArgs& a, const BoolVarArgs& x,
02027 IntRelType r, IntVar y, BoolVar b,
02028 IntConLevel icl=ICL_DEF);
02030
02031
02042
02043 GECODE_INT_EXPORT void
02044 wait(Space& home, IntVar x, void (*c)(Space& home),
02045 IntConLevel icl=ICL_DEF);
02047 GECODE_INT_EXPORT void
02048 wait(Space& home, BoolVar x, void (*c)(Space& home),
02049 IntConLevel icl=ICL_DEF);
02051 GECODE_INT_EXPORT void
02052 wait(Space& home, const IntVarArgs& x, void (*c)(Space& home),
02053 IntConLevel icl=ICL_DEF);
02055 GECODE_INT_EXPORT void
02056 wait(Space& home, const BoolVarArgs& x, void (*c)(Space& home),
02057 IntConLevel icl=ICL_DEF);
02059 GECODE_INT_EXPORT void
02060 when(Space& home, BoolVar x,
02061 void (*t)(Space& home), void (*e)(Space& home)= NULL,
02062 IntConLevel icl=ICL_DEF);
02064
02065
02091 GECODE_INT_EXPORT void
02092 unshare(Space& home, IntVarArgs& x,
02093 IntConLevel icl=ICL_DEF);
02095 GECODE_INT_EXPORT void
02096 unshare(Space& home, BoolVarArgs& x,
02097 IntConLevel icl=ICL_DEF);
02099
02100
02106
02107 enum IntVarBranch {
02108 INT_VAR_NONE = 0,
02109 INT_VAR_RND,
02110 INT_VAR_DEGREE_MIN,
02111 INT_VAR_DEGREE_MAX,
02112 INT_VAR_MIN_MIN,
02113 INT_VAR_MIN_MAX,
02114 INT_VAR_MAX_MIN,
02115 INT_VAR_MAX_MAX,
02116 INT_VAR_SIZE_MIN,
02117 INT_VAR_SIZE_MAX,
02118 INT_VAR_SIZE_DEGREE_MIN,
02119 INT_VAR_SIZE_DEGREE_MAX,
02120
02125 INT_VAR_REGRET_MIN_MIN,
02131 INT_VAR_REGRET_MIN_MAX,
02137 INT_VAR_REGRET_MAX_MIN,
02143 INT_VAR_REGRET_MAX_MAX
02144 };
02145
02147 enum IntValBranch {
02148 INT_VAL_MIN,
02149 INT_VAL_MED,
02150 INT_VAL_MAX,
02151 INT_VAL_RND,
02152 INT_VAL_SPLIT_MIN,
02153 INT_VAL_SPLIT_MAX,
02154 INT_VALUES_MIN,
02155 INT_VALUES_MAX
02156 };
02157
02159 GECODE_INT_EXPORT void
02160 branch(Space& home, const IntVarArgs& x,
02161 IntVarBranch vars, IntValBranch vals,
02162 const VarBranchOptions& o_vars = VarBranchOptions::def,
02163 const ValBranchOptions& o_vals = ValBranchOptions::def);
02165 GECODE_INT_EXPORT void
02166 branch(Space& home, const IntVarArgs& x,
02167 const TieBreakVarBranch<IntVarBranch>& vars, IntValBranch vals,
02168 const TieBreakVarBranchOptions& o_vars = TieBreakVarBranchOptions::def,
02169 const ValBranchOptions& o_vals = ValBranchOptions::def);
02171 GECODE_INT_EXPORT void
02172 branch(Space& home, const BoolVarArgs& x,
02173 IntVarBranch vars, IntValBranch vals,
02174 const VarBranchOptions& o_vars = VarBranchOptions::def,
02175 const ValBranchOptions& o_vals = ValBranchOptions::def);
02177 GECODE_INT_EXPORT void
02178 branch(Space& home, const BoolVarArgs& x,
02179 const TieBreakVarBranch<IntVarBranch>& vars, IntValBranch vals,
02180 const TieBreakVarBranchOptions& o_vars = TieBreakVarBranchOptions::def,
02181 const ValBranchOptions& o_vals = ValBranchOptions::def);
02183
02189
02190 enum IntAssign {
02191 INT_ASSIGN_MIN,
02192 INT_ASSIGN_MED,
02193 INT_ASSIGN_MAX,
02194 INT_ASSIGN_RND
02195 };
02196
02198 GECODE_INT_EXPORT void
02199 assign(Space& home, const IntVarArgs& x, IntAssign vals,
02200 const ValBranchOptions& o_vals = ValBranchOptions::def);
02202 GECODE_INT_EXPORT void
02203 assign(Space& home, const BoolVarArgs& x, IntAssign vals,
02204 const ValBranchOptions& o_vals = ValBranchOptions::def);
02205
02207
02211 template<class Char, class Traits>
02212 std::basic_ostream<Char,Traits>&
02213 operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
02214
02218 template<class Char, class Traits>
02219 std::basic_ostream<Char,Traits>&
02220 operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
02221
02222 }
02223
02224 #endif
02225
02226
02227
02228