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 #include "gecode/int/linear.hh"
00048
00049 #include "gecode/minimodel/exception.icc"
00050
00051 #include <iostream>
00052
00053
00054
00055
00056
00057
00058 #if !defined(GECODE_STATIC_LIBS) && \
00059 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00060
00061 #ifdef GECODE_BUILD_MINIMODEL
00062 #define GECODE_MINIMODEL_EXPORT __declspec( dllexport )
00063 #else
00064 #define GECODE_MINIMODEL_EXPORT __declspec( dllimport )
00065 #endif
00066
00067 #else
00068
00069 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00070
00071 #define GECODE_MINIMODEL_EXPORT __attribute__ ((visibility("default")))
00072
00073 #else
00074
00075 #define GECODE_MINIMODEL_EXPORT
00076
00077 #endif
00078 #endif
00079
00080 namespace Gecode {
00081
00083 namespace MiniModel {
00084
00086 template <class Var>
00087 class LinExpr {
00088 public:
00090 enum NodeType {
00091 NT_VAR,
00092 NT_ADD,
00093 NT_SUB,
00094 NT_MUL
00095 };
00096 private:
00097 typedef typename VarViewTraits<Var>::View View;
00099 class Node {
00100 public:
00102 unsigned int use;
00104 unsigned int n;
00106 NodeType t;
00108 Node *l, *r;
00110 int a, c;
00112 Var x;
00114 Node(void);
00116 int fill(Int::Linear::Term<View> t[], int i, int m,
00117 int c_i, int& c_o) const;
00119 bool decrement(void);
00121 static void* operator new(size_t size);
00123 static void operator delete(void* p,size_t size);
00124 };
00125 Node* n;
00126 public:
00128 LinExpr(void);
00130 LinExpr(const Var& x, int a=1);
00132 LinExpr(const LinExpr& e);
00134 LinExpr(const LinExpr& e0, NodeType t, const LinExpr& e1);
00136 LinExpr(const LinExpr& e0, NodeType t, int c);
00138 LinExpr(int a, const LinExpr& e);
00140 const LinExpr& operator=(const LinExpr& e);
00142 void post(Space* home, IntRelType irt,
00143 IntConLevel icl, PropKind pk) const;
00145 void post(Space* home, IntRelType irt, const BoolVar& b,
00146 IntConLevel icl, PropKind pk) const;
00148 IntVar post(Space* home,
00149 IntConLevel icl, PropKind pk) const;
00151 ~LinExpr(void);
00152 };
00153
00155 template<class Var>
00156 class LinRel {
00157 private:
00159 LinExpr<Var> e;
00161 IntRelType irt;
00163 static IntRelType neg(IntRelType irt);
00164 public:
00166 LinRel(void);
00168 LinRel(const LinExpr<Var>& l, IntRelType irt, const LinExpr<Var>& r);
00170 LinRel(const LinExpr<Var>& l, IntRelType irt, int r);
00172 LinRel(int l, IntRelType irt, const LinExpr<Var>& r);
00174 void post(Space* home, bool t,
00175 IntConLevel icl, PropKind pk) const;
00177 void post(Space* home, const BoolVar& b,
00178 IntConLevel icl, PropKind pk) const;
00179 };
00180
00181 }
00182
00183 }
00184
00202
00204 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00205 operator+(int,
00206 const Gecode::MiniModel::LinExpr<Gecode::IntVar>&);
00208 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00209 operator+(const Gecode::MiniModel::LinExpr<Gecode::IntVar>&,
00210 int);
00212 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00213 operator+(const Gecode::MiniModel::LinExpr<Gecode::IntVar>&,
00214 const Gecode::MiniModel::LinExpr<Gecode::IntVar>&);
00216 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00217 operator-(int,
00218 const Gecode::MiniModel::LinExpr<Gecode::IntVar>&);
00220 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00221 operator-(const Gecode::MiniModel::LinExpr<Gecode::IntVar>&,
00222 int);
00224 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00225 operator-(const Gecode::MiniModel::LinExpr<Gecode::IntVar>&,
00226 const Gecode::MiniModel::LinExpr<Gecode::IntVar>&);
00228 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00229 operator-(const Gecode::MiniModel::LinExpr<Gecode::IntVar>&);
00230
00232 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00233 operator*(int, const Gecode::IntVar&);
00235 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00236 operator*(const Gecode::IntVar&, int);
00238 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00239 operator*(const Gecode::MiniModel::LinExpr<Gecode::IntVar>&, int);
00241 Gecode::MiniModel::LinExpr<Gecode::IntVar>
00242 operator*(int, const Gecode::MiniModel::LinExpr<Gecode::IntVar>&);
00243
00244
00246 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00247 operator+(int,
00248 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&);
00250 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00251 operator+(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&,
00252 int);
00254 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00255 operator+(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&,
00256 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&);
00258 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00259 operator-(int,
00260 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&);
00262 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00263 operator-(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&,
00264 int);
00266 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00267 operator-(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&,
00268 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&);
00270 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00271 operator-(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&);
00272
00274 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00275 operator*(int, const Gecode::BoolVar&);
00277 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00278 operator*(const Gecode::BoolVar&, int);
00280 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00281 operator*(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&, int);
00283 Gecode::MiniModel::LinExpr<Gecode::BoolVar>
00284 operator*(int, const Gecode::MiniModel::LinExpr<Gecode::BoolVar>&);
00285
00286
00288 Gecode::MiniModel::LinRel<Gecode::IntVar>
00289 operator==(int l,
00290 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00292 Gecode::MiniModel::LinRel<Gecode::IntVar>
00293 operator==(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00294 int r);
00296 Gecode::MiniModel::LinRel<Gecode::IntVar>
00297 operator==(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00298 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00299
00301 Gecode::MiniModel::LinRel<Gecode::IntVar>
00302 operator!=(int l,
00303 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00305 Gecode::MiniModel::LinRel<Gecode::IntVar>
00306 operator!=(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00307 int r);
00309 Gecode::MiniModel::LinRel<Gecode::IntVar>
00310 operator!=(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00311 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00312
00314 Gecode::MiniModel::LinRel<Gecode::IntVar>
00315 operator<(int l,
00316 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00318 Gecode::MiniModel::LinRel<Gecode::IntVar>
00319 operator<(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00320 int r);
00322 Gecode::MiniModel::LinRel<Gecode::IntVar>
00323 operator<(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00324 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00325
00327 Gecode::MiniModel::LinRel<Gecode::IntVar>
00328 operator<=(int l,
00329 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00331 Gecode::MiniModel::LinRel<Gecode::IntVar>
00332 operator<=(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00333 int r);
00335 Gecode::MiniModel::LinRel<Gecode::IntVar>
00336 operator<=(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00337 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00338
00340 Gecode::MiniModel::LinRel<Gecode::IntVar>
00341 operator>(int l,
00342 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00344 Gecode::MiniModel::LinRel<Gecode::IntVar>
00345 operator>(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00346 int r);
00348 Gecode::MiniModel::LinRel<Gecode::IntVar>
00349 operator>(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00350 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00351
00353 Gecode::MiniModel::LinRel<Gecode::IntVar>
00354 operator>=(int l,
00355 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00357 Gecode::MiniModel::LinRel<Gecode::IntVar>
00358 operator>=(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00359 int r);
00361 Gecode::MiniModel::LinRel<Gecode::IntVar>
00362 operator>=(const Gecode::MiniModel::LinExpr<Gecode::IntVar>& l,
00363 const Gecode::MiniModel::LinExpr<Gecode::IntVar>& r);
00364
00365
00367 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00368 operator==(int l,
00369 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00371 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00372 operator==(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00373 int r);
00375 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00376 operator==(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00377 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00378
00380 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00381 operator!=(int l,
00382 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00384 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00385 operator!=(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00386 int r);
00388 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00389 operator!=(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00390 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00391
00393 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00394 operator<(int l,
00395 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00397 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00398 operator<(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00399 int r);
00401 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00402 operator<(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00403 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00404
00406 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00407 operator<=(int l,
00408 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00410 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00411 operator<=(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00412 int r);
00414 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00415 operator<=(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00416 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00417
00419 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00420 operator>(int l,
00421 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00423 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00424 operator>(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00425 int r);
00427 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00428 operator>(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00429 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00430
00432 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00433 operator>=(int l,
00434 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00436 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00437 operator>=(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00438 int r);
00440 Gecode::MiniModel::LinRel<Gecode::BoolVar>
00441 operator>=(const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& l,
00442 const Gecode::MiniModel::LinExpr<Gecode::BoolVar>& r);
00443
00445
00446 namespace Gecode {
00447
00448 namespace MiniModel {
00449
00451 class BoolExpr {
00452 public:
00454 enum NodeType {
00455 NT_VAR,
00456 NT_NOT,
00457 NT_AND,
00458 NT_OR,
00459 NT_IMP,
00460 NT_XOR,
00461 NT_EQV,
00462 NT_RLIN_INT,
00463 NT_RLIN_BOOL
00464 };
00466 class Node {
00467 public:
00469 unsigned int use;
00471 unsigned int same;
00473 NodeType t;
00475 Node *l, *r;
00477 BoolVar x;
00479 LinRel<IntVar> rl_int;
00481 LinRel<BoolVar> rl_bool;
00482
00484 Node(void);
00486 GECODE_MINIMODEL_EXPORT
00487 bool decrement(void);
00489 GECODE_MINIMODEL_EXPORT
00490 int post(Space* home, NodeType t, BoolVarArgs& b, int i,
00491 IntConLevel icl, PropKind pk) const;
00493 GECODE_MINIMODEL_EXPORT
00494 void post(Space* home, BoolVar b,
00495 IntConLevel icl, PropKind pk) const;
00497 GECODE_MINIMODEL_EXPORT
00498 BoolVar post(Space* home,
00499 IntConLevel icl, PropKind pk) const;
00501 GECODE_MINIMODEL_EXPORT
00502 void post(Space* home, bool t,
00503 IntConLevel icl, PropKind pk) const;
00504
00506 static void* operator new(size_t size);
00508 static void operator delete(void* p,size_t size);
00509 };
00510 private:
00512 Node* n;
00513 public:
00515 BoolExpr(const BoolExpr& e);
00517 GECODE_MINIMODEL_EXPORT
00518 BoolExpr(const BoolExpr& l, NodeType t, const BoolExpr& r);
00520 GECODE_MINIMODEL_EXPORT
00521 BoolExpr(const BoolVar& x);
00523 GECODE_MINIMODEL_EXPORT
00524 BoolExpr(const BoolExpr& e, NodeType t);
00526 GECODE_MINIMODEL_EXPORT
00527 BoolExpr(const LinRel<IntVar>& rl);
00529 GECODE_MINIMODEL_EXPORT
00530 BoolExpr(const LinRel<BoolVar>& rl);
00532 BoolVar post(Space* home, IntConLevel icl, PropKind pk) const;
00534 void post(Space* home, bool t, IntConLevel icl, PropKind pk) const;
00535
00537 GECODE_MINIMODEL_EXPORT
00538 const BoolExpr& operator=(const BoolExpr& e);
00540 GECODE_MINIMODEL_EXPORT
00541 ~BoolExpr(void);
00542 };
00543
00545 class BoolRel {
00546 private:
00548 BoolExpr e;
00550 bool t;
00551 public:
00553 BoolRel(const BoolExpr& e, bool t);
00555 void post(Space* home, IntConLevel icl, PropKind pk) const;
00556 };
00557 }
00558
00559 }
00560
00575
00577 Gecode::MiniModel::BoolExpr
00578 operator!(const Gecode::MiniModel::BoolExpr&);
00579
00581 Gecode::MiniModel::BoolExpr
00582 operator&&(const Gecode::MiniModel::BoolExpr&,
00583 const Gecode::MiniModel::BoolExpr&);
00584
00586 Gecode::MiniModel::BoolExpr
00587 operator||(const Gecode::MiniModel::BoolExpr&,
00588 const Gecode::MiniModel::BoolExpr&);
00589
00591 Gecode::MiniModel::BoolExpr
00592 operator^(const Gecode::MiniModel::BoolExpr&,
00593 const Gecode::MiniModel::BoolExpr&);
00594
00596 template <class Var>
00597 Gecode::MiniModel::BoolExpr
00598 operator~(const Gecode::MiniModel::LinRel<Var>&);
00599
00600 namespace Gecode {
00601
00603 MiniModel::BoolExpr
00604 eqv(const MiniModel::BoolExpr&,
00605 const MiniModel::BoolExpr&);
00607 MiniModel::BoolExpr
00608 imp(const MiniModel::BoolExpr&,
00609 const MiniModel::BoolExpr&);
00610
00612 MiniModel::BoolRel
00613 tt(const MiniModel::BoolExpr&);
00614
00616 MiniModel::BoolRel
00617 ff(const MiniModel::BoolExpr&);
00618
00619 }
00620
00622
00623 namespace Gecode {
00624
00631
00632 template <class Var>
00633 IntVar post(Space* home, const MiniModel::LinExpr<Var>& e,
00634 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00636 IntVar post(Space* home, const IntVar& x,
00637 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00639 IntVar post(Space* home, int n,
00640 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00641
00643 template <class Var>
00644 void post(Space* home, const MiniModel::LinRel<Var>& r,
00645 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00647 void post(Space* home, bool r,
00648 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00649
00651 BoolVar post(Space* home, const MiniModel::BoolExpr& e,
00652 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00654 BoolVar post(Space* home, const BoolVar& b,
00655 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00657 void post(Space* home, const MiniModel::BoolRel& r,
00658 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00660
00661 }
00662
00663 #include "gecode/minimodel/lin-expr.icc"
00664 #include "gecode/minimodel/lin-rel.icc"
00665 #include "gecode/minimodel/bool-expr.icc"
00666 #include "gecode/minimodel/bool-rel.icc"
00667
00668 namespace Gecode {
00669
00675 class GECODE_MINIMODEL_EXPORT REG {
00676 private:
00678 class Exp;
00680 Exp* e;
00682 REG(Exp* e);
00683 public:
00685 REG(void);
00687 REG(int s);
00694 REG(const IntArgs& x);
00695
00697 REG(const REG& r);
00699 const REG& operator=(const REG& r);
00700
00702 REG operator+(const REG& r);
00704 REG& operator+=(const REG& r);
00706 REG operator|(const REG& r);
00708 REG& operator|=(const REG& r);
00710 REG operator*(void);
00712 REG operator+(void);
00714 REG operator()(unsigned int n, unsigned int m);
00716 REG operator()(unsigned int n);
00718 std::ostream& print(std::ostream&) const;
00720 operator DFA(void);
00722 ~REG(void);
00723 };
00724
00725 }
00726
00730 GECODE_MINIMODEL_EXPORT std::ostream&
00731 operator<<(std::ostream&, const Gecode::REG& r);
00732
00733
00734 namespace Gecode {
00735
00747 IntVar
00748 abs(Space* home, IntVar x,
00749 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00755 IntVar
00756 min(Space* home, IntVar x, IntVar y,
00757 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00763 IntVar
00764 min(Space* home, const IntVarArgs& x,
00765 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00771 IntVar
00772 max(Space* home, IntVar x, IntVar y,
00773 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00779 IntVar
00780 max(Space* home, const IntVarArgs& x,
00781 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00787 IntVar
00788 mult(Space* home, IntVar x, IntVar y,
00789 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00795 IntVar
00796 sqr(Space* home, IntVar x,
00797 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00803 IntVar
00804 sqrt(Space* home, IntVar x,
00805 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00811 IntVar
00812 plus(Space* home, IntVar x, IntVar y,
00813 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00819 IntVar
00820 minus(Space* home, IntVar x, IntVar y,
00821 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00823 }
00824
00825 #include "gecode/minimodel/arithmetic.icc"
00826
00827 namespace Gecode {
00828
00835
00836 inline BoolVar
00837 channel(Space* home, IntVar x,
00838 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00839 (void) icl; (void) pk;
00840 BoolVar b(home,0,1); channel(home,b,x);
00841 return b;
00842 }
00844 inline IntVar
00845 channel(Space* home, BoolVar b,
00846 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00847 (void) icl; (void) pk;
00848 IntVar x(home,0,1); channel(home,b,x);
00849 return x;
00850 }
00852
00853 }
00854
00855 namespace Gecode {
00856
00871 inline void
00872 atmost(Space* home, const IntVarArgs& x, int n, int m,
00873 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00874 count(home,x,n,IRT_LQ,m,icl,pk);
00875 }
00880 inline void
00881 atmost(Space* home, const IntVarArgs& x, IntVar y, int m,
00882 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00883 count(home,x,y,IRT_LQ,m,icl,pk);
00884 }
00892 inline void
00893 atmost(Space* home, const IntVarArgs& x, const IntArgs& y, int m,
00894 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00895 count(home,x,y,IRT_LQ,m,icl,pk);
00896 }
00901 inline void
00902 atmost(Space* home, const IntVarArgs& x, int n, IntVar z,
00903 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00904 count(home,x,n,IRT_LQ,z,icl,pk);
00905 }
00910 inline void
00911 atmost(Space* home, const IntVarArgs& x, IntVar y, IntVar z,
00912 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00913 count(home,x,y,IRT_LQ,z,icl,pk);
00914 }
00922 inline void
00923 atmost(Space* home, const IntVarArgs& x, const IntArgs& y, IntVar z,
00924 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00925 count(home,x,y,IRT_LQ,z,icl,pk);
00926 }
00927
00932 inline void
00933 atleast(Space* home, const IntVarArgs& x, int n, int m,
00934 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00935 count(home,x,n,IRT_GQ,m,icl,pk);
00936 }
00941 inline void
00942 atleast(Space* home, const IntVarArgs& x, IntVar y, int m,
00943 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00944 count(home,x,y,IRT_GQ,m,icl,pk);
00945 }
00953 inline void
00954 atleast(Space* home, const IntVarArgs& x, const IntArgs& y, int m,
00955 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00956 count(home,x,y,IRT_GQ,m,icl,pk);
00957 }
00962 inline void
00963 atleast(Space* home, const IntVarArgs& x, int n, IntVar z,
00964 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00965 count(home,x,n,IRT_GQ,z,icl,pk);
00966 }
00971 inline void
00972 atleast(Space* home, const IntVarArgs& x, IntVar y, IntVar z,
00973 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00974 count(home,x,y,IRT_GQ,z,icl,pk);
00975 }
00983 inline void
00984 atleast(Space* home, const IntVarArgs& x, const IntArgs& y, IntVar z,
00985 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00986 count(home,x,y,IRT_GQ,z,icl,pk);
00987 }
00988
00993 inline void
00994 exactly(Space* home, const IntVarArgs& x, int n, int m,
00995 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
00996 count(home,x,n,IRT_EQ,m,icl,pk);
00997 }
01002 inline void
01003 exactly(Space* home, const IntVarArgs& x, IntVar y, int m,
01004 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01005 count(home,x,y,IRT_EQ,m,icl,pk);
01006 }
01014 inline void
01015 exactly(Space* home, const IntVarArgs& x, const IntArgs& y, int m,
01016 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01017 count(home,x,y,IRT_EQ,m,icl,pk);
01018 }
01023 inline void
01024 exactly(Space* home, const IntVarArgs& x, int n, IntVar z,
01025 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01026 count(home,x,n,IRT_EQ,z,icl,pk);
01027 }
01032 inline void
01033 exactly(Space* home, const IntVarArgs& x, IntVar y, IntVar z,
01034 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01035 count(home,x,y,IRT_EQ,z,icl,pk);
01036 }
01044 inline void
01045 exactly(Space* home, const IntVarArgs& x, const IntArgs& y, IntVar z,
01046 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01047 count(home,x,y,IRT_EQ,z,icl,pk);
01048 }
01054 inline void
01055 lex(Space* home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
01056 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01057 rel(home,x,r,y,icl,pk);
01058 }
01064 inline void
01065 lex(Space* home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
01066 IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01067 rel(home,x,r,y,icl,pk);
01068 }
01069
01071
01072 }
01073
01082 namespace Gecode { namespace MiniModel {
01083
01094 template <class A>
01095 class Matrix {
01096 public:
01098 typedef typename ArrayTraits<A>::value_type value_type;
01100 typedef typename ArrayTraits<A>::args_type args_type;
01101
01109 class Slice {
01110 args_type _r;
01111 unsigned int _fc,
01112 _tc,
01113 _fr,
01114 _tr;
01115 public:
01116 Slice(Matrix<A>& a,
01117 unsigned int fc, unsigned int tc,
01118 unsigned int fr, unsigned int tr);
01119
01123 Slice& reverse(void);
01124
01125 operator args_type(void);
01126 operator Matrix<args_type>(void);
01127 };
01128
01129 private:
01131 typedef typename ArrayTraits<A>::storage_type storage_type;
01132 storage_type _a;
01133 unsigned int _w,
01134 _h;
01135
01136 public:
01149 Matrix(A a, unsigned int w, unsigned int h);
01150
01163 Matrix(A a, unsigned int n);
01164
01166 unsigned int width(void) const;
01168 unsigned int height(void) const;
01170 args_type const get_array(void);
01171
01177 value_type& operator()(unsigned int c, unsigned int r);
01178
01188 Slice slice(unsigned int fc, unsigned int tc,
01189 unsigned int fr, unsigned int tr);
01190
01192 Slice row(int r);
01193
01195 Slice col(int c);
01196 };
01197 }}
01199
01200 #include "gecode/minimodel/matrix.icc"
01201
01202 #endif
01203
01204
01205
01206