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_INT_LINEAR_HH__
00043 #define __GECODE_INT_LINEAR_HH__
00044
00045 #include <gecode/int.hh>
00046
00052 namespace Gecode { namespace Int { namespace Linear {
00053
00054
00055
00056
00057
00058
00068 template<class Val, class A, class B, PropCond pc>
00069 class LinBin : public Propagator {
00070 protected:
00072 A x0;
00074 B x1;
00076 Val c;
00078 LinBin(Space& home, bool share, LinBin& p);
00080 LinBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00082 LinBin(Home home, A x0, B x1, Val c);
00083 public:
00085 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00087 virtual size_t dispose(Space& home);
00088 };
00089
00099 template<class Val, class A, class B, PropCond pc, class Ctrl>
00100 class ReLinBin : public Propagator {
00101 protected:
00103 A x0;
00105 B x1;
00107 Val c;
00109 Ctrl b;
00111 ReLinBin(Space& home, bool share, ReLinBin& p);
00113 ReLinBin(Home home, A x0, B x1, Val c, Ctrl b);
00114 public:
00116 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00118 virtual size_t dispose(Space& home);
00119 };
00120
00133 template<class Val, class A, class B>
00134 class EqBin : public LinBin<Val,A,B,PC_INT_BND> {
00135 protected:
00136 using LinBin<Val,A,B,PC_INT_BND>::x0;
00137 using LinBin<Val,A,B,PC_INT_BND>::x1;
00138 using LinBin<Val,A,B,PC_INT_BND>::c;
00139
00141 EqBin(Space& home, bool share, EqBin& p);
00143 EqBin(Home home, A x0, B x1, Val c);
00144 public:
00146 EqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00148 virtual Actor* copy(Space& home, bool share);
00150 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00152 static ExecStatus post(Home home, A x0, B x1, Val c);
00153 };
00154
00167 template<class Val, class A, class B, class Ctrl, ReifyMode rm>
00168 class ReEqBin : public ReLinBin<Val,A,B,PC_INT_BND,Ctrl> {
00169 protected:
00170 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::x0;
00171 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::x1;
00172 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::c;
00173 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::b;
00174
00176 ReEqBin(Space& home, bool share, ReEqBin& p);
00178 ReEqBin(Home home,A,B,Val,Ctrl);
00179 public:
00181 virtual Actor* copy(Space& home, bool share);
00183 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00185 static ExecStatus post(Home home, A x0, B x1, Val c, Ctrl b);
00186 };
00187
00200 template<class Val, class A, class B>
00201 class NqBin : public LinBin<Val,A,B,PC_INT_VAL> {
00202 protected:
00203 using LinBin<Val,A,B,PC_INT_VAL>::x0;
00204 using LinBin<Val,A,B,PC_INT_VAL>::x1;
00205 using LinBin<Val,A,B,PC_INT_VAL>::c;
00206
00208 NqBin(Space& home, bool share, NqBin& p);
00210 NqBin(Home home, A x0, B x1, Val c);
00211 public:
00213 NqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00215 virtual Actor* copy(Space& home, bool share);
00217 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00219 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00221 static ExecStatus post(Home home, A x0, B x1, Val c);
00222 };
00223
00236 template<class Val, class A, class B>
00237 class LqBin : public LinBin<Val,A,B,PC_INT_BND> {
00238 protected:
00239 using LinBin<Val,A,B,PC_INT_BND>::x0;
00240 using LinBin<Val,A,B,PC_INT_BND>::x1;
00241 using LinBin<Val,A,B,PC_INT_BND>::c;
00242
00244 LqBin(Space& home, bool share, LqBin& p);
00246 LqBin(Home home, A x0, B x1, Val c);
00247 public:
00249 LqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00251 virtual Actor* copy(Space& home, bool share);
00253 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00255 static ExecStatus post(Home home, A x0, B x1, Val c);
00256 };
00257
00270 template<class Val, class A, class B>
00271 class GqBin : public LinBin<Val,A,B,PC_INT_BND> {
00272 protected:
00273 using LinBin<Val,A,B,PC_INT_BND>::x0;
00274 using LinBin<Val,A,B,PC_INT_BND>::x1;
00275 using LinBin<Val,A,B,PC_INT_BND>::c;
00276
00278 GqBin(Space& home, bool share, GqBin& p);
00280 GqBin(Home home, A x0, B x1, Val c);
00281 public:
00283 GqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00285 virtual Actor* copy(Space& home, bool share);
00287 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00289 static ExecStatus post(Home home, A x0, B x1, Val c);
00290 };
00291
00304 template<class Val, class A, class B, ReifyMode rm>
00305 class ReLqBin : public ReLinBin<Val,A,B,PC_INT_BND,BoolView> {
00306 protected:
00307 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::x0;
00308 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::x1;
00309 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::c;
00310 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::b;
00311
00313 ReLqBin(Space& home, bool share, ReLqBin& p);
00315 ReLqBin(Home home, A x0, B x1, Val c, BoolView b);
00316 public:
00318 virtual Actor* copy(Space& home, bool share);
00320 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00322 static ExecStatus post(Home home, A x0, B x1, Val c, BoolView b);
00323 };
00324
00325 }}}
00326
00327 #include <gecode/int/linear/int-bin.hpp>
00328
00329 namespace Gecode { namespace Int { namespace Linear {
00330
00331
00332
00333
00334
00335
00345 template<class Val, class A, class B, class C, PropCond pc>
00346 class LinTer : public Propagator {
00347 protected:
00349 A x0;
00351 B x1;
00353 C x2;
00355 Val c;
00357 LinTer(Space& home, bool share, LinTer& p);
00359 LinTer(Home home, A x0, B x1, C x2, Val c);
00361 LinTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00362 public:
00364 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00366 virtual size_t dispose(Space& home);
00367 };
00368
00381 template<class Val, class A, class B, class C>
00382 class EqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
00383 protected:
00384 using LinTer<Val,A,B,C,PC_INT_BND>::x0;
00385 using LinTer<Val,A,B,C,PC_INT_BND>::x1;
00386 using LinTer<Val,A,B,C,PC_INT_BND>::x2;
00387 using LinTer<Val,A,B,C,PC_INT_BND>::c;
00388
00390 EqTer(Space& home, bool share, EqTer& p);
00392 EqTer(Home home, A x0, B x1, C x2, Val c);
00393 public:
00395 EqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00397 virtual Actor* copy(Space& home, bool share);
00399 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00401 static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
00402 };
00403
00416 template<class Val, class A, class B, class C>
00417 class NqTer : public LinTer<Val,A,B,C,PC_INT_VAL> {
00418 protected:
00419 using LinTer<Val,A,B,C,PC_INT_VAL>::x0;
00420 using LinTer<Val,A,B,C,PC_INT_VAL>::x1;
00421 using LinTer<Val,A,B,C,PC_INT_VAL>::x2;
00422 using LinTer<Val,A,B,C,PC_INT_VAL>::c;
00423
00425 NqTer(Space& home, bool share, NqTer& p);
00427 NqTer(Home home, A x0, B x1, C x2, Val c);
00428 public:
00430 NqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00432 virtual Actor* copy(Space& home, bool share);
00434 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00436 static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
00437 };
00438
00451 template<class Val, class A, class B, class C>
00452 class LqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
00453 protected:
00454 using LinTer<Val,A,B,C,PC_INT_BND>::x0;
00455 using LinTer<Val,A,B,C,PC_INT_BND>::x1;
00456 using LinTer<Val,A,B,C,PC_INT_BND>::x2;
00457 using LinTer<Val,A,B,C,PC_INT_BND>::c;
00458
00460 LqTer(Space& home, bool share, LqTer& p);
00462 LqTer(Home home, A x0, B x1, C x2, Val c);
00463 public:
00465 LqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00467 virtual Actor* copy(Space& home, bool share);
00469 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00471 static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
00472 };
00473
00474 }}}
00475
00476 #include <gecode/int/linear/int-ter.hpp>
00477
00478 namespace Gecode { namespace Int { namespace Linear {
00479
00480
00481
00482
00483
00484
00494 template<class Val, class P, class N, PropCond pc>
00495 class Lin : public Propagator {
00496 protected:
00498 ViewArray<P> x;
00500 ViewArray<N> y;
00502 Val c;
00503
00505 Lin(Space& home, bool share, Lin<Val,P,N,pc>& p);
00507 Lin(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00508 public:
00510 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00512 virtual size_t dispose(Space& home);
00513 };
00514
00524 template<class Val, class P, class N, PropCond pc, class Ctrl>
00525 class ReLin : public Lin<Val,P,N,pc> {
00526 protected:
00528 Ctrl b;
00530 ReLin(Space& home, bool share, ReLin& p);
00532 ReLin(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00533 public:
00535 virtual size_t dispose(Space& home);
00536 };
00537
00543 template<class Val, class View>
00544 void bounds_p(ModEventDelta med, ViewArray<View>& x,
00545 Val& c, Val& sl, Val& su);
00546
00552 template<class Val, class View>
00553 void bounds_n(ModEventDelta med, ViewArray<View>& y,
00554 Val& c, Val& sl, Val& su);
00555
00568 template<class Val, class P, class N>
00569 class Eq : public Lin<Val,P,N,PC_INT_BND> {
00570 protected:
00571 using Lin<Val,P,N,PC_INT_BND>::x;
00572 using Lin<Val,P,N,PC_INT_BND>::y;
00573 using Lin<Val,P,N,PC_INT_BND>::c;
00574
00576 Eq(Space& home, bool share, Eq& p);
00577 public:
00579 Eq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00581 virtual Actor* copy(Space& home, bool share);
00583 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00585 static ExecStatus
00586 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00587 };
00588
00599 template<class Val, class View>
00600 class DomEq
00601 : public Lin<Val,View,View,PC_INT_DOM> {
00602 protected:
00603 using Lin<Val,View,View,PC_INT_DOM>::x;
00604 using Lin<Val,View,View,PC_INT_DOM>::y;
00605 using Lin<Val,View,View,PC_INT_DOM>::c;
00606
00608 DomEq(Space& home, bool share, DomEq& p);
00609 public:
00611 DomEq(Home home, ViewArray<View>& x, ViewArray<View>& y, Val c);
00613 virtual Actor* copy(Space& home, bool share);
00620 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00622 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00624 static ExecStatus
00625 post(Home home, ViewArray<View>& x, ViewArray<View>& y, Val c);
00626 };
00627
00640 template<class Val, class P, class N, class Ctrl, ReifyMode rm>
00641 class ReEq : public ReLin<Val,P,N,PC_INT_BND,Ctrl> {
00642 protected:
00643 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::x;
00644 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::y;
00645 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::c;
00646 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::b;
00647
00649 ReEq(Space& home, bool share, ReEq& p);
00650 public:
00652 ReEq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00654 virtual Actor* copy(Space& home, bool share);
00656 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00658 static ExecStatus
00659 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00660 };
00661
00674 template<class Val, class P, class N>
00675 class Nq : public Lin<Val,P,N,PC_INT_VAL> {
00676 protected:
00677 using Lin<Val,P,N,PC_INT_VAL>::x;
00678 using Lin<Val,P,N,PC_INT_VAL>::y;
00679 using Lin<Val,P,N,PC_INT_VAL>::c;
00680
00682 Nq(Space& home, bool share, Nq& p);
00683 public:
00685 Nq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00687 virtual Actor* copy(Space& home, bool share);
00689 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00691 static ExecStatus
00692 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00693 };
00694
00707 template<class Val, class P, class N>
00708 class Lq : public Lin<Val,P,N,PC_INT_BND> {
00709 protected:
00710 using Lin<Val,P,N,PC_INT_BND>::x;
00711 using Lin<Val,P,N,PC_INT_BND>::y;
00712 using Lin<Val,P,N,PC_INT_BND>::c;
00713
00715 Lq(Space& home, bool share, Lq& p);
00716 public:
00718 Lq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00720 virtual Actor* copy(Space& home, bool share);
00722 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00724 static ExecStatus
00725 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00726 };
00727
00740 template<class Val, class P, class N, ReifyMode rm>
00741 class ReLq : public ReLin<Val,P,N,PC_INT_BND,BoolView> {
00742 protected:
00743 using ReLin<Val,P,N,PC_INT_BND,BoolView>::x;
00744 using ReLin<Val,P,N,PC_INT_BND,BoolView>::y;
00745 using ReLin<Val,P,N,PC_INT_BND,BoolView>::c;
00746 using ReLin<Val,P,N,PC_INT_BND,BoolView>::b;
00747
00749 ReLq(Space& home, bool share, ReLq& p);
00750 public:
00752 ReLq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
00754 virtual Actor* copy(Space& home, bool share);
00756 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00758 static ExecStatus
00759 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
00760 };
00761
00762 }}}
00763
00764 #include <gecode/int/linear/int-nary.hpp>
00765 #include <gecode/int/linear/int-dom.hpp>
00766
00767 namespace Gecode { namespace Int { namespace Linear {
00768
00769
00770
00771
00772
00773
00778 template<class VX>
00779 class LinBoolInt : public Propagator {
00780 protected:
00782 Council<Advisor> co;
00784 ViewArray<VX> x;
00786 int n_as;
00788 int n_hs;
00790 int c;
00792 void normalize(void);
00794 LinBoolInt(Space& home, bool share, LinBoolInt& p);
00796 LinBoolInt(Home home, ViewArray<VX>& x, int n_s, int c);
00797 public:
00799 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00801 virtual size_t dispose(Space& home);
00802 };
00803
00810 template<class VX>
00811 class EqBoolInt : public LinBoolInt<VX> {
00812 protected:
00813 using LinBoolInt<VX>::co;
00814 using LinBoolInt<VX>::x;
00815 using LinBoolInt<VX>::n_as;
00816 using LinBoolInt<VX>::n_hs;
00817 using LinBoolInt<VX>::c;
00819 EqBoolInt(Space& home, bool share, EqBoolInt& p);
00821 EqBoolInt(Home home, ViewArray<VX>& x, int c);
00822 public:
00824 virtual Actor* copy(Space& home, bool share);
00826 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00828 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00830 static ExecStatus post(Home home, ViewArray<VX>& x, int c);
00831 };
00832
00839 template<class VX>
00840 class GqBoolInt : public LinBoolInt<VX> {
00841 protected:
00842 using LinBoolInt<VX>::co;
00843 using LinBoolInt<VX>::x;
00844 using LinBoolInt<VX>::n_as;
00845 using LinBoolInt<VX>::n_hs;
00846 using LinBoolInt<VX>::c;
00848 GqBoolInt(Space& home, bool share, GqBoolInt& p);
00850 GqBoolInt(Home home, ViewArray<VX>& x, int c);
00851 public:
00853 virtual Actor* copy(Space& home, bool share);
00855 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00857 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00859 static ExecStatus post(Home home, ViewArray<VX>& x, int c);
00860 };
00861
00868 template<class VX>
00869 class NqBoolInt : public BinaryPropagator<VX,PC_INT_VAL> {
00870 protected:
00871 using BinaryPropagator<VX,PC_INT_VAL>::x0;
00872 using BinaryPropagator<VX,PC_INT_VAL>::x1;
00874 ViewArray<VX> x;
00876 int c;
00878 bool resubscribe(Space& home, VX& y);
00880 NqBoolInt(Home home, ViewArray<VX>& b, int c);
00882 NqBoolInt(Space& home, bool share, NqBoolInt<VX>& p);
00883 public:
00885 virtual Actor* copy(Space& home, bool share);
00887 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00889 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00891 static ExecStatus post(Home home, ViewArray<VX>& b, int c);
00893 virtual size_t dispose(Space& home);
00894 };
00895
00896
00901 template<class VX, class VB>
00902 class ReLinBoolInt : public Propagator {
00903 protected:
00905 Council<Advisor> co;
00907 ViewArray<VX> x;
00909 int n_s;
00911 int c;
00913 VB b;
00915 void normalize(void);
00917 ReLinBoolInt(Space& home, bool share, ReLinBoolInt& p);
00919 ReLinBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
00920 public:
00922 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00924 virtual size_t dispose(Space& home);
00925 };
00926
00927
00931 template<class BV>
00932 class BoolNegTraits {};
00933
00940 template<class VX, class VB, ReifyMode rm>
00941 class ReGqBoolInt : public ReLinBoolInt<VX,VB> {
00942 protected:
00943 using ReLinBoolInt<VX,VB>::co;
00944 using ReLinBoolInt<VX,VB>::x;
00945 using ReLinBoolInt<VX,VB>::c;
00946 using ReLinBoolInt<VX,VB>::b;
00947 using ReLinBoolInt<VX,VB>::n_s;
00948 using ReLinBoolInt<VX,VB>::normalize;
00950 ReGqBoolInt(Space& home, bool share, ReGqBoolInt& p);
00952 ReGqBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
00953 public:
00955 virtual Actor* copy(Space& home, bool share);
00957 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00959 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00961 static ExecStatus post(Home home, ViewArray<VX>& x, int c, VB b);
00962 };
00963
00970 template<class VX, class VB, ReifyMode rm>
00971 class ReEqBoolInt : public ReLinBoolInt<VX,VB> {
00972 protected:
00973 using ReLinBoolInt<VX,VB>::co;
00974 using ReLinBoolInt<VX,VB>::x;
00975 using ReLinBoolInt<VX,VB>::c;
00976 using ReLinBoolInt<VX,VB>::b;
00977 using ReLinBoolInt<VX,VB>::n_s;
00978 using ReLinBoolInt<VX,VB>::normalize;
00980 ReEqBoolInt(Space& home, bool share, ReEqBoolInt& p);
00982 ReEqBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
00983 public:
00985 virtual Actor* copy(Space& home, bool share);
00987 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00989 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00991 static ExecStatus post(Home home, ViewArray<VX>& x, int c, VB b);
00992 };
00993
00994 }}}
00995
00996 #include <gecode/int/linear/bool-int.hpp>
00997
00998 namespace Gecode { namespace Int { namespace Linear {
00999
01004 template<class XV, class YV>
01005 class LinBoolView : public Propagator {
01006 protected:
01008 ViewArray<XV> x;
01010 YV y;
01012 int c;
01014 LinBoolView(Space& home, bool share, LinBoolView& p);
01016 LinBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01017 public:
01019 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
01021 virtual size_t dispose(Space& home);
01022 };
01023
01024
01031 template<class XV, class YV>
01032 class EqBoolView : public LinBoolView<XV,YV> {
01033 protected:
01034 using LinBoolView<XV,YV>::x;
01035 using LinBoolView<XV,YV>::y;
01036 using LinBoolView<XV,YV>::c;
01037
01039 EqBoolView(Space& home, bool share, EqBoolView& p);
01041 EqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01042 public:
01044 virtual Actor* copy(Space& home, bool share);
01046 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01048 static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
01049 };
01050
01057 template<class XV, class YV>
01058 class NqBoolView : public LinBoolView<XV,YV> {
01059 protected:
01060 using LinBoolView<XV,YV>::x;
01061 using LinBoolView<XV,YV>::y;
01062 using LinBoolView<XV,YV>::c;
01063
01065 NqBoolView(Space& home, bool share, NqBoolView& p);
01067 NqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01068 public:
01070 virtual Actor* copy(Space& home, bool share);
01072 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01074 static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
01075 };
01076
01083 template<class XV, class YV>
01084 class GqBoolView : public LinBoolView<XV,YV> {
01085 protected:
01086 using LinBoolView<XV,YV>::x;
01087 using LinBoolView<XV,YV>::y;
01088 using LinBoolView<XV,YV>::c;
01089
01091 GqBoolView(Space& home, bool share, GqBoolView& p);
01093 GqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01094 public:
01096 virtual Actor* copy(Space& home, bool share);
01098 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01100 static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
01101 };
01102
01103 }}}
01104
01105 #include <gecode/int/linear/bool-view.hpp>
01106
01107 namespace Gecode { namespace Int { namespace Linear {
01108
01110 class ScaleBool {
01111 public:
01113 int a;
01115 BoolView x;
01116 };
01117
01119 class ScaleBoolArray {
01120 private:
01122 ScaleBool* _fst;
01124 ScaleBool* _lst;
01125 public:
01127 ScaleBoolArray(void);
01129 ScaleBoolArray(Space& home, int n);
01131 void subscribe(Space& home, Propagator& p);
01133 void cancel(Space& home, Propagator& p);
01135 void update(Space& home, bool share, ScaleBoolArray& sba);
01137 ScaleBool* fst(void) const;
01139 ScaleBool* lst(void) const;
01141 void fst(ScaleBool* f);
01143 void lst(ScaleBool* l);
01145 bool empty(void) const;
01147 int size(void) const;
01148 private:
01150 class ScaleDec {
01151 public:
01152 bool
01153 operator ()(const ScaleBool& x, const ScaleBool& y);
01154 };
01155 public:
01157 void sort(void);
01158 };
01159
01160
01162 class EmptyScaleBoolArray {
01163 public:
01165 EmptyScaleBoolArray(void);
01167 EmptyScaleBoolArray(Space& home, int n);
01169 void subscribe(Space& home, Propagator& p);
01171 void cancel(Space& home, Propagator& p);
01173 void update(Space& home, bool share, EmptyScaleBoolArray& esba);
01175 ScaleBool* fst(void) const;
01177 ScaleBool* lst(void) const;
01179 void fst(ScaleBool* f);
01181 void lst(ScaleBool* l);
01183 bool empty(void) const;
01185 int size(void) const;
01187 void sort(void);
01188 };
01189
01190
01195 template<class SBAP, class SBAN, class VX, PropCond pcx>
01196 class LinBoolScale : public Propagator {
01197 protected:
01199 SBAP p;
01201 SBAN n;
01203 VX x;
01205 int c;
01206 public:
01208 LinBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01210 LinBoolScale(Space& home, bool share, Propagator& pr,
01211 SBAP& p, SBAN& n, VX x, int c);
01213 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
01215 virtual size_t dispose(Space& home);
01216 };
01217
01224 template<class SBAP, class SBAN, class VX>
01225 class EqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
01226 protected:
01227 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::p;
01228 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::n;
01229 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::x;
01230 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::c;
01231 public:
01233 EqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01235 EqBoolScale(Space& home, bool share, Propagator& pr,
01236 SBAP& p, SBAN& n, VX x, int c);
01238 virtual Actor* copy(Space& home, bool share);
01240 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01242 static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
01243 };
01244
01251 template<class SBAP, class SBAN, class VX>
01252 class LqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
01253 protected:
01254 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::p;
01255 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::n;
01256 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::x;
01257 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::c;
01258 public:
01260 LqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01262 LqBoolScale(Space& home, bool share, Propagator& pr,
01263 SBAP& p, SBAN& n, VX x, int c);
01265 virtual Actor* copy(Space& home, bool share);
01267 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01269 static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
01270 };
01271
01278 template<class SBAP, class SBAN, class VX>
01279 class NqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL> {
01280 protected:
01281 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::p;
01282 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::n;
01283 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::x;
01284 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::c;
01285 public:
01287 NqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01289 NqBoolScale(Space& home, bool share, Propagator& pr,
01290 SBAP& p, SBAN& n, VX x, int c);
01292 virtual Actor* copy(Space& home, bool share);
01294 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01296 static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
01297 };
01298
01299 }}}
01300
01301 #include <gecode/int/linear/bool-scale.hpp>
01302
01303 namespace Gecode { namespace Int { namespace Linear {
01304
01309 template<class View>
01310 class Term {
01311 public:
01313 int a;
01315 View x;
01316 };
01317
01332 template<class View>
01333 void estimate(Term<View>* t, int n, int c,
01334 int& l, int& u);
01335
01363 GECODE_INT_EXPORT void
01364 post(Home home, Term<IntView>* t, int n, IntRelType irt, int c,
01365 IntConLevel=ICL_DEF);
01366
01396 GECODE_INT_EXPORT void
01397 post(Home home, Term<IntView>* t, int n, IntRelType irt, int c, Reify r,
01398 IntConLevel=ICL_DEF);
01399
01427 GECODE_INT_EXPORT void
01428 post(Home home, Term<BoolView>* t, int n, IntRelType irt, int c,
01429 IntConLevel=ICL_DEF);
01430
01459 GECODE_INT_EXPORT void
01460 post(Home home, Term<BoolView>* t, int n, IntRelType irt, int c, Reify r,
01461 IntConLevel=ICL_DEF);
01462
01491 GECODE_INT_EXPORT void
01492 post(Home home, Term<BoolView>* t, int n, IntRelType irt, IntView y, int c=0,
01493 IntConLevel=ICL_DEF);
01494
01523 GECODE_INT_EXPORT void
01524 post(Home home, Term<BoolView>* t, int n, IntRelType irt, IntView y,
01525 Reify r, IntConLevel=ICL_DEF);
01526
01527 }}}
01528
01529 #include <gecode/int/linear/post.hpp>
01530
01531 #endif
01532
01533