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 void reschedule(Space& home);
00089 virtual size_t dispose(Space& home);
00090 };
00091
00101 template<class Val, class A, class B, PropCond pc, class Ctrl>
00102 class ReLinBin : public Propagator {
00103 protected:
00105 A x0;
00107 B x1;
00109 Val c;
00111 Ctrl b;
00113 ReLinBin(Space& home, bool share, ReLinBin& p);
00115 ReLinBin(Home home, A x0, B x1, Val c, Ctrl b);
00116 public:
00118 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00120 virtual void reschedule(Space& home);
00122 virtual size_t dispose(Space& home);
00123 };
00124
00137 template<class Val, class A, class B>
00138 class EqBin : public LinBin<Val,A,B,PC_INT_BND> {
00139 protected:
00140 using LinBin<Val,A,B,PC_INT_BND>::x0;
00141 using LinBin<Val,A,B,PC_INT_BND>::x1;
00142 using LinBin<Val,A,B,PC_INT_BND>::c;
00143
00145 EqBin(Space& home, bool share, EqBin& p);
00147 EqBin(Home home, A x0, B x1, Val c);
00148 public:
00150 EqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00152 virtual Actor* copy(Space& home, bool share);
00154 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00156 static ExecStatus post(Home home, A x0, B x1, Val c);
00157 };
00158
00171 template<class Val, class A, class B, class Ctrl, ReifyMode rm>
00172 class ReEqBin : public ReLinBin<Val,A,B,PC_INT_BND,Ctrl> {
00173 protected:
00174 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::x0;
00175 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::x1;
00176 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::c;
00177 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::b;
00178
00180 ReEqBin(Space& home, bool share, ReEqBin& p);
00182 ReEqBin(Home home,A,B,Val,Ctrl);
00183 public:
00185 virtual Actor* copy(Space& home, bool share);
00187 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00189 static ExecStatus post(Home home, A x0, B x1, Val c, Ctrl b);
00190 };
00191
00204 template<class Val, class A, class B>
00205 class NqBin : public LinBin<Val,A,B,PC_INT_VAL> {
00206 protected:
00207 using LinBin<Val,A,B,PC_INT_VAL>::x0;
00208 using LinBin<Val,A,B,PC_INT_VAL>::x1;
00209 using LinBin<Val,A,B,PC_INT_VAL>::c;
00210
00212 NqBin(Space& home, bool share, NqBin& p);
00214 NqBin(Home home, A x0, B x1, Val c);
00215 public:
00217 NqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00219 virtual Actor* copy(Space& home, bool share);
00221 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00223 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00225 static ExecStatus post(Home home, A x0, B x1, Val c);
00226 };
00227
00240 template<class Val, class A, class B>
00241 class LqBin : public LinBin<Val,A,B,PC_INT_BND> {
00242 protected:
00243 using LinBin<Val,A,B,PC_INT_BND>::x0;
00244 using LinBin<Val,A,B,PC_INT_BND>::x1;
00245 using LinBin<Val,A,B,PC_INT_BND>::c;
00246
00248 LqBin(Space& home, bool share, LqBin& p);
00250 LqBin(Home home, A x0, B x1, Val c);
00251 public:
00253 LqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00255 virtual Actor* copy(Space& home, bool share);
00257 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00259 static ExecStatus post(Home home, A x0, B x1, Val c);
00260 };
00261
00274 template<class Val, class A, class B>
00275 class GqBin : public LinBin<Val,A,B,PC_INT_BND> {
00276 protected:
00277 using LinBin<Val,A,B,PC_INT_BND>::x0;
00278 using LinBin<Val,A,B,PC_INT_BND>::x1;
00279 using LinBin<Val,A,B,PC_INT_BND>::c;
00280
00282 GqBin(Space& home, bool share, GqBin& p);
00284 GqBin(Home home, A x0, B x1, Val c);
00285 public:
00287 GqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
00289 virtual Actor* copy(Space& home, bool share);
00291 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00293 static ExecStatus post(Home home, A x0, B x1, Val c);
00294 };
00295
00308 template<class Val, class A, class B, ReifyMode rm>
00309 class ReLqBin : public ReLinBin<Val,A,B,PC_INT_BND,BoolView> {
00310 protected:
00311 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::x0;
00312 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::x1;
00313 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::c;
00314 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::b;
00315
00317 ReLqBin(Space& home, bool share, ReLqBin& p);
00319 ReLqBin(Home home, A x0, B x1, Val c, BoolView b);
00320 public:
00322 virtual Actor* copy(Space& home, bool share);
00324 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00326 static ExecStatus post(Home home, A x0, B x1, Val c, BoolView b);
00327 };
00328
00329 }}}
00330
00331 #include <gecode/int/linear/int-bin.hpp>
00332
00333 namespace Gecode { namespace Int { namespace Linear {
00334
00335
00336
00337
00338
00339
00349 template<class Val, class A, class B, class C, PropCond pc>
00350 class LinTer : public Propagator {
00351 protected:
00353 A x0;
00355 B x1;
00357 C x2;
00359 Val c;
00361 LinTer(Space& home, bool share, LinTer& p);
00363 LinTer(Home home, A x0, B x1, C x2, Val c);
00365 LinTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00366 public:
00368 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00370 virtual void reschedule(Space& home);
00372 virtual size_t dispose(Space& home);
00373 };
00374
00387 template<class Val, class A, class B, class C>
00388 class EqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
00389 protected:
00390 using LinTer<Val,A,B,C,PC_INT_BND>::x0;
00391 using LinTer<Val,A,B,C,PC_INT_BND>::x1;
00392 using LinTer<Val,A,B,C,PC_INT_BND>::x2;
00393 using LinTer<Val,A,B,C,PC_INT_BND>::c;
00394
00396 EqTer(Space& home, bool share, EqTer& p);
00398 EqTer(Home home, A x0, B x1, C x2, Val c);
00399 public:
00401 EqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00403 virtual Actor* copy(Space& home, bool share);
00405 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00407 static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
00408 };
00409
00422 template<class Val, class A, class B, class C>
00423 class NqTer : public LinTer<Val,A,B,C,PC_INT_VAL> {
00424 protected:
00425 using LinTer<Val,A,B,C,PC_INT_VAL>::x0;
00426 using LinTer<Val,A,B,C,PC_INT_VAL>::x1;
00427 using LinTer<Val,A,B,C,PC_INT_VAL>::x2;
00428 using LinTer<Val,A,B,C,PC_INT_VAL>::c;
00429
00431 NqTer(Space& home, bool share, NqTer& p);
00433 NqTer(Home home, A x0, B x1, C x2, Val c);
00434 public:
00436 NqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00438 virtual Actor* copy(Space& home, bool share);
00440 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00442 static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
00443 };
00444
00457 template<class Val, class A, class B, class C>
00458 class LqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
00459 protected:
00460 using LinTer<Val,A,B,C,PC_INT_BND>::x0;
00461 using LinTer<Val,A,B,C,PC_INT_BND>::x1;
00462 using LinTer<Val,A,B,C,PC_INT_BND>::x2;
00463 using LinTer<Val,A,B,C,PC_INT_BND>::c;
00464
00466 LqTer(Space& home, bool share, LqTer& p);
00468 LqTer(Home home, A x0, B x1, C x2, Val c);
00469 public:
00471 LqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00473 virtual Actor* copy(Space& home, bool share);
00475 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00477 static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
00478 };
00479
00480 }}}
00481
00482 #include <gecode/int/linear/int-ter.hpp>
00483
00484 namespace Gecode { namespace Int { namespace Linear {
00485
00486
00487
00488
00489
00490
00500 template<class Val, class P, class N, PropCond pc>
00501 class Lin : public Propagator {
00502 protected:
00504 ViewArray<P> x;
00506 ViewArray<N> y;
00508 Val c;
00509
00511 Lin(Space& home, bool share, Lin<Val,P,N,pc>& p);
00513 Lin(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00514 public:
00516 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00518 virtual void reschedule(Space& home);
00520 virtual size_t dispose(Space& home);
00521 };
00522
00532 template<class Val, class P, class N, PropCond pc, class Ctrl>
00533 class ReLin : public Lin<Val,P,N,pc> {
00534 protected:
00535 using Lin<Val,P,N,pc>::x;
00536 using Lin<Val,P,N,pc>::y;
00538 Ctrl b;
00540 ReLin(Space& home, bool share, ReLin& p);
00542 ReLin(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00543 public:
00545 virtual void reschedule(Space& home);
00547 virtual size_t dispose(Space& home);
00548 };
00549
00555 template<class Val, class View>
00556 void bounds_p(ModEventDelta med, ViewArray<View>& x,
00557 Val& c, Val& sl, Val& su);
00558
00564 template<class Val, class View>
00565 void bounds_n(ModEventDelta med, ViewArray<View>& y,
00566 Val& c, Val& sl, Val& su);
00567
00580 template<class Val, class P, class N>
00581 class Eq : public Lin<Val,P,N,PC_INT_BND> {
00582 protected:
00583 using Lin<Val,P,N,PC_INT_BND>::x;
00584 using Lin<Val,P,N,PC_INT_BND>::y;
00585 using Lin<Val,P,N,PC_INT_BND>::c;
00586
00588 Eq(Space& home, bool share, Eq& p);
00589 public:
00591 Eq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00593 virtual Actor* copy(Space& home, bool share);
00595 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00597 static ExecStatus
00598 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00599 };
00600
00611 template<class Val, class View>
00612 class DomEq
00613 : public Lin<Val,View,View,PC_INT_DOM> {
00614 protected:
00615 using Lin<Val,View,View,PC_INT_DOM>::x;
00616 using Lin<Val,View,View,PC_INT_DOM>::y;
00617 using Lin<Val,View,View,PC_INT_DOM>::c;
00618
00620 DomEq(Space& home, bool share, DomEq& p);
00621 public:
00623 DomEq(Home home, ViewArray<View>& x, ViewArray<View>& y, Val c);
00625 virtual Actor* copy(Space& home, bool share);
00632 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00634 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00636 static ExecStatus
00637 post(Home home, ViewArray<View>& x, ViewArray<View>& y, Val c);
00638 };
00639
00652 template<class Val, class P, class N, class Ctrl, ReifyMode rm>
00653 class ReEq : public ReLin<Val,P,N,PC_INT_BND,Ctrl> {
00654 protected:
00655 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::x;
00656 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::y;
00657 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::c;
00658 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::b;
00659
00661 ReEq(Space& home, bool share, ReEq& p);
00662 public:
00664 ReEq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00666 virtual Actor* copy(Space& home, bool share);
00668 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00670 static ExecStatus
00671 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00672 };
00673
00686 template<class Val, class P, class N>
00687 class Nq : public Lin<Val,P,N,PC_INT_VAL> {
00688 protected:
00689 using Lin<Val,P,N,PC_INT_VAL>::x;
00690 using Lin<Val,P,N,PC_INT_VAL>::y;
00691 using Lin<Val,P,N,PC_INT_VAL>::c;
00692
00694 Nq(Space& home, bool share, Nq& p);
00695 public:
00697 Nq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00699 virtual Actor* copy(Space& home, bool share);
00701 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00703 static ExecStatus
00704 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00705 };
00706
00719 template<class Val, class P, class N>
00720 class Lq : public Lin<Val,P,N,PC_INT_BND> {
00721 protected:
00722 using Lin<Val,P,N,PC_INT_BND>::x;
00723 using Lin<Val,P,N,PC_INT_BND>::y;
00724 using Lin<Val,P,N,PC_INT_BND>::c;
00725
00727 Lq(Space& home, bool share, Lq& p);
00728 public:
00730 Lq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00732 virtual Actor* copy(Space& home, bool share);
00734 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00736 static ExecStatus
00737 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00738 };
00739
00752 template<class Val, class P, class N, ReifyMode rm>
00753 class ReLq : public ReLin<Val,P,N,PC_INT_BND,BoolView> {
00754 protected:
00755 using ReLin<Val,P,N,PC_INT_BND,BoolView>::x;
00756 using ReLin<Val,P,N,PC_INT_BND,BoolView>::y;
00757 using ReLin<Val,P,N,PC_INT_BND,BoolView>::c;
00758 using ReLin<Val,P,N,PC_INT_BND,BoolView>::b;
00759
00761 ReLq(Space& home, bool share, ReLq& p);
00762 public:
00764 ReLq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
00766 virtual Actor* copy(Space& home, bool share);
00768 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00770 static ExecStatus
00771 post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
00772 };
00773
00774 }}}
00775
00776 #include <gecode/int/linear/int-nary.hpp>
00777 #include <gecode/int/linear/int-dom.hpp>
00778
00779 namespace Gecode { namespace Int { namespace Linear {
00780
00781
00782
00783
00784
00785
00790 template<class VX>
00791 class LinBoolInt : public Propagator {
00792 protected:
00794 Council<Advisor> co;
00796 ViewArray<VX> x;
00798 int n_as;
00800 int n_hs;
00802 int c;
00804 void normalize(void);
00806 LinBoolInt(Space& home, bool share, LinBoolInt& p);
00808 LinBoolInt(Home home, ViewArray<VX>& x, int n_s, int c);
00809 public:
00811 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00813 virtual size_t dispose(Space& home);
00814 };
00815
00822 template<class VX>
00823 class EqBoolInt : public LinBoolInt<VX> {
00824 protected:
00825 using LinBoolInt<VX>::co;
00826 using LinBoolInt<VX>::x;
00827 using LinBoolInt<VX>::n_as;
00828 using LinBoolInt<VX>::n_hs;
00829 using LinBoolInt<VX>::c;
00830 using LinBoolInt<VX>::disabled;
00832 EqBoolInt(Space& home, bool share, EqBoolInt& p);
00834 EqBoolInt(Home home, ViewArray<VX>& x, int c);
00835 public:
00837 virtual Actor* copy(Space& home, bool share);
00839 virtual void reschedule(Space& home);
00841 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00843 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00845 static ExecStatus post(Home home, ViewArray<VX>& x, int c);
00846 };
00847
00854 template<class VX>
00855 class GqBoolInt : public LinBoolInt<VX> {
00856 protected:
00857 using LinBoolInt<VX>::co;
00858 using LinBoolInt<VX>::x;
00859 using LinBoolInt<VX>::n_as;
00860 using LinBoolInt<VX>::n_hs;
00861 using LinBoolInt<VX>::c;
00862 using LinBoolInt<VX>::disabled;
00864 GqBoolInt(Space& home, bool share, GqBoolInt& p);
00866 GqBoolInt(Home home, ViewArray<VX>& x, int c);
00867 public:
00869 virtual Actor* copy(Space& home, bool share);
00871 virtual void reschedule(Space& home);
00873 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00875 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00877 static ExecStatus post(Home home, ViewArray<VX>& x, int c);
00878 };
00879
00886 template<class VX>
00887 class NqBoolInt : public BinaryPropagator<VX,PC_INT_VAL> {
00888 protected:
00889 using BinaryPropagator<VX,PC_INT_VAL>::x0;
00890 using BinaryPropagator<VX,PC_INT_VAL>::x1;
00892 ViewArray<VX> x;
00894 int c;
00896 bool resubscribe(Space& home, VX& y);
00898 NqBoolInt(Home home, ViewArray<VX>& b, int c);
00900 NqBoolInt(Space& home, bool share, NqBoolInt<VX>& p);
00901 public:
00903 virtual Actor* copy(Space& home, bool share);
00905 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00907 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00909 static ExecStatus post(Home home, ViewArray<VX>& b, int c);
00911 virtual size_t dispose(Space& home);
00912 };
00913
00914
00919 template<class VX, class VB>
00920 class ReLinBoolInt : public Propagator {
00921 protected:
00923 Council<Advisor> co;
00925 ViewArray<VX> x;
00927 int n_s;
00929 int c;
00931 VB b;
00933 void normalize(void);
00935 ReLinBoolInt(Space& home, bool share, ReLinBoolInt& p);
00937 ReLinBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
00938 public:
00940 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00942 virtual size_t dispose(Space& home);
00943 };
00944
00945
00949 template<class BV>
00950 class BoolNegTraits {};
00951
00958 template<class VX, class VB, ReifyMode rm>
00959 class ReGqBoolInt : public ReLinBoolInt<VX,VB> {
00960 protected:
00961 using ReLinBoolInt<VX,VB>::co;
00962 using ReLinBoolInt<VX,VB>::x;
00963 using ReLinBoolInt<VX,VB>::c;
00964 using ReLinBoolInt<VX,VB>::b;
00965 using ReLinBoolInt<VX,VB>::n_s;
00966 using ReLinBoolInt<VX,VB>::normalize;
00968 ReGqBoolInt(Space& home, bool share, ReGqBoolInt& p);
00970 ReGqBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
00971 public:
00973 virtual Actor* copy(Space& home, bool share);
00975 virtual void reschedule(Space& home);
00977 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00979 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00981 static ExecStatus post(Home home, ViewArray<VX>& x, int c, VB b);
00982 };
00983
00990 template<class VX, class VB, ReifyMode rm>
00991 class ReEqBoolInt : public ReLinBoolInt<VX,VB> {
00992 protected:
00993 using ReLinBoolInt<VX,VB>::co;
00994 using ReLinBoolInt<VX,VB>::x;
00995 using ReLinBoolInt<VX,VB>::c;
00996 using ReLinBoolInt<VX,VB>::b;
00997 using ReLinBoolInt<VX,VB>::n_s;
00998 using ReLinBoolInt<VX,VB>::normalize;
01000 ReEqBoolInt(Space& home, bool share, ReEqBoolInt& p);
01002 ReEqBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
01003 public:
01005 virtual Actor* copy(Space& home, bool share);
01007 virtual void reschedule(Space& home);
01009 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
01011 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01013 static ExecStatus post(Home home, ViewArray<VX>& x, int c, VB b);
01014 };
01015
01016 }}}
01017
01018 #include <gecode/int/linear/bool-int.hpp>
01019
01020 namespace Gecode { namespace Int { namespace Linear {
01021
01026 template<class XV, class YV>
01027 class LinBoolView : public Propagator {
01028 protected:
01030 ViewArray<XV> x;
01032 YV y;
01034 int c;
01036 LinBoolView(Space& home, bool share, LinBoolView& p);
01038 LinBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01039 public:
01041 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
01043 virtual void reschedule(Space& home);
01045 virtual size_t dispose(Space& home);
01046 };
01047
01048
01055 template<class XV, class YV>
01056 class EqBoolView : public LinBoolView<XV,YV> {
01057 protected:
01058 using LinBoolView<XV,YV>::x;
01059 using LinBoolView<XV,YV>::y;
01060 using LinBoolView<XV,YV>::c;
01061
01063 EqBoolView(Space& home, bool share, EqBoolView& p);
01065 EqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01066 public:
01068 virtual Actor* copy(Space& home, bool share);
01070 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01072 static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
01073 };
01074
01081 template<class XV, class YV>
01082 class NqBoolView : public LinBoolView<XV,YV> {
01083 protected:
01084 using LinBoolView<XV,YV>::x;
01085 using LinBoolView<XV,YV>::y;
01086 using LinBoolView<XV,YV>::c;
01087
01089 NqBoolView(Space& home, bool share, NqBoolView& p);
01091 NqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01092 public:
01094 virtual Actor* copy(Space& home, bool share);
01096 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01098 static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
01099 };
01100
01107 template<class XV, class YV>
01108 class GqBoolView : public LinBoolView<XV,YV> {
01109 protected:
01110 using LinBoolView<XV,YV>::x;
01111 using LinBoolView<XV,YV>::y;
01112 using LinBoolView<XV,YV>::c;
01113
01115 GqBoolView(Space& home, bool share, GqBoolView& p);
01117 GqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
01118 public:
01120 virtual Actor* copy(Space& home, bool share);
01122 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01124 static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
01125 };
01126
01127 }}}
01128
01129 #include <gecode/int/linear/bool-view.hpp>
01130
01131 namespace Gecode { namespace Int { namespace Linear {
01132
01134 class ScaleBool {
01135 public:
01137 int a;
01139 BoolView x;
01140 };
01141
01143 class ScaleBoolArray {
01144 private:
01146 ScaleBool* _fst;
01148 ScaleBool* _lst;
01149 public:
01151 ScaleBoolArray(void);
01153 ScaleBoolArray(Space& home, int n);
01155 void subscribe(Space& home, Propagator& p);
01157 void cancel(Space& home, Propagator& p);
01159 void reschedule(Space& home, Propagator& p);
01161 void update(Space& home, bool share, ScaleBoolArray& sba);
01163 ScaleBool* fst(void) const;
01165 ScaleBool* lst(void) const;
01167 void fst(ScaleBool* f);
01169 void lst(ScaleBool* l);
01171 bool empty(void) const;
01173 int size(void) const;
01174 private:
01176 class ScaleDec {
01177 public:
01178 bool
01179 operator ()(const ScaleBool& x, const ScaleBool& y);
01180 };
01181 public:
01183 void sort(void);
01184 };
01185
01186
01188 class EmptyScaleBoolArray {
01189 public:
01191 EmptyScaleBoolArray(void);
01193 EmptyScaleBoolArray(Space& home, int n);
01195 void subscribe(Space& home, Propagator& p);
01197 void cancel(Space& home, Propagator& p);
01199 void reschedule(Space& home, Propagator& p);
01201 void update(Space& home, bool share, EmptyScaleBoolArray& esba);
01203 ScaleBool* fst(void) const;
01205 ScaleBool* lst(void) const;
01207 void fst(ScaleBool* f);
01209 void lst(ScaleBool* l);
01211 bool empty(void) const;
01213 int size(void) const;
01215 void sort(void);
01216 };
01217
01218
01223 template<class SBAP, class SBAN, class VX, PropCond pcx>
01224 class LinBoolScale : public Propagator {
01225 protected:
01227 SBAP p;
01229 SBAN n;
01231 VX x;
01233 int c;
01234 public:
01236 LinBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01238 LinBoolScale(Space& home, bool share, Propagator& pr,
01239 SBAP& p, SBAN& n, VX x, int c);
01241 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
01243 virtual void reschedule(Space& home);
01245 virtual size_t dispose(Space& home);
01246 };
01247
01254 template<class SBAP, class SBAN, class VX>
01255 class EqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
01256 protected:
01257 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::p;
01258 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::n;
01259 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::x;
01260 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::c;
01261 public:
01263 EqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01265 EqBoolScale(Space& home, bool share, Propagator& pr,
01266 SBAP& p, SBAN& n, VX x, int c);
01268 virtual Actor* copy(Space& home, bool share);
01270 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01272 static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
01273 };
01274
01281 template<class SBAP, class SBAN, class VX>
01282 class LqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
01283 protected:
01284 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::p;
01285 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::n;
01286 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::x;
01287 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::c;
01288 public:
01290 LqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01292 LqBoolScale(Space& home, bool share, Propagator& pr,
01293 SBAP& p, SBAN& n, VX x, int c);
01295 virtual Actor* copy(Space& home, bool share);
01297 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01299 static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
01300 };
01301
01308 template<class SBAP, class SBAN, class VX>
01309 class NqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL> {
01310 protected:
01311 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::p;
01312 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::n;
01313 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::x;
01314 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::c;
01315 public:
01317 NqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
01319 NqBoolScale(Space& home, bool share, Propagator& pr,
01320 SBAP& p, SBAN& n, VX x, int c);
01322 virtual Actor* copy(Space& home, bool share);
01324 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
01326 static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
01327 };
01328
01329 }}}
01330
01331 #include <gecode/int/linear/bool-scale.hpp>
01332
01333 namespace Gecode { namespace Int { namespace Linear {
01334
01339 template<class View>
01340 class Term {
01341 public:
01343 int a;
01345 View x;
01346 };
01347
01362 template<class View>
01363 void estimate(Term<View>* t, int n, int c,
01364 int& l, int& u);
01365
01393 GECODE_INT_EXPORT void
01394 post(Home home, Term<IntView>* t, int n, IntRelType irt, int c,
01395 IntPropLevel=IPL_DEF);
01396
01426 GECODE_INT_EXPORT void
01427 post(Home home, Term<IntView>* t, int n, IntRelType irt, int c, Reify r,
01428 IntPropLevel=IPL_DEF);
01429
01457 GECODE_INT_EXPORT void
01458 post(Home home, Term<BoolView>* t, int n, IntRelType irt, int c,
01459 IntPropLevel=IPL_DEF);
01460
01489 GECODE_INT_EXPORT void
01490 post(Home home, Term<BoolView>* t, int n, IntRelType irt, int c, Reify r,
01491 IntPropLevel=IPL_DEF);
01492
01521 GECODE_INT_EXPORT void
01522 post(Home home, Term<BoolView>* t, int n, IntRelType irt, IntView y, int c=0,
01523 IntPropLevel=IPL_DEF);
01524
01553 GECODE_INT_EXPORT void
01554 post(Home home, Term<BoolView>* t, int n, IntRelType irt, IntView y,
01555 Reify r, IntPropLevel=IPL_DEF);
01556
01557 }}}
01558
01559 #include <gecode/int/linear/post.hpp>
01560
01561 #endif
01562
01563