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
00086 #include "gecode/int/exception.icc"
00087
00088 namespace Gecode { namespace Int {
00089
00097 namespace Limits {
00099 const int max = INT_MAX - 1;
00101 const int min = -max;
00103 void check(int n, const char* l);
00105 void check(double n, const char* l);
00106 }
00107
00108 }}
00109
00110 #include "gecode/int/limits.icc"
00111
00112 namespace Gecode {
00113
00114 class IntSetRanges;
00115
00123 class IntSet : public SharedHandle {
00124 friend class IntSetRanges;
00125 private:
00127 class Range {
00128 public:
00129 int min, max;
00130 };
00131 class IntSetObject : public SharedHandle::Object {
00132 public:
00134 int n;
00136 Range* r;
00138 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00140 GECODE_INT_EXPORT SharedHandle::Object* copy(void) const;
00142 GECODE_INT_EXPORT virtual ~IntSetObject(void);
00143 };
00145 class MinInc;
00147 GECODE_INT_EXPORT void normalize(Range* r, int n);
00149 GECODE_INT_EXPORT void init(int n, int m);
00151 GECODE_INT_EXPORT void init(const int r[], int n);
00153 GECODE_INT_EXPORT void init(const int r[][2], int n);
00154 public:
00156
00157
00158 IntSet(void);
00163 IntSet(int n, int m);
00165 IntSet(const int r[], int n);
00171 IntSet(const int r[][2], int n);
00173 template <class I>
00174 explicit IntSet(I& i);
00175 #ifdef __INTEL_COMPILER
00177 IntSet(const IntSet& s);
00179 IntSet(IntSet& s);
00180 #endif
00181
00182
00184
00185
00186 int size(void) const;
00188
00190
00191
00192 int min(int i) const;
00194 int max(int i) const;
00196 unsigned int width(int i) const;
00198
00200
00201
00202 int min(void) const;
00204 int max(void) const;
00206
00208
00209
00210 GECODE_INT_EXPORT static const IntSet empty;
00212 };
00213
00219 class IntSetRanges {
00220 private:
00222 const IntSet::Range* i;
00224 const IntSet::Range* e;
00225 public:
00227
00228
00229 IntSetRanges(void);
00231 IntSetRanges(const IntSet& s);
00233 void init(const IntSet& s);
00235
00237
00238
00239 bool operator()(void) const;
00241 void operator++(void);
00243
00245
00246
00247 int min(void) const;
00249 int max(void) const;
00251 unsigned int width(void) const;
00253 };
00254
00260 class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00261 public:
00263
00264
00265 IntSetValues(void);
00267 IntSetValues(const IntSet& s);
00269 void init(const IntSet& s);
00271 };
00272
00273 }
00274
00279 GECODE_INT_EXPORT std::ostream&
00280 operator<<(std::ostream&, const Gecode::IntSet& s);
00281
00282 #include "gecode/int/int-set.icc"
00283
00284 #include "gecode/int/var-imp.icc"
00285
00286 namespace Gecode {
00287
00288 namespace Int {
00289 class IntView;
00290 }
00291
00297 class IntVar : public VarBase<Int::IntVarImp> {
00298 friend class IntVarArray;
00299 private:
00300 using VarBase<Int::IntVarImp>::varimp;
00307 void _init(Space* home, int min, int max);
00314 void _init(Space* home, const IntSet& d);
00315 public:
00317
00318
00319 IntVar(void);
00321 IntVar(const IntVar& x);
00323 IntVar(const Int::IntView& x);
00325 IntVar(const Reflection::Var& x);
00337 GECODE_INT_EXPORT IntVar(Space* home, int min ,int max);
00349 GECODE_INT_EXPORT IntVar(Space* home, const IntSet& d);
00361 GECODE_INT_EXPORT void init(Space* home, int min, int max);
00373 GECODE_INT_EXPORT void init(Space* home, const IntSet& d);
00375
00377
00378
00379 int min(void) const;
00381 int max(void) const;
00383 int med(void) const;
00391 int val(void) const;
00392
00394 unsigned int size(void) const;
00396 unsigned int width(void) const;
00398
00400
00401
00402 bool range(void) const;
00404 bool assigned(void) const;
00405
00407 bool in(int n) const;
00409
00411
00412
00413 void update(Space* home, bool share, IntVar& x);
00415 };
00416
00417
00422 class IntVarRanges : public Int::IntVarImpFwd {
00423 public:
00425
00426
00427 IntVarRanges(void);
00429 IntVarRanges(const IntVar& x);
00431 void init(const IntVar& x);
00433 };
00434
00439 class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00440 public:
00442
00443
00444 IntVarValues(void);
00446 IntVarValues(const IntVar& x);
00448 void init(const IntVar& x);
00450 };
00451
00452 namespace Int {
00453 class BoolView;
00454 }
00455
00461 class BoolVar : public VarBase<Int::BoolVarImp> {
00462 friend class BoolVarArray;
00463 private:
00464 using VarBase<Int::BoolVarImp>::varimp;
00471 void _init(Space* home, int min, int max);
00472 public:
00474
00475
00476 BoolVar(void);
00478 BoolVar(const BoolVar& x);
00480 BoolVar(const Int::BoolView& x);
00482 BoolVar(const Reflection::Var& x);
00494 GECODE_INT_EXPORT BoolVar(Space* home, int min, int max);
00506 GECODE_INT_EXPORT void init(Space* home, int min, int max);
00508
00510
00511
00512 int min(void) const;
00514 int max(void) const;
00516 int med(void) const;
00524 int val(void) const;
00525
00527 unsigned int size(void) const;
00529 unsigned int width(void) const;
00531
00533
00534
00535 bool range(void) const;
00537 bool assigned(void) const;
00538
00540 bool in(int n) const;
00542
00544
00545
00546 bool zero(void) const;
00548 bool one(void) const;
00550 bool none(void) const;
00552
00554
00555
00556 void update(Space* home, bool share, BoolVar& x);
00558
00559 };
00560
00561 }
00562
00567 std::ostream&
00568 operator<<(std::ostream&, const Gecode::IntVar& x);
00573 std::ostream&
00574 operator<<(std::ostream&, const Gecode::BoolVar& x);
00575
00576 #include "gecode/int/view.icc"
00577 #include "gecode/int/propagator.icc"
00578
00579 namespace Gecode {
00580
00590
00591 typedef PrimArgArray<int> IntArgs;
00593 typedef VarArgArray<IntVar> IntVarArgs;
00595 typedef VarArgArray<BoolVar> BoolVarArgs;
00597 typedef PrimArgArray<IntSet> IntSetArgs;
00599
00615 class IntVarArray : public VarArray<IntVar> {
00616 public:
00618
00619
00620 IntVarArray(void);
00622 IntVarArray(Space* home, int n);
00624 IntVarArray(const IntVarArray& a);
00636 GECODE_INT_EXPORT
00637 IntVarArray(Space* home, int n, int min, int max);
00649 GECODE_INT_EXPORT
00650 IntVarArray(Space* home, int n, const IntSet& s);
00652 };
00653
00658 class BoolVarArray : public VarArray<BoolVar> {
00659 public:
00661
00662
00663 BoolVarArray(void);
00665 BoolVarArray(Space* home, int n);
00667 BoolVarArray(const BoolVarArray& a);
00679 GECODE_INT_EXPORT
00680 BoolVarArray(Space* home, int n, int min, int max);
00682 };
00683
00684 }
00685
00686 #include "gecode/int/array.icc"
00687
00688 namespace Gecode {
00689
00694 enum IntRelType {
00695 IRT_EQ,
00696 IRT_NQ,
00697 IRT_LQ,
00698 IRT_LE,
00699 IRT_GQ,
00700 IRT_GR
00701 };
00702
00707 enum BoolOpType {
00708 BOT_AND,
00709 BOT_OR,
00710 BOT_IMP,
00711 BOT_EQV,
00712 BOT_XOR
00713 };
00714
00728 enum IntConLevel {
00729 ICL_VAL,
00730 ICL_BND,
00731 ICL_DOM,
00732 ICL_DEF
00733 };
00734
00735
00736
00744
00745 GECODE_INT_EXPORT void
00746 dom(Space* home, IntVar x, int l, int m,
00747 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00749 GECODE_INT_EXPORT void
00750 dom(Space* home, const IntVarArgs& x, int l, int m,
00751 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00752
00754 GECODE_INT_EXPORT void
00755 dom(Space* home, IntVar x, const IntSet& s,
00756 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00758 GECODE_INT_EXPORT void
00759 dom(Space* home, const IntVarArgs& x, const IntSet& s,
00760 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00761
00763 GECODE_INT_EXPORT void
00764 dom(Space* home, IntVar x, int l, int m, BoolVar b,
00765 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00767 GECODE_INT_EXPORT void
00768 dom(Space* home, IntVar x, const IntSet& s, BoolVar b,
00769 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00771
00772
00783 GECODE_INT_EXPORT void
00784 rel(Space* home, IntVar x0, IntRelType r, IntVar x1,
00785 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00791 GECODE_INT_EXPORT void
00792 rel(Space* home, const IntVarArgs& x, IntRelType r, IntVar y,
00793 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00795 GECODE_INT_EXPORT void
00796 rel(Space* home, IntVar x, IntRelType r, int c,
00797 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00799 GECODE_INT_EXPORT void
00800 rel(Space* home, const IntVarArgs& x, IntRelType r, int c,
00801 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00807 GECODE_INT_EXPORT void
00808 rel(Space* home, IntVar x0, IntRelType r, IntVar x1, BoolVar b,
00809 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00815 GECODE_INT_EXPORT void
00816 rel(Space* home, IntVar x, IntRelType r, int c, BoolVar b,
00817 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00835 GECODE_INT_EXPORT void
00836 rel(Space* home, const IntVarArgs& x, IntRelType r,
00837 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00849 GECODE_INT_EXPORT void
00850 rel(Space* home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
00851 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00853
00854
00860
00861 GECODE_INT_EXPORT void
00862 rel(Space* home, BoolVar x0, IntRelType r, BoolVar x1,
00863 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00865 GECODE_INT_EXPORT void
00866 rel(Space* home, BoolVar x0, IntRelType r, BoolVar x1, BoolVar b,
00867 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00869 GECODE_INT_EXPORT void
00870 rel(Space* home, const BoolVarArgs& x, IntRelType r, BoolVar y,
00871 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00878 GECODE_INT_EXPORT void
00879 rel(Space* home, BoolVar x, IntRelType r, int n,
00880 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00887 GECODE_INT_EXPORT void
00888 rel(Space* home, BoolVar x, IntRelType r, int n, BoolVar b,
00889 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00896 GECODE_INT_EXPORT void
00897 rel(Space* home, const BoolVarArgs& x, IntRelType r, int n,
00898 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00907 GECODE_INT_EXPORT void
00908 rel(Space* home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
00909 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00920 GECODE_INT_EXPORT void
00921 rel(Space* home, const BoolVarArgs& x, IntRelType r,
00922 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00927 GECODE_INT_EXPORT void
00928 rel(Space* home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
00929 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00937 GECODE_INT_EXPORT void
00938 rel(Space* home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
00939 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00948 GECODE_INT_EXPORT void
00949 rel(Space* home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
00950 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00962 GECODE_INT_EXPORT void
00963 rel(Space* home, BoolOpType o, const BoolVarArgs& x, int n,
00964 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00966
00967
00979 GECODE_INT_EXPORT void
00980 element(Space* home, const IntArgs& n, IntVar x0, IntVar x1,
00981 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00987 GECODE_INT_EXPORT void
00988 element(Space* home, const IntArgs& n, IntVar x0, BoolVar x1,
00989 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00995 GECODE_INT_EXPORT void
00996 element(Space* home, const IntArgs& n, IntVar x0, int x1,
00997 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01003 GECODE_INT_EXPORT void
01004 element(Space* home, const IntVarArgs& x, IntVar y0, IntVar y1,
01005 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01011 GECODE_INT_EXPORT void
01012 element(Space* home, const IntVarArgs& x, IntVar y0, int y1,
01013 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01015 GECODE_INT_EXPORT void
01016 element(Space* home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01017 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01019 GECODE_INT_EXPORT void
01020 element(Space* home, const BoolVarArgs& x, IntVar y0, int y1,
01021 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01023
01024
01039 GECODE_INT_EXPORT void
01040 distinct(Space* home, const IntVarArgs& x,
01041 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01054 GECODE_INT_EXPORT void
01055 distinct(Space* home, const IntArgs& n, const IntVarArgs& x,
01056 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01058
01059
01077 GECODE_INT_EXPORT void
01078 channel(Space* home, const IntVarArgs& x, const IntVarArgs& y,
01079 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01080
01092 GECODE_INT_EXPORT void
01093 channel(Space* home, const IntVarArgs& x, unsigned int xoff,
01094 const IntVarArgs& y, unsigned int yoff,
01095 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01096
01098 GECODE_INT_EXPORT void
01099 channel(Space* home, BoolVar x0, IntVar x1,
01100 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01102 forceinline void
01103 channel(Space* home, IntVar x0, BoolVar x1,
01104 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01105 channel(home,x1,x0,icl,pk);
01106 }
01112 GECODE_INT_EXPORT void
01113 channel(Space* home, const BoolVarArgs& x, IntVar y, int o=0,
01114 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01116
01117
01136 GECODE_INT_EXPORT void
01137 circuit(Space* home, const IntVarArgs& x,
01138 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01140
01141
01185 GECODE_INT_EXPORT void
01186 cumulatives(Space* home, const IntVarArgs& machine,
01187 const IntVarArgs& start, const IntVarArgs& duration,
01188 const IntVarArgs& end, const IntVarArgs& height,
01189 const IntArgs& limit, bool at_most,
01190 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01195 GECODE_INT_EXPORT void
01196 cumulatives(Space* home, const IntArgs& machine,
01197 const IntVarArgs& start, const IntVarArgs& duration,
01198 const IntVarArgs& end, const IntVarArgs& height,
01199 const IntArgs& limit, bool at_most,
01200 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01205 GECODE_INT_EXPORT void
01206 cumulatives(Space* home, const IntVarArgs& machine,
01207 const IntVarArgs& start, const IntArgs& duration,
01208 const IntVarArgs& end, const IntVarArgs& height,
01209 const IntArgs& limit, bool at_most,
01210 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01215 GECODE_INT_EXPORT void
01216 cumulatives(Space* home, const IntArgs& machine,
01217 const IntVarArgs& start, const IntArgs& duration,
01218 const IntVarArgs& end, const IntVarArgs& height,
01219 const IntArgs& limit, bool at_most,
01220 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01225 GECODE_INT_EXPORT void
01226 cumulatives(Space* home, const IntVarArgs& machine,
01227 const IntVarArgs& start, const IntVarArgs& duration,
01228 const IntVarArgs& end, const IntArgs& height,
01229 const IntArgs& limit, bool at_most,
01230 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01235 GECODE_INT_EXPORT void
01236 cumulatives(Space* home, const IntArgs& machine,
01237 const IntVarArgs& start, const IntVarArgs& duration,
01238 const IntVarArgs& end, const IntArgs& height,
01239 const IntArgs& limit, bool at_most,
01240 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01245 GECODE_INT_EXPORT void
01246 cumulatives(Space* home, const IntVarArgs& machine,
01247 const IntVarArgs& start, const IntArgs& duration,
01248 const IntVarArgs& end, const IntArgs& height,
01249 const IntArgs& limit, bool at_most,
01250 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01255 GECODE_INT_EXPORT void
01256 cumulatives(Space* home, const IntArgs& machine,
01257 const IntVarArgs& start, const IntArgs& duration,
01258 const IntVarArgs& end, const IntArgs& height,
01259 const IntArgs& limit, bool at_most,
01260 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01262
01263
01280 GECODE_INT_EXPORT void
01281 sorted(Space* home, const IntVarArgs& x, const IntVarArgs& y,
01282 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01283
01295 GECODE_INT_EXPORT void
01296 sorted(Space*, const IntVarArgs& x, const IntVarArgs& y,
01297 const IntVarArgs& z,
01298 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01300
01301
01320 GECODE_INT_EXPORT void
01321 count(Space* home, const IntVarArgs& x, int n, IntRelType r, int m,
01322 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01327 GECODE_INT_EXPORT void
01328 count(Space* home, const IntVarArgs& x, IntVar y, IntRelType r, int m,
01329 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01337 GECODE_INT_EXPORT void
01338 count(Space* home, const IntVarArgs& x, const IntArgs& y, IntRelType r, int m,
01339 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01344 GECODE_INT_EXPORT void
01345 count(Space* home, const IntVarArgs& x, int n, IntRelType r, IntVar z,
01346 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01351 GECODE_INT_EXPORT void
01352 count(Space* home, const IntVarArgs& x, IntVar y, IntRelType r, IntVar z,
01353 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01361 GECODE_INT_EXPORT void
01362 count(Space* home, const IntVarArgs& x, const IntArgs& y, IntRelType r, IntVar z,
01363 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01364
01378 GECODE_INT_EXPORT void
01379 count(Space* home, const IntVarArgs& x, const IntVarArgs& c,
01380 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01381
01395 GECODE_INT_EXPORT void
01396 count(Space* home, const IntVarArgs& x, const IntSetArgs& c,
01397 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01398
01415 GECODE_INT_EXPORT void
01416 count(Space* home, const IntVarArgs& x,
01417 const IntVarArgs& c, const IntArgs& v,
01418 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01419
01436 GECODE_INT_EXPORT void
01437 count(Space* home, const IntVarArgs& x,
01438 const IntSetArgs& c, const IntArgs& v,
01439 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01440
01457 GECODE_INT_EXPORT void
01458 count(Space* home, const IntVarArgs& x,
01459 const IntSet& c, const IntArgs& v,
01460 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01461
01463
01476
01484 class DFA : public SharedHandle {
01485 private:
01487 class DFAI;
01488 public:
01490 class Transition {
01491 public:
01492 int i_state;
01493 int symbol;
01494 int o_state;
01495 };
01497 class Transitions {
01498 private:
01500 const Transition* c_trans;
01502 const Transition* e_trans;
01503 public:
01505 Transitions(const DFA& d);
01507 Transitions(const DFA& d, int n);
01509 bool operator()(void) const;
01511 void operator++(void);
01513 int i_state(void) const;
01515 int symbol(void) const;
01517 int o_state(void) const;
01518 };
01520 class Symbols {
01521 private:
01523 const Transition* c_trans;
01525 const Transition* e_trans;
01526 public:
01528 Symbols(const DFA& d);
01530 bool operator()(void) const;
01532 void operator++(void);
01534 int val(void) const;
01535 };
01536 public:
01537 friend class Transitions;
01539 DFA(void);
01551 GECODE_INT_EXPORT
01552 DFA(int s, Transition t[], int f[], bool minimize=true);
01554 DFA(const DFA& d);
01556 unsigned int n_states(void) const;
01558 unsigned int n_symbols(void) const;
01560 unsigned int n_transitions(void) const;
01562 int final_fst(void) const;
01564 int final_lst(void) const;
01566 int symbol_min(void) const;
01568 int symbol_max(void) const;
01569
01571 GECODE_INT_EXPORT DFA(Reflection::VarMap& vm, Reflection::Arg* arg);
01573 GECODE_INT_EXPORT Reflection::Arg* spec(Reflection::VarMap& vm) const;
01574 };
01575
01586 GECODE_INT_EXPORT void
01587 extensional(Space* home, const IntVarArgs& x, DFA d,
01588 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01589
01600 GECODE_INT_EXPORT void
01601 extensional(Space* home, const BoolVarArgs& x, DFA d,
01602 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01603
01610 class TupleSet : public SharedHandle {
01611 public:
01616 typedef int* Tuple;
01617
01619 class TupleSetI;
01621 TupleSetI* implementation(void);
01622
01624 TupleSet(void);
01626 TupleSet(const TupleSet& d);
01627
01629 void add(const IntArgs& tuple);
01631 void finalize(void);
01633 bool finalized(void) const;
01635 int arity(void) const;
01637 int tuples(void) const;
01639 Tuple operator[](int i) const;
01641 int min(void) const;
01643 int max(void) const;
01644
01646 GECODE_INT_EXPORT TupleSet(Reflection::VarMap& vm, Reflection::Arg* arg);
01648 GECODE_INT_EXPORT Reflection::Arg* spec(Reflection::VarMap& vm) const;
01649 };
01650
01667 GECODE_INT_EXPORT void
01668 extensional(Space* home, const IntVarArgs& x, const TupleSet& t,
01669 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01670
01679 GECODE_INT_EXPORT void
01680 extensional(Space* home, const BoolVarArgs& x, const TupleSet& t,
01681 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01683 }
01684
01685 #include "gecode/int/extensional/dfa.icc"
01686 #include "gecode/int/extensional/tuple-set.icc"
01687
01688 namespace Gecode {
01689
01701 GECODE_INT_EXPORT void
01702 min(Space* home, IntVar x0, IntVar x1, IntVar x2,
01703 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01711 GECODE_INT_EXPORT void
01712 min(Space* home, const IntVarArgs& x, IntVar y,
01713 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01719 GECODE_INT_EXPORT void
01720 max(Space* home, IntVar x0, IntVar x1, IntVar x2,
01721 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01729 GECODE_INT_EXPORT void
01730 max(Space* home, const IntVarArgs& x, IntVar y,
01731 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01732
01738 GECODE_INT_EXPORT void
01739 abs(Space* home, IntVar x0, IntVar x1,
01740 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01741
01747 GECODE_INT_EXPORT void
01748 mult(Space* home, IntVar x0, IntVar x1, IntVar x2,
01749 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01750
01756 GECODE_INT_EXPORT void
01757 sqr(Space* home, IntVar x0, IntVar x1,
01758 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01759
01765 GECODE_INT_EXPORT void
01766 sqrt(Space* home, IntVar x0, IntVar x1,
01767 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01768
01773 GECODE_INT_EXPORT void
01774 divmod(Space* home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
01775 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01776
01781 GECODE_INT_EXPORT void
01782 div(Space* home, IntVar x0, IntVar x1, IntVar x2,
01783 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01784
01789 GECODE_INT_EXPORT void
01790 mod(Space* home, IntVar x0, IntVar x1, IntVar x2,
01791 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01793
01823
01824 GECODE_INT_EXPORT void
01825 linear(Space* home, const IntVarArgs& x,
01826 IntRelType r, int c,
01827 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01829 GECODE_INT_EXPORT void
01830 linear(Space* home, const IntVarArgs& x,
01831 IntRelType r, IntVar y,
01832 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01834 GECODE_INT_EXPORT void
01835 linear(Space* home, const IntVarArgs& x,
01836 IntRelType r, int c, BoolVar b,
01837 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01839 GECODE_INT_EXPORT void
01840 linear(Space* home, const IntVarArgs& x,
01841 IntRelType r, IntVar y, BoolVar b,
01842 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01848 GECODE_INT_EXPORT void
01849 linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01850 IntRelType r, int c,
01851 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01857 GECODE_INT_EXPORT void
01858 linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01859 IntRelType r, IntVar y,
01860 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01866 GECODE_INT_EXPORT void
01867 linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01868 IntRelType r, int c, BoolVar b,
01869 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01875 GECODE_INT_EXPORT void
01876 linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01877 IntRelType r, IntVar y, BoolVar b,
01878 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01880
01881
01907
01908 GECODE_INT_EXPORT void
01909 linear(Space* home, const BoolVarArgs& x,
01910 IntRelType r, int c,
01911 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01913 GECODE_INT_EXPORT void
01914 linear(Space* home, const BoolVarArgs& x,
01915 IntRelType r, int c, BoolVar b,
01916 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01918 GECODE_INT_EXPORT void
01919 linear(Space* home, const BoolVarArgs& x,
01920 IntRelType r, IntVar y,
01921 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01923 GECODE_INT_EXPORT void
01924 linear(Space* home, const BoolVarArgs& x,
01925 IntRelType r, IntVar y, BoolVar b,
01926 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01932 GECODE_INT_EXPORT void
01933 linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01934 IntRelType r, int c,
01935 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01941 GECODE_INT_EXPORT void
01942 linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01943 IntRelType r, int c, BoolVar b,
01944 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01950 GECODE_INT_EXPORT void
01951 linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01952 IntRelType r, IntVar y,
01953 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01959 GECODE_INT_EXPORT void
01960 linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01961 IntRelType r, IntVar y, BoolVar b,
01962 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01964
01965
01991 GECODE_INT_EXPORT void
01992 unshare(Space* home, IntVarArgs& x,
01993 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01995 GECODE_INT_EXPORT void
01996 unshare(Space* home, BoolVarArgs& x,
01997 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01999
02000
02006
02007 enum IntVarBranch {
02008 INT_VAR_NONE,
02009 INT_VAR_MIN_MIN,
02010 INT_VAR_MIN_MAX,
02011 INT_VAR_MAX_MIN,
02012 INT_VAR_MAX_MAX,
02013 INT_VAR_SIZE_MIN,
02014 INT_VAR_SIZE_MAX,
02015
02021 INT_VAR_DEGREE_MIN,
02028 INT_VAR_DEGREE_MAX,
02029 INT_VAR_SIZE_DEGREE_MIN,
02030 INT_VAR_SIZE_DEGREE_MAX,
02031
02036 INT_VAR_REGRET_MIN_MIN,
02042 INT_VAR_REGRET_MIN_MAX,
02048 INT_VAR_REGRET_MAX_MIN,
02054 INT_VAR_REGRET_MAX_MAX
02055 };
02056
02058 enum IntValBranch {
02059 INT_VAL_MIN,
02060 INT_VAL_MED,
02061 INT_VAL_MAX,
02062 INT_VAL_SPLIT_MIN,
02063 INT_VAL_SPLIT_MAX
02064 };
02065
02067 GECODE_INT_EXPORT void
02068 branch(Space* home, const IntVarArgs& x,
02069 IntVarBranch vars, IntValBranch vals);
02071 GECODE_INT_EXPORT void
02072 branch(Space* home, const BoolVarArgs& x,
02073 IntVarBranch vars, IntValBranch vals);
02074
02076
02082
02083 enum IntAssign {
02084 INT_ASSIGN_MIN,
02085 INT_ASSIGN_MED,
02086 INT_ASSIGN_MAX
02087 };
02088
02090 GECODE_INT_EXPORT void
02091 assign(Space* home, const IntVarArgs& x, IntAssign vals);
02093 GECODE_INT_EXPORT void
02094 assign(Space* home, const BoolVarArgs& x, IntAssign vals);
02095
02097
02098 }
02099
02103 GECODE_INT_EXPORT std::ostream&
02104 operator<<(std::ostream&, const Gecode::DFA& d);
02105
02109 GECODE_INT_EXPORT std::ostream&
02110 operator<<(std::ostream&, const Gecode::TupleSet& ts);
02111
02112 #endif
02113
02114
02115
02116