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 #ifndef __GECODE_MINIMODEL_HH__
00043 #define __GECODE_MINIMODEL_HH__
00044
00045 #include <gecode/kernel.hh>
00046 #include <gecode/int.hh>
00047 #ifdef GECODE_HAS_SET_VARS
00048 #include <gecode/set.hh>
00049 #endif
00050 #ifdef GECODE_HAS_FLOAT_VARS
00051 #include <gecode/float.hh>
00052 #endif
00053
00054 #include <iostream>
00055
00056
00057
00058
00059
00060
00061 #if !defined(GECODE_STATIC_LIBS) && \
00062 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00063
00064 #ifdef GECODE_BUILD_MINIMODEL
00065 #define GECODE_MINIMODEL_EXPORT __declspec( dllexport )
00066 #else
00067 #define GECODE_MINIMODEL_EXPORT __declspec( dllimport )
00068 #endif
00069
00070 #else
00071
00072 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00073
00074 #define GECODE_MINIMODEL_EXPORT __attribute__ ((visibility("default")))
00075
00076 #else
00077
00078 #define GECODE_MINIMODEL_EXPORT
00079
00080 #endif
00081 #endif
00082
00083
00084 #ifndef GECODE_BUILD_MINIMODEL
00085 #define GECODE_LIBRARY_NAME "MiniModel"
00086 #include <gecode/support/auto-link.hpp>
00087 #endif
00088
00089 namespace Gecode {
00090
00092 namespace MiniModel {}
00093
00094 }
00095
00096 #include <gecode/minimodel/exception.hpp>
00097
00098 namespace Gecode {
00099
00101 class IntPropLevels {
00102 protected:
00103 IntPropLevel _linear2 : _IPL_BITS;
00104 IntPropLevel _linear : _IPL_BITS;
00105 IntPropLevel _abs : _IPL_BITS;
00106 IntPropLevel _max2 : _IPL_BITS;
00107 IntPropLevel _max : _IPL_BITS;
00108 IntPropLevel _min2 : _IPL_BITS;
00109 IntPropLevel _min : _IPL_BITS;
00110 IntPropLevel _mult : _IPL_BITS;
00111 IntPropLevel _div : _IPL_BITS;
00112 IntPropLevel _mod : _IPL_BITS;
00113 IntPropLevel _sqr : _IPL_BITS;
00114 IntPropLevel _sqrt : _IPL_BITS;
00115 IntPropLevel _pow : _IPL_BITS;
00116 IntPropLevel _nroot : _IPL_BITS;
00117 IntPropLevel _element : _IPL_BITS;
00118 IntPropLevel _ite : _IPL_BITS;
00119 public:
00121 IntPropLevels(IntPropLevel ipl=IPL_DEF);
00122
00124 IntPropLevel linear2(void) const;
00126 IntPropLevels& linear2(IntPropLevel ipl);
00128 IntPropLevel linear(void) const;
00130 IntPropLevels& linear(IntPropLevel ipl);
00131
00133 IntPropLevel abs(void) const;
00135 IntPropLevels& abs(IntPropLevel ipl);
00136
00138 IntPropLevel max2(void) const;
00140 IntPropLevels& max2(IntPropLevel ipl);
00142 IntPropLevel max(void) const;
00144 IntPropLevels& max(IntPropLevel ipl);
00146 IntPropLevel min2(void) const;
00148 IntPropLevels& min2(IntPropLevel ipl);
00150 IntPropLevel min(void) const;
00152 IntPropLevels& min(IntPropLevel ipl);
00153
00155 IntPropLevel mult(void) const;
00157 IntPropLevels& mult(IntPropLevel ipl);
00159 IntPropLevel div(void) const;
00161 IntPropLevels& div(IntPropLevel ipl);
00163 IntPropLevel mod(void) const;
00165 IntPropLevels& mod(IntPropLevel ipl);
00166
00168 IntPropLevel sqr(void) const;
00170 IntPropLevels& sqr(IntPropLevel ipl);
00172 IntPropLevel sqrt(void) const;
00174 IntPropLevels& sqrt(IntPropLevel ipl);
00175
00177 IntPropLevel pow(void) const;
00179 IntPropLevels& pow(IntPropLevel ipl);
00181 IntPropLevel nroot(void) const;
00183 IntPropLevels& nroot(IntPropLevel ipl);
00184
00186 IntPropLevel element(void) const;
00188 IntPropLevels& element(IntPropLevel ipl);
00189
00191 IntPropLevel ite(void) const;
00193 IntPropLevels& ite(IntPropLevel ipl);
00194
00196 GECODE_MINIMODEL_EXPORT
00197 static const IntPropLevels def;
00198 };
00199
00200 }
00201
00202 #include <gecode/minimodel/ipl.hpp>
00203
00204 namespace Gecode {
00205
00206 class LinIntRel;
00207 #ifdef GECODE_HAS_SET_VARS
00208 class SetExpr;
00209 #endif
00210 #ifdef GECODE_HAS_FLOAT_VARS
00211 class LinFloatExpr;
00212 #endif
00213
00215 class NonLinIntExpr {
00216 public:
00218 virtual IntVar post(Home home, IntVar* ret,
00219 const IntPropLevels& ipls) const = 0;
00221 virtual void post(Home home, IntRelType irt, int c,
00222 const IntPropLevels& ipls) const = 0;
00224 virtual void post(Home home, IntRelType irt, int c,
00225 BoolVar b, const IntPropLevels& ipls) const = 0;
00227 virtual ~NonLinIntExpr(void);
00229 static IntVar result(Home home, IntVar* x);
00231 static IntVar result(Home home, IntVar* x, IntVar y);
00233 void* operator new(size_t s);
00235 void operator delete(void* p, size_t s);
00236 };
00237
00238 }
00239
00240 #include <gecode/minimodel/int-expr.hpp>
00241
00242 namespace Gecode {
00243
00245 class LinIntExpr {
00246 friend class LinIntRel;
00247 #ifdef GECODE_HAS_SET_VARS
00248 friend class SetExpr;
00249 #endif
00250 #ifdef GECODE_HAS_FLOAT_VARS
00251 friend class LinFloatExpr;
00252 #endif
00253 public:
00255 enum NodeType {
00256 NT_CONST,
00257 NT_VAR_INT,
00258 NT_VAR_BOOL,
00259 NT_NONLIN,
00260 NT_SUM_INT,
00261 NT_SUM_BOOL,
00262 NT_ADD,
00263 NT_SUB,
00264 NT_MUL
00265 };
00266 private:
00268 class Node;
00270 Node* n;
00271 public:
00273 GECODE_MINIMODEL_EXPORT
00274 LinIntExpr(void);
00276 GECODE_MINIMODEL_EXPORT
00277 LinIntExpr(int c);
00279 GECODE_MINIMODEL_EXPORT
00280 LinIntExpr(const IntVar& x, int a=1);
00282 GECODE_MINIMODEL_EXPORT
00283 LinIntExpr(const BoolVar& x, int a=1);
00285 GECODE_MINIMODEL_EXPORT
00286 explicit LinIntExpr(const IntVarArgs& x);
00288 GECODE_MINIMODEL_EXPORT
00289 LinIntExpr(const IntArgs& a, const IntVarArgs& x);
00291 GECODE_MINIMODEL_EXPORT
00292 explicit LinIntExpr(const BoolVarArgs& x);
00294 GECODE_MINIMODEL_EXPORT
00295 LinIntExpr(const IntArgs& a, const BoolVarArgs& x);
00297 GECODE_MINIMODEL_EXPORT
00298 LinIntExpr(const LinIntExpr& e);
00300 GECODE_MINIMODEL_EXPORT
00301 LinIntExpr(const LinIntExpr& e0, NodeType t, const LinIntExpr& e1);
00303 GECODE_MINIMODEL_EXPORT
00304 LinIntExpr(const LinIntExpr& e0, NodeType t, int c);
00306 GECODE_MINIMODEL_EXPORT
00307 LinIntExpr(int a, const LinIntExpr& e);
00309 GECODE_MINIMODEL_EXPORT
00310 explicit LinIntExpr(NonLinIntExpr* e);
00312 GECODE_MINIMODEL_EXPORT
00313 const LinIntExpr& operator =(const LinIntExpr& e);
00315 GECODE_MINIMODEL_EXPORT
00316 void post(Home home, IntRelType irt, const IntPropLevels& ipls) const;
00318 GECODE_MINIMODEL_EXPORT
00319 void post(Home home, IntRelType irt, const BoolVar& b,
00320 const IntPropLevels& ipls) const;
00322 GECODE_MINIMODEL_EXPORT
00323 IntVar post(Home home, const IntPropLevels& ipls) const;
00325 GECODE_MINIMODEL_EXPORT
00326 NonLinIntExpr* nle(void) const;
00328 GECODE_MINIMODEL_EXPORT
00329 ~LinIntExpr(void);
00330 };
00331
00332 class BoolExpr;
00333
00335 class LinIntRel {
00336 friend class BoolExpr;
00337 private:
00339 LinIntExpr e;
00341 IntRelType irt;
00343 static IntRelType neg(IntRelType irt);
00345 LinIntRel(void);
00346 public:
00348 LinIntRel(const LinIntExpr& l, IntRelType irt, const LinIntExpr& r);
00350 LinIntRel(const LinIntExpr& l, IntRelType irt, int r);
00352 LinIntRel(int l, IntRelType irt, const LinIntExpr& r);
00354 void post(Home home, bool t, const IntPropLevels& ipls) const;
00356 void post(Home home, const BoolVar& b, bool t, const IntPropLevels& ipls) const;
00357 };
00358
00377
00378 GECODE_MINIMODEL_EXPORT LinIntExpr
00379 operator +(int, const IntVar&);
00381 GECODE_MINIMODEL_EXPORT LinIntExpr
00382 operator +(int, const BoolVar&);
00384 GECODE_MINIMODEL_EXPORT LinIntExpr
00385 operator +(int, const LinIntExpr&);
00387 GECODE_MINIMODEL_EXPORT LinIntExpr
00388 operator +(const IntVar&, int);
00390 GECODE_MINIMODEL_EXPORT LinIntExpr
00391 operator +(const BoolVar&, int);
00393 GECODE_MINIMODEL_EXPORT LinIntExpr
00394 operator +(const LinIntExpr&, int);
00396 GECODE_MINIMODEL_EXPORT LinIntExpr
00397 operator +(const IntVar&, const IntVar&);
00399 GECODE_MINIMODEL_EXPORT LinIntExpr
00400 operator +(const IntVar&, const BoolVar&);
00402 GECODE_MINIMODEL_EXPORT LinIntExpr
00403 operator +(const BoolVar&, const IntVar&);
00405 GECODE_MINIMODEL_EXPORT LinIntExpr
00406 operator +(const BoolVar&, const BoolVar&);
00408 GECODE_MINIMODEL_EXPORT LinIntExpr
00409 operator +(const IntVar&, const LinIntExpr&);
00411 GECODE_MINIMODEL_EXPORT LinIntExpr
00412 operator +(const BoolVar&, const LinIntExpr&);
00414 GECODE_MINIMODEL_EXPORT LinIntExpr
00415 operator +(const LinIntExpr&, const IntVar&);
00417 GECODE_MINIMODEL_EXPORT LinIntExpr
00418 operator +(const LinIntExpr&, const BoolVar&);
00420 GECODE_MINIMODEL_EXPORT LinIntExpr
00421 operator +(const LinIntExpr&, const LinIntExpr&);
00422
00424 GECODE_MINIMODEL_EXPORT LinIntExpr
00425 operator -(int, const IntVar&);
00427 GECODE_MINIMODEL_EXPORT LinIntExpr
00428 operator -(int, const BoolVar&);
00430 GECODE_MINIMODEL_EXPORT LinIntExpr
00431 operator -(int, const LinIntExpr&);
00433 GECODE_MINIMODEL_EXPORT LinIntExpr
00434 operator -(const IntVar&, int);
00436 GECODE_MINIMODEL_EXPORT LinIntExpr
00437 operator -(const BoolVar&, int);
00439 GECODE_MINIMODEL_EXPORT LinIntExpr
00440 operator -(const LinIntExpr&, int);
00442 GECODE_MINIMODEL_EXPORT LinIntExpr
00443 operator -(const IntVar&, const IntVar&);
00445 GECODE_MINIMODEL_EXPORT LinIntExpr
00446 operator -(const IntVar&, const BoolVar&);
00448 GECODE_MINIMODEL_EXPORT LinIntExpr
00449 operator -(const BoolVar&, const IntVar&);
00451 GECODE_MINIMODEL_EXPORT LinIntExpr
00452 operator -(const BoolVar&, const BoolVar&);
00454 GECODE_MINIMODEL_EXPORT LinIntExpr
00455 operator -(const IntVar&, const LinIntExpr&);
00457 GECODE_MINIMODEL_EXPORT LinIntExpr
00458 operator -(const BoolVar&, const LinIntExpr&);
00460 GECODE_MINIMODEL_EXPORT LinIntExpr
00461 operator -(const LinIntExpr&, const IntVar&);
00463 GECODE_MINIMODEL_EXPORT LinIntExpr
00464 operator -(const LinIntExpr&, const BoolVar&);
00466 GECODE_MINIMODEL_EXPORT LinIntExpr
00467 operator -(const LinIntExpr&, const LinIntExpr&);
00468
00470 GECODE_MINIMODEL_EXPORT LinIntExpr
00471 operator -(const IntVar&);
00473 GECODE_MINIMODEL_EXPORT LinIntExpr
00474 operator -(const BoolVar&);
00476 GECODE_MINIMODEL_EXPORT LinIntExpr
00477 operator -(const LinIntExpr&);
00478
00480 GECODE_MINIMODEL_EXPORT LinIntExpr
00481 operator *(int, const IntVar&);
00483 GECODE_MINIMODEL_EXPORT LinIntExpr
00484 operator *(int, const BoolVar&);
00486 GECODE_MINIMODEL_EXPORT LinIntExpr
00487 operator *(const IntVar&, int);
00489 GECODE_MINIMODEL_EXPORT LinIntExpr
00490 operator *(const BoolVar&, int);
00492 GECODE_MINIMODEL_EXPORT LinIntExpr
00493 operator *(const LinIntExpr&, int);
00495 GECODE_MINIMODEL_EXPORT LinIntExpr
00496 operator *(int, const LinIntExpr&);
00497
00499 GECODE_MINIMODEL_EXPORT LinIntExpr
00500 sum(const IntVarArgs& x);
00502 GECODE_MINIMODEL_EXPORT LinIntExpr
00503 sum(const IntArgs& a, const IntVarArgs& x);
00505 GECODE_MINIMODEL_EXPORT LinIntExpr
00506 sum(const BoolVarArgs& x);
00508 GECODE_MINIMODEL_EXPORT LinIntExpr
00509 sum(const IntArgs& a, const BoolVarArgs& x);
00511 GECODE_MINIMODEL_EXPORT LinIntExpr
00512 sum(const IntArgs& args);
00513
00515 GECODE_MINIMODEL_EXPORT LinIntRel
00516 operator ==(int l, const IntVar& r);
00518 GECODE_MINIMODEL_EXPORT LinIntRel
00519 operator ==(int l, const BoolVar& r);
00521 GECODE_MINIMODEL_EXPORT LinIntRel
00522 operator ==(int l, const LinIntExpr& r);
00524 GECODE_MINIMODEL_EXPORT LinIntRel
00525 operator ==(const IntVar& l, int r);
00527 GECODE_MINIMODEL_EXPORT LinIntRel
00528 operator ==(const BoolVar& l, int r);
00530 GECODE_MINIMODEL_EXPORT LinIntRel
00531 operator ==(const LinIntExpr& l, int r);
00533 GECODE_MINIMODEL_EXPORT LinIntRel
00534 operator ==(const IntVar& l, const IntVar& r);
00536 GECODE_MINIMODEL_EXPORT LinIntRel
00537 operator ==(const IntVar& l, const BoolVar& r);
00539 GECODE_MINIMODEL_EXPORT LinIntRel
00540 operator ==(const BoolVar& l, const IntVar& r);
00542 GECODE_MINIMODEL_EXPORT LinIntRel
00543 operator ==(const BoolVar& l, const BoolVar& r);
00545 GECODE_MINIMODEL_EXPORT LinIntRel
00546 operator ==(const IntVar& l, const LinIntExpr& r);
00548 GECODE_MINIMODEL_EXPORT LinIntRel
00549 operator ==(const BoolVar& l, const LinIntExpr& r);
00551 GECODE_MINIMODEL_EXPORT LinIntRel
00552 operator ==(const LinIntExpr& l, const IntVar& r);
00554 GECODE_MINIMODEL_EXPORT LinIntRel
00555 operator ==(const LinIntExpr& l, const BoolVar& r);
00557 GECODE_MINIMODEL_EXPORT LinIntRel
00558 operator ==(const LinIntExpr& l, const LinIntExpr& r);
00559
00561 GECODE_MINIMODEL_EXPORT LinIntRel
00562 operator !=(int l, const IntVar& r);
00564 GECODE_MINIMODEL_EXPORT LinIntRel
00565 operator !=(int l, const BoolVar& r);
00567 GECODE_MINIMODEL_EXPORT LinIntRel
00568 operator !=(int l, const LinIntExpr& r);
00570 GECODE_MINIMODEL_EXPORT LinIntRel
00571 operator !=(const IntVar& l, int r);
00573 GECODE_MINIMODEL_EXPORT LinIntRel
00574 operator !=(const BoolVar& l, int r);
00576 GECODE_MINIMODEL_EXPORT LinIntRel
00577 operator !=(const LinIntExpr& l, int r);
00579 GECODE_MINIMODEL_EXPORT LinIntRel
00580 operator !=(const IntVar& l, const IntVar& r);
00582 GECODE_MINIMODEL_EXPORT LinIntRel
00583 operator !=(const IntVar& l, const BoolVar& r);
00585 GECODE_MINIMODEL_EXPORT LinIntRel
00586 operator !=(const BoolVar& l, const IntVar& r);
00588 GECODE_MINIMODEL_EXPORT LinIntRel
00589 operator !=(const BoolVar& l, const BoolVar& r);
00591 GECODE_MINIMODEL_EXPORT LinIntRel
00592 operator !=(const IntVar& l, const LinIntExpr& r);
00594 GECODE_MINIMODEL_EXPORT LinIntRel
00595 operator !=(const BoolVar& l, const LinIntExpr& r);
00597 GECODE_MINIMODEL_EXPORT LinIntRel
00598 operator !=(const LinIntExpr& l, const IntVar& r);
00600 GECODE_MINIMODEL_EXPORT LinIntRel
00601 operator !=(const LinIntExpr& l, const BoolVar& r);
00603 GECODE_MINIMODEL_EXPORT LinIntRel
00604 operator !=(const LinIntExpr& l, const LinIntExpr& r);
00605
00607 GECODE_MINIMODEL_EXPORT LinIntRel
00608 operator <(int l, const IntVar& r);
00610 GECODE_MINIMODEL_EXPORT LinIntRel
00611 operator <(int l, const BoolVar& r);
00613 GECODE_MINIMODEL_EXPORT LinIntRel
00614 operator <(int l, const LinIntExpr& r);
00616 GECODE_MINIMODEL_EXPORT LinIntRel
00617 operator <(const IntVar& l, int r);
00619 GECODE_MINIMODEL_EXPORT LinIntRel
00620 operator <(const BoolVar& l, int r);
00622 GECODE_MINIMODEL_EXPORT LinIntRel
00623 operator <(const LinIntExpr& l, int r);
00625 GECODE_MINIMODEL_EXPORT LinIntRel
00626 operator <(const IntVar& l, const IntVar& r);
00628 GECODE_MINIMODEL_EXPORT LinIntRel
00629 operator <(const IntVar& l, const BoolVar& r);
00631 GECODE_MINIMODEL_EXPORT LinIntRel
00632 operator <(const BoolVar& l, const IntVar& r);
00634 GECODE_MINIMODEL_EXPORT LinIntRel
00635 operator <(const BoolVar& l, const BoolVar& r);
00637 GECODE_MINIMODEL_EXPORT LinIntRel
00638 operator <(const IntVar& l, const LinIntExpr& r);
00640 GECODE_MINIMODEL_EXPORT LinIntRel
00641 operator <(const BoolVar& l, const LinIntExpr& r);
00643 GECODE_MINIMODEL_EXPORT LinIntRel
00644 operator <(const LinIntExpr& l, const IntVar& r);
00646 GECODE_MINIMODEL_EXPORT LinIntRel
00647 operator <(const LinIntExpr& l, const BoolVar& r);
00649 GECODE_MINIMODEL_EXPORT LinIntRel
00650 operator <(const LinIntExpr& l, const LinIntExpr& r);
00651
00653 GECODE_MINIMODEL_EXPORT LinIntRel
00654 operator <=(int l, const IntVar& r);
00656 GECODE_MINIMODEL_EXPORT LinIntRel
00657 operator <=(int l, const BoolVar& r);
00659 GECODE_MINIMODEL_EXPORT LinIntRel
00660 operator <=(int l, const LinIntExpr& r);
00662 GECODE_MINIMODEL_EXPORT LinIntRel
00663 operator <=(const IntVar& l, int r);
00665 GECODE_MINIMODEL_EXPORT LinIntRel
00666 operator <=(const BoolVar& l, int r);
00668 GECODE_MINIMODEL_EXPORT LinIntRel
00669 operator <=(const LinIntExpr& l, int r);
00671 GECODE_MINIMODEL_EXPORT LinIntRel
00672 operator <=(const IntVar& l, const IntVar& r);
00674 GECODE_MINIMODEL_EXPORT LinIntRel
00675 operator <=(const IntVar& l, const BoolVar& r);
00677 GECODE_MINIMODEL_EXPORT LinIntRel
00678 operator <=(const BoolVar& l, const IntVar& r);
00680 GECODE_MINIMODEL_EXPORT LinIntRel
00681 operator <=(const BoolVar& l, const BoolVar& r);
00683 GECODE_MINIMODEL_EXPORT LinIntRel
00684 operator <=(const IntVar& l, const LinIntExpr& r);
00686 GECODE_MINIMODEL_EXPORT LinIntRel
00687 operator <=(const BoolVar& l, const LinIntExpr& r);
00689 GECODE_MINIMODEL_EXPORT LinIntRel
00690 operator <=(const LinIntExpr& l, const IntVar& r);
00692 GECODE_MINIMODEL_EXPORT LinIntRel
00693 operator <=(const LinIntExpr& l, const BoolVar& r);
00695 GECODE_MINIMODEL_EXPORT LinIntRel
00696 operator <=(const LinIntExpr& l, const LinIntExpr& r);
00697
00699 GECODE_MINIMODEL_EXPORT LinIntRel
00700 operator >(int l, const IntVar& r);
00702 GECODE_MINIMODEL_EXPORT LinIntRel
00703 operator >(int l, const BoolVar& r);
00705 GECODE_MINIMODEL_EXPORT LinIntRel
00706 operator >(int l, const LinIntExpr& r);
00708 GECODE_MINIMODEL_EXPORT LinIntRel
00709 operator >(const IntVar& l, int r);
00711 GECODE_MINIMODEL_EXPORT LinIntRel
00712 operator >(const BoolVar& l, int r);
00714 GECODE_MINIMODEL_EXPORT LinIntRel
00715 operator >(const LinIntExpr& l, int r);
00717 GECODE_MINIMODEL_EXPORT LinIntRel
00718 operator >(const IntVar& l, const IntVar& r);
00720 GECODE_MINIMODEL_EXPORT LinIntRel
00721 operator >(const IntVar& l, const BoolVar& r);
00723 GECODE_MINIMODEL_EXPORT LinIntRel
00724 operator >(const BoolVar& l, const IntVar& r);
00726 GECODE_MINIMODEL_EXPORT LinIntRel
00727 operator >(const BoolVar& l, const BoolVar& r);
00729 GECODE_MINIMODEL_EXPORT LinIntRel
00730 operator >(const IntVar& l, const LinIntExpr& r);
00732 GECODE_MINIMODEL_EXPORT LinIntRel
00733 operator >(const BoolVar& l, const LinIntExpr& r);
00735 GECODE_MINIMODEL_EXPORT LinIntRel
00736 operator >(const LinIntExpr& l, const IntVar& r);
00738 GECODE_MINIMODEL_EXPORT LinIntRel
00739 operator >(const LinIntExpr& l, const BoolVar& r);
00741 GECODE_MINIMODEL_EXPORT LinIntRel
00742 operator >(const LinIntExpr& l, const LinIntExpr& r);
00743
00745 GECODE_MINIMODEL_EXPORT LinIntRel
00746 operator >=(int l, const IntVar& r);
00748 GECODE_MINIMODEL_EXPORT LinIntRel
00749 operator >=(int l, const BoolVar& r);
00751 GECODE_MINIMODEL_EXPORT LinIntRel
00752 operator >=(int l, const LinIntExpr& r);
00754 GECODE_MINIMODEL_EXPORT LinIntRel
00755 operator >=(const IntVar& l, int r);
00757 GECODE_MINIMODEL_EXPORT LinIntRel
00758 operator >=(const BoolVar& l, int r);
00760 GECODE_MINIMODEL_EXPORT LinIntRel
00761 operator >=(const LinIntExpr& l, int r);
00763 GECODE_MINIMODEL_EXPORT LinIntRel
00764 operator >=(const IntVar& l, const IntVar& r);
00766 GECODE_MINIMODEL_EXPORT LinIntRel
00767 operator >=(const IntVar& l, const BoolVar& r);
00769 GECODE_MINIMODEL_EXPORT LinIntRel
00770 operator >=(const BoolVar& l, const IntVar& r);
00772 GECODE_MINIMODEL_EXPORT LinIntRel
00773 operator >=(const BoolVar& l, const BoolVar& r);
00775 GECODE_MINIMODEL_EXPORT LinIntRel
00776 operator >=(const IntVar& l, const LinIntExpr& r);
00778 GECODE_MINIMODEL_EXPORT LinIntRel
00779 operator >=(const BoolVar& l, const LinIntExpr& r);
00781 GECODE_MINIMODEL_EXPORT LinIntRel
00782 operator >=(const LinIntExpr& l, const IntVar& r);
00784 GECODE_MINIMODEL_EXPORT LinIntRel
00785 operator >=(const LinIntExpr& l, const BoolVar& r);
00787 GECODE_MINIMODEL_EXPORT LinIntRel
00788 operator >=(const LinIntExpr& l, const LinIntExpr& r);
00790
00791 #ifdef GECODE_HAS_FLOAT_VARS
00792
00794 class NonLinFloatExpr {
00795 public:
00797 virtual FloatVar post(Home home, FloatVar* ret) const = 0;
00799 virtual void post(Home home, FloatRelType frt, FloatVal c) const = 0;
00801 virtual void post(Home home, FloatRelType frt, FloatVal c,
00802 BoolVar b) const = 0;
00804 virtual ~NonLinFloatExpr(void);
00806 static FloatVar result(Home home, FloatVar* x);
00808 static FloatVar result(Home home, FloatVar* x, FloatVar y);
00810 void* operator new(size_t s);
00812 void operator delete(void* p, size_t s);
00813 };
00814
00815 }
00816
00817 #include <gecode/minimodel/float-expr.hpp>
00818
00819 namespace Gecode {
00820
00822 class LinFloatExpr {
00823 friend class LinFloatRel;
00824 public:
00826 enum NodeType {
00827 NT_CONST,
00828 NT_VAR,
00829 NT_NONLIN,
00830 NT_SUM,
00831 NT_ADD,
00832 NT_SUB,
00833 NT_MUL
00834 };
00835 private:
00837 class Node;
00838 Node* n;
00839 public:
00841 GECODE_MINIMODEL_EXPORT
00842 LinFloatExpr(void);
00844 GECODE_MINIMODEL_EXPORT
00845 LinFloatExpr(const FloatVal& c);
00847 GECODE_MINIMODEL_EXPORT
00848 LinFloatExpr(const FloatVar& x);
00850 GECODE_MINIMODEL_EXPORT
00851 LinFloatExpr(const FloatVar& x, FloatVal a);
00853 GECODE_MINIMODEL_EXPORT
00854 explicit LinFloatExpr(const FloatVarArgs& x);
00856 GECODE_MINIMODEL_EXPORT
00857 LinFloatExpr(const FloatValArgs& a, const FloatVarArgs& x);
00859 GECODE_MINIMODEL_EXPORT
00860 LinFloatExpr(const LinFloatExpr& e);
00862 GECODE_MINIMODEL_EXPORT
00863 LinFloatExpr(const LinFloatExpr& e0, NodeType t, const LinFloatExpr& e1);
00865 GECODE_MINIMODEL_EXPORT
00866 LinFloatExpr(const LinFloatExpr& e0, NodeType t, const FloatVal& c);
00868 GECODE_MINIMODEL_EXPORT
00869 LinFloatExpr(FloatVal a, const LinFloatExpr& e);
00871 GECODE_MINIMODEL_EXPORT
00872 explicit LinFloatExpr(NonLinFloatExpr* e);
00874 GECODE_MINIMODEL_EXPORT
00875 const LinFloatExpr& operator =(const LinFloatExpr& e);
00877 GECODE_MINIMODEL_EXPORT
00878 void post(Home home, FloatRelType frt) const;
00880 GECODE_MINIMODEL_EXPORT
00881 void post(Home home, FloatRelType frt, const BoolVar& b) const;
00883 GECODE_MINIMODEL_EXPORT
00884 FloatVar post(Home home) const;
00886 GECODE_MINIMODEL_EXPORT
00887 NonLinFloatExpr* nlfe(void) const;
00889 GECODE_MINIMODEL_EXPORT
00890 ~LinFloatExpr(void);
00891 };
00892
00893 class BoolExpr;
00894
00896 class LinFloatRel {
00897 friend class BoolExpr;
00898 private:
00900 LinFloatExpr e;
00902 FloatRelType frt;
00904 static FloatRelType neg(FloatRelType frt);
00906 LinFloatRel(void);
00907 public:
00909 LinFloatRel(const LinFloatExpr& l, FloatRelType frt, const LinFloatExpr& r);
00911 LinFloatRel(const LinFloatExpr& l, FloatRelType frt, FloatVal r);
00913 LinFloatRel(FloatVal l, FloatRelType frt, const LinFloatExpr& r);
00915 void post(Home home, bool t) const;
00917 void post(Home home, const BoolVar& b, bool t) const;
00918 };
00919
00933
00934 GECODE_MINIMODEL_EXPORT LinFloatExpr
00935 operator +(const FloatVal&, const FloatVar&);
00937 GECODE_MINIMODEL_EXPORT LinFloatExpr
00938 operator +(const FloatVal&, const LinFloatExpr&);
00940 GECODE_MINIMODEL_EXPORT LinFloatExpr
00941 operator +(const FloatVar&, const FloatVal&);
00943 GECODE_MINIMODEL_EXPORT LinFloatExpr
00944 operator +(const LinFloatExpr&, const FloatVal&);
00946 GECODE_MINIMODEL_EXPORT LinFloatExpr
00947 operator +(const FloatVar&, const FloatVar&);
00949 GECODE_MINIMODEL_EXPORT LinFloatExpr
00950 operator +(const FloatVar&, const LinFloatExpr&);
00952 GECODE_MINIMODEL_EXPORT LinFloatExpr
00953 operator +(const LinFloatExpr&, const FloatVar&);
00955 GECODE_MINIMODEL_EXPORT LinFloatExpr
00956 operator +(const LinFloatExpr&, const LinFloatExpr&);
00957
00959 GECODE_MINIMODEL_EXPORT LinFloatExpr
00960 operator -(const FloatVal&, const FloatVar&);
00962 GECODE_MINIMODEL_EXPORT LinFloatExpr
00963 operator -(const FloatVal&, const LinFloatExpr&);
00965 GECODE_MINIMODEL_EXPORT LinFloatExpr
00966 operator -(const FloatVar&, const FloatVal&);
00968 GECODE_MINIMODEL_EXPORT LinFloatExpr
00969 operator -(const LinFloatExpr&, const FloatVal&);
00971 GECODE_MINIMODEL_EXPORT LinFloatExpr
00972 operator -(const FloatVar&, const FloatVar&);
00974 GECODE_MINIMODEL_EXPORT LinFloatExpr
00975 operator -(const FloatVar&, const LinFloatExpr&);
00977 GECODE_MINIMODEL_EXPORT LinFloatExpr
00978 operator -(const LinFloatExpr&, const FloatVar&);
00980 GECODE_MINIMODEL_EXPORT LinFloatExpr
00981 operator -(const LinFloatExpr&, const LinFloatExpr&);
00982
00984 GECODE_MINIMODEL_EXPORT LinFloatExpr
00985 operator -(const FloatVar&);
00987 GECODE_MINIMODEL_EXPORT LinFloatExpr
00988 operator -(const LinFloatExpr&);
00989
00991 GECODE_MINIMODEL_EXPORT LinFloatExpr
00992 operator *(const FloatVal&, const FloatVar&);
00994 GECODE_MINIMODEL_EXPORT LinFloatExpr
00995 operator *(const FloatVar&, const FloatVal&);
00997 GECODE_MINIMODEL_EXPORT LinFloatExpr
00998 operator *(const LinFloatExpr&, const FloatVal&);
01000 GECODE_MINIMODEL_EXPORT LinFloatExpr
01001 operator *(const FloatVal&, const LinFloatExpr&);
01002
01004 GECODE_MINIMODEL_EXPORT LinFloatExpr
01005 sum(const FloatVarArgs& x);
01007 GECODE_MINIMODEL_EXPORT LinFloatExpr
01008 sum(const FloatValArgs& a, const FloatVarArgs& x);
01009
01011 GECODE_MINIMODEL_EXPORT LinFloatRel
01012 operator ==(const FloatVal& l, const FloatVar& r);
01014 GECODE_MINIMODEL_EXPORT LinFloatRel
01015 operator ==(const FloatVal& l, const LinFloatExpr& r);
01017 GECODE_MINIMODEL_EXPORT LinFloatRel
01018 operator ==(const FloatVar& l, const FloatVal& r);
01020 GECODE_MINIMODEL_EXPORT LinFloatRel
01021 operator ==(const LinFloatExpr& l, const FloatVal& r);
01023 GECODE_MINIMODEL_EXPORT LinFloatRel
01024 operator ==(const FloatVar& l, const FloatVar& r);
01026 GECODE_MINIMODEL_EXPORT LinFloatRel
01027 operator ==(const FloatVar& l, const LinFloatExpr& r);
01029 GECODE_MINIMODEL_EXPORT LinFloatRel
01030 operator ==(const LinFloatExpr& l, const FloatVar& r);
01032 GECODE_MINIMODEL_EXPORT LinFloatRel
01033 operator ==(const LinFloatExpr& l, const LinFloatExpr& r);
01034
01036 GECODE_MINIMODEL_EXPORT LinFloatRel
01037 operator !=(const FloatVal& l, const FloatVar& r);
01039 GECODE_MINIMODEL_EXPORT LinFloatRel
01040 operator !=(const FloatVal& l, const LinFloatExpr& r);
01042 GECODE_MINIMODEL_EXPORT LinFloatRel
01043 operator !=(const FloatVar& l, const FloatVal& r);
01045 GECODE_MINIMODEL_EXPORT LinFloatRel
01046 operator !=(const LinFloatExpr& l, const FloatVal& r);
01048 GECODE_MINIMODEL_EXPORT LinFloatRel
01049 operator !=(const FloatVar& l, const FloatVar& r);
01051 GECODE_MINIMODEL_EXPORT LinFloatRel
01052 operator !=(const FloatVar& l, const LinFloatExpr& r);
01054 GECODE_MINIMODEL_EXPORT LinFloatRel
01055 operator !=(const LinFloatExpr& l, const FloatVar& r);
01057 GECODE_MINIMODEL_EXPORT LinFloatRel
01058 operator !=(const LinFloatExpr& l, const LinFloatExpr& r);
01059
01061 GECODE_MINIMODEL_EXPORT LinFloatRel
01062 operator <(const FloatVal& l, const FloatVar& r);
01064 GECODE_MINIMODEL_EXPORT LinFloatRel
01065 operator <(const FloatVal& l, const LinFloatExpr& r);
01067 GECODE_MINIMODEL_EXPORT LinFloatRel
01068 operator <(const FloatVar& l, const FloatVal& r);
01070 GECODE_MINIMODEL_EXPORT LinFloatRel
01071 operator <(const LinFloatExpr& l, const FloatVal& r);
01073 GECODE_MINIMODEL_EXPORT LinFloatRel
01074 operator <(const FloatVar& l, const FloatVar& r);
01076 GECODE_MINIMODEL_EXPORT LinFloatRel
01077 operator <(const FloatVar& l, const LinFloatExpr& r);
01079 GECODE_MINIMODEL_EXPORT LinFloatRel
01080 operator <(const LinFloatExpr& l, const FloatVar& r);
01082 GECODE_MINIMODEL_EXPORT LinFloatRel
01083 operator <(const LinFloatExpr& l, const LinFloatExpr& r);
01084
01086 GECODE_MINIMODEL_EXPORT LinFloatRel
01087 operator <=(const FloatVal& l, const FloatVar& r);
01089 GECODE_MINIMODEL_EXPORT LinFloatRel
01090 operator <=(const FloatVal& l, const LinFloatExpr& r);
01092 GECODE_MINIMODEL_EXPORT LinFloatRel
01093 operator <=(const FloatVar& l, const FloatVal& r);
01095 GECODE_MINIMODEL_EXPORT LinFloatRel
01096 operator <=(const LinFloatExpr& l, const FloatVal& r);
01098 GECODE_MINIMODEL_EXPORT LinFloatRel
01099 operator <=(const FloatVar& l, const FloatVar& r);
01101 GECODE_MINIMODEL_EXPORT LinFloatRel
01102 operator <=(const FloatVar& l, const LinFloatExpr& r);
01104 GECODE_MINIMODEL_EXPORT LinFloatRel
01105 operator <=(const LinFloatExpr& l, const FloatVar& r);
01107 GECODE_MINIMODEL_EXPORT LinFloatRel
01108 operator <=(const LinFloatExpr& l, const LinFloatExpr& r);
01109
01111 GECODE_MINIMODEL_EXPORT LinFloatRel
01112 operator >(const FloatVal& l, const FloatVar& r);
01114 GECODE_MINIMODEL_EXPORT LinFloatRel
01115 operator >(const FloatVal& l, const LinFloatExpr& r);
01117 GECODE_MINIMODEL_EXPORT LinFloatRel
01118 operator >(const FloatVar& l, const FloatVal& r);
01120 GECODE_MINIMODEL_EXPORT LinFloatRel
01121 operator >(const LinFloatExpr& l, const FloatVal& r);
01123 GECODE_MINIMODEL_EXPORT LinFloatRel
01124 operator >(const FloatVar& l, const FloatVar& r);
01126 GECODE_MINIMODEL_EXPORT LinFloatRel
01127 operator >(const FloatVar& l, const LinFloatExpr& r);
01129 GECODE_MINIMODEL_EXPORT LinFloatRel
01130 operator >(const LinFloatExpr& l, const FloatVar& r);
01132 GECODE_MINIMODEL_EXPORT LinFloatRel
01133 operator >(const LinFloatExpr& l, const LinFloatExpr& r);
01134
01136 GECODE_MINIMODEL_EXPORT LinFloatRel
01137 operator >=(const FloatVal& l, const FloatVar& r);
01139 GECODE_MINIMODEL_EXPORT LinFloatRel
01140 operator >=(const FloatVal& l, const LinFloatExpr& r);
01142 GECODE_MINIMODEL_EXPORT LinFloatRel
01143 operator >=(const FloatVar& l, const FloatVal& r);
01145 GECODE_MINIMODEL_EXPORT LinFloatRel
01146 operator >=(const LinFloatExpr& l, const FloatVal& r);
01148 GECODE_MINIMODEL_EXPORT LinFloatRel
01149 operator >=(const FloatVar& l, const FloatVar& r);
01151 GECODE_MINIMODEL_EXPORT LinFloatRel
01152 operator >=(const FloatVar& l, const LinFloatExpr& r);
01154 GECODE_MINIMODEL_EXPORT LinFloatRel
01155 operator >=(const LinFloatExpr& l, const FloatVar& r);
01157 GECODE_MINIMODEL_EXPORT LinFloatRel
01158 operator >=(const LinFloatExpr& l, const LinFloatExpr& r);
01160 #endif
01161
01162 #ifdef GECODE_HAS_SET_VARS
01163
01164 class SetExpr {
01165 public:
01167 enum NodeType {
01168 NT_VAR,
01169 NT_CONST,
01170 NT_LEXP,
01171 NT_CMPL,
01172 NT_INTER,
01173 NT_UNION,
01174 NT_DUNION
01175 };
01177 class Node;
01178 private:
01180 Node* n;
01181 public:
01183 SetExpr(void);
01185 GECODE_MINIMODEL_EXPORT
01186 SetExpr(const SetExpr& e);
01188 GECODE_MINIMODEL_EXPORT
01189 SetExpr(const SetExpr& l, NodeType t, const SetExpr& r);
01191 GECODE_MINIMODEL_EXPORT
01192 SetExpr(const SetVar& x);
01194 GECODE_MINIMODEL_EXPORT
01195 explicit SetExpr(const LinIntExpr& x);
01197 GECODE_MINIMODEL_EXPORT
01198 SetExpr(const IntSet& s);
01200 GECODE_MINIMODEL_EXPORT
01201 SetExpr(const SetExpr& e, NodeType t);
01203 GECODE_MINIMODEL_EXPORT
01204 SetVar post(Home home) const;
01206 GECODE_MINIMODEL_EXPORT
01207 void post(Home home, SetRelType srt, const SetExpr& e) const;
01209 GECODE_MINIMODEL_EXPORT
01210 void post(Home home, BoolVar b, bool t,
01211 SetRelType srt, const SetExpr& e) const;
01213 GECODE_MINIMODEL_EXPORT
01214 const SetExpr& operator =(const SetExpr& e);
01216 GECODE_MINIMODEL_EXPORT
01217 ~SetExpr(void);
01218 };
01219
01221 class SetCmpRel {
01222 public:
01224 SetExpr l;
01226 SetExpr r;
01228 SetRelType srt;
01230 SetCmpRel(const SetExpr& l, SetRelType srt, const SetExpr& r);
01231 };
01232
01234 class SetRel {
01235 private:
01237 SetExpr _e0;
01239 SetRelType _srt;
01241 SetExpr _e1;
01242 public:
01244 SetRel(void);
01246 SetRel(const SetExpr& e0, SetRelType srt, const SetExpr& e1);
01248 SetRel(const SetCmpRel& r);
01250 void post(Home home, bool t) const;
01252 void post(Home home, BoolVar b, bool t) const;
01253 };
01254
01265
01266 GECODE_MINIMODEL_EXPORT SetExpr
01267 singleton(const LinIntExpr&);
01269 GECODE_MINIMODEL_EXPORT SetExpr
01270 operator -(const SetExpr&);
01272 GECODE_MINIMODEL_EXPORT SetExpr
01273 operator &(const SetExpr&, const SetExpr&);
01275 GECODE_MINIMODEL_EXPORT SetExpr
01276 operator |(const SetExpr&, const SetExpr&);
01278 GECODE_MINIMODEL_EXPORT SetExpr
01279 operator +(const SetExpr&, const SetExpr&);
01281 GECODE_MINIMODEL_EXPORT SetExpr
01282 operator -(const SetExpr&, const SetExpr&);
01283
01285 GECODE_MINIMODEL_EXPORT SetExpr
01286 inter(const SetVarArgs&);
01288 GECODE_MINIMODEL_EXPORT SetExpr
01289 setunion(const SetVarArgs&);
01291 GECODE_MINIMODEL_EXPORT SetExpr
01292 setdunion(const SetVarArgs&);
01293
01295 GECODE_MINIMODEL_EXPORT LinIntExpr
01296 cardinality(const SetExpr&);
01298 GECODE_MINIMODEL_EXPORT LinIntExpr
01299 min(const SetExpr&);
01301 GECODE_MINIMODEL_EXPORT LinIntExpr
01302 max(const SetExpr&);
01303
01305 GECODE_MINIMODEL_EXPORT SetRel
01306 operator ==(const SetExpr&, const SetExpr&);
01308 GECODE_MINIMODEL_EXPORT SetRel
01309 operator !=(const SetExpr&, const SetExpr&);
01311 GECODE_MINIMODEL_EXPORT SetCmpRel
01312 operator <=(const SetExpr&, const SetExpr&);
01314 GECODE_MINIMODEL_EXPORT BoolExpr
01315 operator <=(const SetCmpRel&, const SetExpr&);
01317 GECODE_MINIMODEL_EXPORT SetCmpRel
01318 operator >=(const SetExpr&, const SetExpr&);
01320 GECODE_MINIMODEL_EXPORT BoolExpr
01321 operator >=(const SetCmpRel&, const SetExpr&);
01323 GECODE_MINIMODEL_EXPORT SetRel
01324 operator ||(const SetExpr&, const SetExpr&);
01326 #endif
01327
01329 class BoolExpr {
01330 public:
01332 enum NodeType {
01333 NT_VAR,
01334 NT_NOT,
01335 NT_AND,
01336 NT_OR,
01337 NT_EQV,
01338 NT_RLIN,
01339 NT_RLINFLOAT,
01340 NT_RSET,
01341 NT_MISC
01342 };
01344 class GECODE_VTABLE_EXPORT Misc : public HeapAllocated {
01345 public:
01347 Misc(void);
01352 virtual void post(Home home, BoolVar b, bool neg,
01353 const IntPropLevels& ipls) = 0;
01355 virtual GECODE_MINIMODEL_EXPORT ~Misc(void);
01356 };
01358 class Node;
01359 private:
01361 Node* n;
01362 public:
01364 GECODE_MINIMODEL_EXPORT
01365 BoolExpr(void);
01367 GECODE_MINIMODEL_EXPORT
01368 BoolExpr(const BoolExpr& e);
01370 GECODE_MINIMODEL_EXPORT
01371 BoolExpr(const BoolExpr& l, NodeType t, const BoolExpr& r);
01373 GECODE_MINIMODEL_EXPORT
01374 BoolExpr(const BoolVar& x);
01376 GECODE_MINIMODEL_EXPORT
01377 BoolExpr(const BoolExpr& e, NodeType t);
01379 GECODE_MINIMODEL_EXPORT
01380 BoolExpr(const LinIntRel& rl);
01381 #ifdef GECODE_HAS_FLOAT_VARS
01382
01383 GECODE_MINIMODEL_EXPORT
01384 BoolExpr(const LinFloatRel& rfl);
01385 #endif
01386 #ifdef GECODE_HAS_SET_VARS
01387
01388 GECODE_MINIMODEL_EXPORT
01389 BoolExpr(const SetRel& rs);
01391 GECODE_MINIMODEL_EXPORT
01392 BoolExpr(const SetCmpRel& rs);
01393 #endif
01394
01395 GECODE_MINIMODEL_EXPORT
01396 explicit BoolExpr(Misc* m);
01398 GECODE_MINIMODEL_EXPORT
01399 BoolVar expr(Home home, const IntPropLevels& ipls) const;
01401 GECODE_MINIMODEL_EXPORT
01402 void rel(Home home, const IntPropLevels& ipls) const;
01404 GECODE_MINIMODEL_EXPORT
01405 const BoolExpr& operator =(const BoolExpr& e);
01407 GECODE_MINIMODEL_EXPORT
01408 ~BoolExpr(void);
01409 };
01410
01421
01422 GECODE_MINIMODEL_EXPORT BoolExpr
01423 operator !(const BoolExpr&);
01425 GECODE_MINIMODEL_EXPORT BoolExpr
01426 operator &&(const BoolExpr&, const BoolExpr&);
01428 GECODE_MINIMODEL_EXPORT BoolExpr
01429 operator ||(const BoolExpr&, const BoolExpr&);
01431 GECODE_MINIMODEL_EXPORT BoolExpr
01432 operator ^(const BoolExpr&, const BoolExpr&);
01433
01435 GECODE_MINIMODEL_EXPORT BoolExpr
01436 operator !=(const BoolExpr&, const BoolExpr&);
01438 GECODE_MINIMODEL_EXPORT BoolExpr
01439 operator ==(const BoolExpr&, const BoolExpr&);
01441 GECODE_MINIMODEL_EXPORT BoolExpr
01442 operator >>(const BoolExpr&, const BoolExpr&);
01444 GECODE_MINIMODEL_EXPORT BoolExpr
01445 operator <<(const BoolExpr&, const BoolExpr&);
01446
01448
01456
01457 GECODE_MINIMODEL_EXPORT BoolExpr
01458 dom(const IntVar& x, int n);
01460 GECODE_MINIMODEL_EXPORT BoolExpr
01461 dom(const IntVar& x, int l, int m);
01463 GECODE_MINIMODEL_EXPORT BoolExpr
01464 dom(const IntVar& x, const IntSet& s);
01465
01466 #ifdef GECODE_HAS_SET_VARS
01467
01468 GECODE_MINIMODEL_EXPORT BoolExpr
01469 dom(const SetVar& x, SetRelType rt, int i);
01471 GECODE_MINIMODEL_EXPORT BoolExpr
01472 dom(const SetVar& x, SetRelType rt, int i, int j);
01474 GECODE_MINIMODEL_EXPORT BoolExpr
01475 dom(const SetVar& x, SetRelType rt, const IntSet& s);
01476 #endif
01477
01478 #ifdef GECODE_HAS_FLOAT_VARS
01479
01480 GECODE_MINIMODEL_EXPORT BoolExpr
01481 dom(const FloatVar& x, const FloatVal& n);
01483 GECODE_MINIMODEL_EXPORT BoolExpr
01484 dom(const FloatVar& x, FloatNum l, FloatNum u);
01485 #endif
01486
01487
01495 #ifdef GECODE_HAS_SET_VARS
01496
01497 GECODE_MINIMODEL_EXPORT BoolExpr
01498 operator ==(const SetExpr& s, const LinIntExpr& x);
01500 GECODE_MINIMODEL_EXPORT BoolExpr
01501 operator ==(const LinIntExpr& x, const SetExpr& s);
01503 BoolExpr
01504 operator ==(const LinIntExpr&, IntSet) = delete;
01506 BoolExpr
01507 operator ==(IntSet, const LinIntExpr&) = delete;
01508
01510 GECODE_MINIMODEL_EXPORT BoolExpr
01511 operator !=(const SetExpr& s, const LinIntExpr& x);
01513 GECODE_MINIMODEL_EXPORT BoolExpr
01514 operator !=(const LinIntExpr& x, const SetExpr& s);
01516 BoolExpr
01517 operator !=(const LinIntExpr&, IntSet) = delete;
01519 BoolExpr
01520 operator !=(IntSet, const LinIntExpr&) = delete;
01521
01523 GECODE_MINIMODEL_EXPORT BoolExpr
01524 operator <=(const SetExpr& s, const LinIntExpr& x);
01526 GECODE_MINIMODEL_EXPORT BoolExpr
01527 operator <=(const LinIntExpr& x, const SetExpr& s);
01529 BoolExpr
01530 operator <=(const LinIntExpr&, IntSet) = delete;
01532 BoolExpr
01533 operator <=(IntSet, const LinIntExpr&) = delete;
01534
01536 GECODE_MINIMODEL_EXPORT BoolExpr
01537 operator <(const SetExpr& s, const LinIntExpr& x);
01539 GECODE_MINIMODEL_EXPORT BoolExpr
01540 operator <(const LinIntExpr& x, const SetExpr& s);
01542 BoolExpr
01543 operator <(const LinIntExpr&, IntSet) = delete;
01545 BoolExpr
01546 operator <(IntSet, const LinIntExpr&) = delete;
01547
01549 GECODE_MINIMODEL_EXPORT BoolExpr
01550 operator >=(const SetExpr& s, const LinIntExpr& x);
01552 GECODE_MINIMODEL_EXPORT BoolExpr
01553 operator >=(const LinIntExpr& x, const SetExpr& s);
01555 BoolExpr
01556 operator >=(const LinIntExpr&, IntSet) = delete;
01558 BoolExpr
01559 operator >=(IntSet, const LinIntExpr&) = delete;
01560
01562 GECODE_MINIMODEL_EXPORT BoolExpr
01563 operator >(const SetExpr& s, const LinIntExpr& x);
01565 GECODE_MINIMODEL_EXPORT BoolExpr
01566 operator >(const LinIntExpr& x, const SetExpr& s);
01568 BoolExpr
01569 operator >(const LinIntExpr&, IntSet) = delete;
01571 BoolExpr
01572 operator >(IntSet, const LinIntExpr&) = delete;
01573 #endif
01574
01575
01582
01583 GECODE_MINIMODEL_EXPORT IntVar
01584 expr(Home home, const LinIntExpr& e,
01585 const IntPropLevels& ipls=IntPropLevels::def);
01586 #ifdef GECODE_HAS_FLOAT_VARS
01587
01588 GECODE_MINIMODEL_EXPORT FloatVar
01589 expr(Home home, const LinFloatExpr& e);
01590 #endif
01591 #ifdef GECODE_HAS_SET_VARS
01592
01593 GECODE_MINIMODEL_EXPORT SetVar
01594 expr(Home home, const SetExpr& e);
01595 #endif
01596
01597 GECODE_MINIMODEL_EXPORT BoolVar
01598 expr(Home home, const BoolExpr& e,
01599 const IntPropLevels& ipls=IntPropLevels::def);
01601 GECODE_MINIMODEL_EXPORT void
01602 rel(Home home, const BoolExpr& e,
01603 const IntPropLevels& ipls=IntPropLevels::def);
01605
01606 }
01607
01608 #include <gecode/minimodel/int-rel.hpp>
01609 #include <gecode/minimodel/float-rel.hpp>
01610 #include <gecode/minimodel/bool-expr.hpp>
01611 #include <gecode/minimodel/set-expr.hpp>
01612 #include <gecode/minimodel/set-rel.hpp>
01613
01614 namespace Gecode {
01615
01616 namespace MiniModel {
01617 class ExpInfo;
01618 }
01619
01625 class GECODE_MINIMODEL_EXPORT REG {
01626 friend class MiniModel::ExpInfo;
01627 private:
01629 class Exp;
01631 Exp* e;
01633 REG(Exp* e);
01635 std::string toString(void) const;
01636 public:
01638 REG(void);
01640 REG(int s);
01647 REG(const IntArgs& x);
01648
01650 REG(const REG& r);
01652 const REG& operator =(const REG& r);
01653
01655 REG operator +(const REG& r);
01657 REG& operator +=(const REG& r);
01659 REG operator |(const REG& r);
01661 REG& operator |=(const REG& r);
01663 REG operator *(void);
01665 REG operator +(void);
01667 REG operator ()(unsigned int n, unsigned int m);
01669 REG operator ()(unsigned int n);
01671 template<class Char, class Traits>
01672 std::basic_ostream<Char,Traits>&
01673 print(std::basic_ostream<Char,Traits>& os) const;
01675 operator DFA(void);
01677 ~REG(void);
01678 };
01679
01683 template<class Char, class Traits>
01684 std::basic_ostream<Char,Traits>&
01685 operator <<(std::basic_ostream<Char,Traits>& os, const REG& r);
01686
01687 }
01688
01689 #include <gecode/minimodel/reg.hpp>
01690
01691 namespace Gecode {
01692
01699
01700 GECODE_MINIMODEL_EXPORT LinIntExpr
01701 operator *(const LinIntExpr& x, const LinIntExpr& y);
01703 GECODE_MINIMODEL_EXPORT LinIntExpr
01704 operator /(const LinIntExpr& x, const LinIntExpr& y);
01706 GECODE_MINIMODEL_EXPORT LinIntExpr
01707 operator %(const LinIntExpr& x, const LinIntExpr& y);
01709 GECODE_MINIMODEL_EXPORT LinIntExpr
01710 abs(const LinIntExpr& e);
01712 GECODE_MINIMODEL_EXPORT LinIntExpr
01713 min(const LinIntExpr& x, const LinIntExpr& y);
01715 GECODE_MINIMODEL_EXPORT LinIntExpr
01716 min(const IntVarArgs& x);
01718 GECODE_MINIMODEL_EXPORT LinIntExpr
01719 max(const LinIntExpr& x, const LinIntExpr& y);
01721 GECODE_MINIMODEL_EXPORT LinIntExpr
01722 max(const IntVarArgs& x);
01724 GECODE_MINIMODEL_EXPORT LinIntExpr
01725 sqr(const LinIntExpr& x);
01727 GECODE_MINIMODEL_EXPORT LinIntExpr
01728 sqrt(const LinIntExpr& x);
01730 GECODE_MINIMODEL_EXPORT LinIntExpr
01731 pow(const LinIntExpr& x, int n);
01733 GECODE_MINIMODEL_EXPORT LinIntExpr
01734 nroot(const LinIntExpr& x, int n);
01736 GECODE_MINIMODEL_EXPORT LinIntExpr
01737 element(const IntVarArgs& x, const LinIntExpr& y);
01739 GECODE_MINIMODEL_EXPORT BoolExpr
01740 element(const BoolVarArgs& x, const LinIntExpr& y);
01742 GECODE_MINIMODEL_EXPORT LinIntExpr
01743 element(const IntArgs& x, const LinIntExpr& y);
01745 GECODE_MINIMODEL_EXPORT LinIntExpr
01746 ite(const BoolExpr& b, const LinIntExpr& x, const LinIntExpr& y);
01748
01749 #ifdef GECODE_HAS_FLOAT_VARS
01750
01751 GECODE_MINIMODEL_EXPORT LinFloatExpr
01752 operator *(const FloatVar&, const FloatVar&);
01754 GECODE_MINIMODEL_EXPORT LinFloatExpr
01755 operator *(const FloatVar&, const LinFloatExpr&);
01757 GECODE_MINIMODEL_EXPORT LinFloatExpr
01758 operator *(const LinFloatExpr&, const FloatVar&);
01760 GECODE_MINIMODEL_EXPORT LinFloatExpr
01761 abs(const LinFloatExpr& e);
01763 GECODE_MINIMODEL_EXPORT LinFloatExpr
01764 min(const LinFloatExpr& x, const LinFloatExpr& y);
01766 GECODE_MINIMODEL_EXPORT LinFloatExpr
01767 min(const FloatVarArgs& x);
01769 GECODE_MINIMODEL_EXPORT LinFloatExpr
01770 max(const LinFloatExpr& x, const LinFloatExpr& y);
01772 GECODE_MINIMODEL_EXPORT LinFloatExpr
01773 max(const FloatVarArgs& x);
01775 GECODE_MINIMODEL_EXPORT LinFloatExpr
01776 operator *(const LinFloatExpr& x, const LinFloatExpr& y);
01778 GECODE_MINIMODEL_EXPORT LinFloatExpr
01779 operator /(const LinFloatExpr& x, const LinFloatExpr& y);
01781 GECODE_MINIMODEL_EXPORT LinFloatExpr
01782 sqr(const LinFloatExpr& x);
01784 GECODE_MINIMODEL_EXPORT LinFloatExpr
01785 sqrt(const LinFloatExpr& x);
01787 GECODE_MINIMODEL_EXPORT LinFloatExpr
01788 pow(const LinFloatExpr& x, int n);
01790 GECODE_MINIMODEL_EXPORT LinFloatExpr
01791 nroot(const LinFloatExpr& x, int n);
01793
01794 #ifdef GECODE_HAS_MPFR
01795
01801
01802 GECODE_MINIMODEL_EXPORT LinFloatExpr
01803 exp(const LinFloatExpr& x);
01805 GECODE_MINIMODEL_EXPORT LinFloatExpr
01806 log(const LinFloatExpr& x);
01808
01815
01816 GECODE_MINIMODEL_EXPORT LinFloatExpr
01817 asin(const LinFloatExpr& x);
01819 GECODE_MINIMODEL_EXPORT LinFloatExpr
01820 sin(const LinFloatExpr& x);
01822 GECODE_MINIMODEL_EXPORT LinFloatExpr
01823 acos(const LinFloatExpr& x);
01825 GECODE_MINIMODEL_EXPORT LinFloatExpr
01826 cos(const LinFloatExpr& x);
01828 GECODE_MINIMODEL_EXPORT LinFloatExpr
01829 atan(const LinFloatExpr& x);
01831 GECODE_MINIMODEL_EXPORT LinFloatExpr
01832 tan(const LinFloatExpr& x);
01834 #endif
01835 #endif
01836
01837 }
01838
01839 namespace Gecode {
01840
01847
01848 BoolVar
01849 channel(Home home, IntVar x, IntPropLevel ipl=IPL_DEF);
01851 IntVar
01852 channel(Home home, BoolVar b, IntPropLevel ipl=IPL_DEF);
01853 #ifdef GECODE_HAS_FLOAT_VARS
01854
01855 IntVar
01856 channel(Home home, FloatVar f);
01857 #endif
01858 #ifdef GECODE_HAS_SET_VARS
01859
01860 SetVar
01861 channel(Home home, const IntVarArgs& x, IntPropLevel ipl=IPL_DEF);
01862 #endif
01863
01864
01865 }
01866
01867 #include <gecode/minimodel/channel.hpp>
01868
01869 namespace Gecode {
01870
01885 void
01886 atmost(Home home, const IntVarArgs& x, int n, int m,
01887 IntPropLevel ipl=IPL_DEF);
01892 void
01893 atmost(Home home, const IntVarArgs& x, IntVar y, int m,
01894 IntPropLevel ipl=IPL_DEF);
01902 void
01903 atmost(Home home, const IntVarArgs& x, const IntArgs& y, int m,
01904 IntPropLevel ipl=IPL_DEF);
01909 void
01910 atmost(Home home, const IntVarArgs& x, int n, IntVar z,
01911 IntPropLevel ipl=IPL_DEF);
01916 void
01917 atmost(Home home, const IntVarArgs& x, IntVar y, IntVar z,
01918 IntPropLevel ipl=IPL_DEF);
01926 void
01927 atmost(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
01928 IntPropLevel ipl=IPL_DEF);
01929
01934 void
01935 atleast(Home home, const IntVarArgs& x, int n, int m,
01936 IntPropLevel ipl=IPL_DEF);
01941 void
01942 atleast(Home home, const IntVarArgs& x, IntVar y, int m,
01943 IntPropLevel ipl=IPL_DEF);
01951 void
01952 atleast(Home home, const IntVarArgs& x, const IntArgs& y, int m,
01953 IntPropLevel ipl=IPL_DEF);
01958 void
01959 atleast(Home home, const IntVarArgs& x, int n, IntVar z,
01960 IntPropLevel ipl=IPL_DEF);
01965 void
01966 atleast(Home home, const IntVarArgs& x, IntVar y, IntVar z,
01967 IntPropLevel ipl=IPL_DEF);
01975 void
01976 atleast(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
01977 IntPropLevel ipl=IPL_DEF);
01978
01983 void
01984 exactly(Home home, const IntVarArgs& x, int n, int m,
01985 IntPropLevel ipl=IPL_DEF);
01990 void
01991 exactly(Home home, const IntVarArgs& x, IntVar y, int m,
01992 IntPropLevel ipl=IPL_DEF);
02000 void
02001 exactly(Home home, const IntVarArgs& x, const IntArgs& y, int m,
02002 IntPropLevel ipl=IPL_DEF);
02007 void
02008 exactly(Home home, const IntVarArgs& x, int n, IntVar z,
02009 IntPropLevel ipl=IPL_DEF);
02014 void
02015 exactly(Home home, const IntVarArgs& x, IntVar y, IntVar z,
02016 IntPropLevel ipl=IPL_DEF);
02024 void
02025 exactly(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
02026 IntPropLevel ipl=IPL_DEF);
02027
02030 void
02031 lex(Home home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
02032 IntPropLevel ipl=IPL_DEF);
02035 void
02036 lex(Home home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
02037 IntPropLevel ipl=IPL_DEF);
02038
02041 void
02042 values(Home home, const IntVarArgs& x, IntSet y,
02043 IntPropLevel ipl=IPL_DEF);
02045
02046 #ifdef GECODE_HAS_SET_VARS
02047
02062 void
02063 channel(Home home, const IntVarArgs& x, SetVar y);
02064
02067 void
02068 range(Home home, const IntVarArgs& x, SetVar y, SetVar z);
02069
02075 void
02076 roots(Home home, const IntVarArgs& x, SetVar y, SetVar z);
02078
02079 #endif
02080
02081 }
02082
02083 #include <gecode/minimodel/aliases.hpp>
02084
02085 namespace Gecode {
02086
02087 template<class> class Matrix;
02088
02096 template<class A>
02097 class Slice {
02098 public:
02100 typedef typename ArrayTraits<A>::ArgsType ArgsType;
02101 private:
02102 ArgsType _r;
02103 int _fc,
02104 _tc,
02105 _fr,
02106 _tr;
02107 public:
02109 Slice(const Matrix<A>& a, int fc, int tc, int fr, int tr);
02113 Slice& reverse(void);
02115 operator ArgsType(void);
02117 operator Matrix<ArgsType>(void);
02118
02120 operator const ArgsType(void) const;
02122 operator const Matrix<ArgsType>(void) const;
02123 };
02124
02126 template<class A>
02127 typename Slice<A>::ArgsType
02128 operator+(const Slice<A>& x, const Slice<A>& y);
02129
02131 template<class A>
02132 typename Slice<A>::ArgsType
02133 operator+(const Slice<A>& x, const typename ArrayTraits<A>::ArgsType& y);
02134
02136 template<class A>
02137 typename Slice<A>::ArgsType
02138 operator+(const typename ArrayTraits<A>::ArgsType& x, const Slice<A>& y);
02139
02141 template<class A>
02142 typename Slice<A>::ArgsType
02143 operator+(const Slice<A>& x, const typename ArrayTraits<A>::ValueType& y);
02144
02146 template<class A>
02147 typename Slice<A>::ArgsType
02148 operator+(const typename ArrayTraits<A>::ValueType& x, const Slice<A>& y);
02149
02160 template<class A>
02161 class Matrix {
02162 public:
02164 typedef typename ArrayTraits<A>::ValueType ValueType;
02166 typedef typename ArrayTraits<A>::ArgsType ArgsType;
02167
02168 private:
02170 typedef typename ArrayTraits<A>::StorageType StorageType;
02171 StorageType _a;
02172 int _w;
02173 int _h;
02174
02175 public:
02188 Matrix(A a, int w, int h);
02189
02202 Matrix(A a, int n);
02203
02205 int width(void) const;
02207 int height(void) const;
02209 ArgsType const get_array(void) const;
02210
02216 ValueType& operator ()(int c, int r);
02217
02223 const ValueType& operator ()(int c, int r) const;
02224
02234 Slice<A> slice(int fc, int tc, int fr, int tr) const;
02235
02237 Slice<A> row(int r) const;
02238
02240 Slice<A> col(int c) const;
02241 };
02242
02246 template<class Char, class Traits, class A>
02247 std::basic_ostream<Char,Traits>&
02248 operator <<(std::basic_ostream<Char,Traits>& os, const Matrix<A>& m);
02249
02253 template<class Char, class Traits, class A>
02254 std::basic_ostream<Char,Traits>&
02255 operator <<(std::basic_ostream<Char,Traits>& os, const Slice<A>& s);
02256
02263 void element(Home home, const Matrix<IntArgs>& m, IntVar x, IntVar y,
02264 IntVar z, IntPropLevel ipl=IPL_DEF);
02271 void element(Home home, const Matrix<IntArgs>& m, IntVar x, IntVar y,
02272 BoolVar z, IntPropLevel ipl=IPL_DEF);
02279 void element(Home home, const Matrix<IntVarArgs>& m, IntVar x, IntVar y,
02280 IntVar z, IntPropLevel ipl=IPL_DEF);
02287 void element(Home home, const Matrix<BoolVarArgs>& m, IntVar x, IntVar y,
02288 BoolVar z, IntPropLevel ipln=IPL_DEF);
02289 #ifdef GECODE_HAS_SET_VARS
02290
02296 void element(Home home, const Matrix<IntSetArgs>& m, IntVar x, IntVar y,
02297 SetVar z);
02304 void element(Home home, const Matrix<SetVarArgs>& m, IntVar x, IntVar y,
02305 SetVar z);
02306 #endif
02307
02311 template<class A>
02312 SymmetryHandle rows_interchange(const Matrix<A>& m);
02316 template<class A>
02317 SymmetryHandle columns_interchange(const Matrix<A>& m);
02321 template<class A>
02322 SymmetryHandle rows_reflect(const Matrix<A>& m);
02326 template<class A>
02327 SymmetryHandle columns_reflect(const Matrix<A>& m);
02333 template<class A>
02334 SymmetryHandle diagonal_reflect(const Matrix<A>& m);
02335 }
02336
02337 #include <gecode/minimodel/matrix.hpp>
02338 #include <gecode/minimodel/ldsb.hpp>
02339
02344 namespace Gecode {
02345
02347 GECODE_MINIMODEL_EXPORT LinIntExpr
02348 sum(const Slice<IntArgs>& slice);
02350 GECODE_MINIMODEL_EXPORT LinIntExpr
02351 sum(const Matrix<IntArgs>& matrix);
02352
02353 }
02356 namespace Gecode {
02357
02371 class GECODE_VTABLE_EXPORT IntMinimizeSpace : public Space {
02372 public:
02374 IntMinimizeSpace(void);
02376 IntMinimizeSpace(IntMinimizeSpace& s);
02378 GECODE_MINIMODEL_EXPORT
02379 virtual void constrain(const Space& best);
02381 virtual IntVar cost(void) const = 0;
02382 };
02383
02388 class GECODE_VTABLE_EXPORT IntMaximizeSpace : public Space {
02389 public:
02391 IntMaximizeSpace(void);
02393 IntMaximizeSpace(IntMaximizeSpace& s);
02395 GECODE_MINIMODEL_EXPORT
02396 virtual void constrain(const Space& best);
02398 virtual IntVar cost(void) const = 0;
02399 };
02400
02405 class GECODE_VTABLE_EXPORT IntLexMinimizeSpace : public Space {
02406 public:
02408 IntLexMinimizeSpace(void);
02410 IntLexMinimizeSpace(IntLexMinimizeSpace& s);
02412 GECODE_MINIMODEL_EXPORT
02413 virtual void constrain(const Space& best);
02415 virtual IntVarArgs cost(void) const = 0;
02416 };
02417
02422 class GECODE_VTABLE_EXPORT IntLexMaximizeSpace : public Space {
02423 public:
02425 IntLexMaximizeSpace(void);
02427 IntLexMaximizeSpace(IntLexMaximizeSpace& s);
02429 GECODE_MINIMODEL_EXPORT
02430 virtual void constrain(const Space& best);
02432 virtual IntVarArgs cost(void) const = 0;
02433 };
02434
02435 #ifdef GECODE_HAS_FLOAT_VARS
02436
02446 class GECODE_VTABLE_EXPORT FloatMinimizeSpace : public Space {
02447 protected:
02449 FloatNum step;
02450 public:
02452 FloatMinimizeSpace(FloatNum s=0.0);
02454 FloatMinimizeSpace(FloatMinimizeSpace& s);
02456 GECODE_MINIMODEL_EXPORT
02457 virtual void constrain(const Space& best);
02459 virtual FloatVar cost(void) const = 0;
02460 };
02461
02471 class GECODE_VTABLE_EXPORT FloatMaximizeSpace : public Space {
02472 protected:
02474 FloatNum step;
02475 public:
02477 FloatMaximizeSpace(FloatNum s=0.0);
02479 FloatMaximizeSpace(FloatMaximizeSpace& s);
02481 GECODE_MINIMODEL_EXPORT
02482 virtual void constrain(const Space& best);
02484 virtual FloatVar cost(void) const = 0;
02485 };
02486
02487 #endif
02488
02489 }
02490
02491 #include <gecode/minimodel/optimize.hpp>
02492
02493 #endif
02494
02495
02496
02497