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 #ifndef __GECODE_INT_LINEAR_HH__
00041 #define __GECODE_INT_LINEAR_HH__
00042
00043 #include "gecode/int.hh"
00044
00050 namespace Gecode { namespace Int { namespace Linear {
00051
00052
00053
00054
00055
00056
00066 template <class Val, class A, class B, PropCond pc>
00067 class LinBin : public Propagator {
00068 protected:
00070 A x0;
00072 B x1;
00074 Val c;
00076 LinBin(Space* home, bool share, LinBin& p);
00078 LinBin(Space* home, bool share, Propagator& p, A x0, B x1, Val c);
00080 LinBin(Space* home, A x0, B x1, Val c);
00082 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00083 const Support::Symbol& name) const;
00084 public:
00086 virtual PropCost cost(ModEventDelta med) const;
00088 virtual size_t dispose(Space* home);
00089 };
00090
00100 template <class Val, class A, class B, PropCond pc, class Ctrl>
00101 class ReLinBin : public Propagator {
00102 protected:
00104 A x0;
00106 B x1;
00108 Val c;
00110 Ctrl b;
00112 ReLinBin(Space* home, bool share, ReLinBin& p);
00114 ReLinBin(Space* home, A x0, B x1, Val c, Ctrl b);
00116 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00117 const Support::Symbol& name) const;
00118 public:
00120 virtual PropCost cost(ModEventDelta med) const;
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(Space* 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, ModEventDelta med);
00156 virtual Reflection::ActorSpec spec(const Space* home,
00157 Reflection::VarMap& m) const;
00159 static void post(Space* home, Reflection::VarMap& vars,
00160 const Reflection::ActorSpec& spec);
00162 static Support::Symbol ati(void);
00164 static ExecStatus post(Space* home, A x0, B x1, Val c);
00165 };
00166
00179 template <class Val, class A, class B, class Ctrl>
00180 class ReEqBin : public ReLinBin<Val,A,B,PC_INT_BND,Ctrl> {
00181 protected:
00182 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::x0;
00183 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::x1;
00184 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::c;
00185 using ReLinBin<Val,A,B,PC_INT_BND,Ctrl>::b;
00186
00188 ReEqBin(Space* home, bool share, ReEqBin& p);
00190 ReEqBin(Space* home,A,B,Val,Ctrl);
00191 public:
00193 virtual Actor* copy(Space* home, bool share);
00195 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00197 virtual Reflection::ActorSpec spec(const Space* home,
00198 Reflection::VarMap& m) const;
00200 static void post(Space* home, Reflection::VarMap& vars,
00201 const Reflection::ActorSpec& spec);
00203 static Support::Symbol ati(void);
00205 static ExecStatus post(Space* home, A x0, B x1, Val c, Ctrl b);
00206 };
00207
00220 template <class Val, class A, class B>
00221 class NqBin : public LinBin<Val,A,B,PC_INT_VAL> {
00222 protected:
00223 using LinBin<Val,A,B,PC_INT_VAL>::x0;
00224 using LinBin<Val,A,B,PC_INT_VAL>::x1;
00225 using LinBin<Val,A,B,PC_INT_VAL>::c;
00226
00228 NqBin(Space* home, bool share, NqBin& p);
00230 NqBin(Space* home, A x0, B x1, Val c);
00231 public:
00233 NqBin(Space* home, bool share, Propagator& p, A x0, B x1, Val c);
00235 virtual Actor* copy(Space* home, bool share);
00237 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00239 virtual PropCost cost(ModEventDelta med) const;
00241 virtual Reflection::ActorSpec spec(const Space* home,
00242 Reflection::VarMap& m) const;
00244 static void post(Space* home, Reflection::VarMap& vars,
00245 const Reflection::ActorSpec& spec);
00247 static Support::Symbol ati(void);
00249 static ExecStatus post(Space* home, A x0, B x1, Val c);
00250 };
00251
00264 template <class Val, class A, class B>
00265 class LqBin : public LinBin<Val,A,B,PC_INT_BND> {
00266 protected:
00267 using LinBin<Val,A,B,PC_INT_BND>::x0;
00268 using LinBin<Val,A,B,PC_INT_BND>::x1;
00269 using LinBin<Val,A,B,PC_INT_BND>::c;
00270
00272 LqBin(Space* home, bool share, LqBin& p);
00274 LqBin(Space* home, A x0, B x1, Val c);
00275 public:
00277 LqBin(Space* home, bool share, Propagator& p, A x0, B x1, Val c);
00279 virtual Actor* copy(Space* home, bool share);
00281 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00283 virtual Reflection::ActorSpec spec(const Space* home,
00284 Reflection::VarMap& m) const;
00286 static void post(Space* home, Reflection::VarMap& vars,
00287 const Reflection::ActorSpec& spec);
00289 static Support::Symbol ati(void);
00291 static ExecStatus post(Space* home, A x0, B x1, Val c);
00292 };
00293
00306 template <class Val, class A, class B>
00307 class GqBin : public LinBin<Val,A,B,PC_INT_BND> {
00308 protected:
00309 using LinBin<Val,A,B,PC_INT_BND>::x0;
00310 using LinBin<Val,A,B,PC_INT_BND>::x1;
00311 using LinBin<Val,A,B,PC_INT_BND>::c;
00312
00314 GqBin(Space* home, bool share, GqBin& p);
00316 GqBin(Space* home, A x0, B x1, Val c);
00317 public:
00319 GqBin(Space* home, bool share, Propagator& p, A x0, B x1, Val c);
00321 virtual Actor* copy(Space* home, bool share);
00323 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00325 virtual Reflection::ActorSpec spec(const Space* home,
00326 Reflection::VarMap& m) const;
00328 static void post(Space* home, Reflection::VarMap& vars,
00329 const Reflection::ActorSpec& spec);
00331 static Support::Symbol ati(void);
00333 static ExecStatus post(Space* home, A x0, B x1, Val c);
00334 };
00335
00348 template <class Val, class A, class B>
00349 class ReLqBin : public ReLinBin<Val,A,B,PC_INT_BND,BoolView> {
00350 protected:
00351 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::x0;
00352 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::x1;
00353 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::c;
00354 using ReLinBin<Val,A,B,PC_INT_BND,BoolView>::b;
00355
00357 ReLqBin(Space* home, bool share, ReLqBin& p);
00359 ReLqBin(Space* home, A x0, B x1, Val c, BoolView b);
00360 public:
00362 virtual Actor* copy(Space* home, bool share);
00364 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00366 virtual Reflection::ActorSpec spec(const Space* home,
00367 Reflection::VarMap& m) const;
00369 static void post(Space* home, Reflection::VarMap& vars,
00370 const Reflection::ActorSpec& spec);
00372 static Support::Symbol ati(void);
00374 static ExecStatus post(Space* home, A x0, B x1, Val c, BoolView b);
00375 };
00376
00377 }}}
00378
00379 #include "gecode/int/linear/int-bin.icc"
00380
00381 namespace Gecode { namespace Int { namespace Linear {
00382
00383
00384
00385
00386
00387
00397 template <class Val, class A, class B, class C, PropCond pc>
00398 class LinTer : public Propagator {
00399 protected:
00401 A x0;
00403 B x1;
00405 C x2;
00407 Val c;
00409 LinTer(Space* home, bool share, LinTer& p);
00411 LinTer(Space* home, A x0, B x1, C x2, Val c);
00413 LinTer(Space* home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00415 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00416 const Support::Symbol& name) const;
00417 public:
00419 virtual PropCost cost(ModEventDelta med) const;
00421 virtual size_t dispose(Space* home);
00422 };
00423
00436 template <class Val, class A, class B, class C>
00437 class EqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
00438 protected:
00439 using LinTer<Val,A,B,C,PC_INT_BND>::x0;
00440 using LinTer<Val,A,B,C,PC_INT_BND>::x1;
00441 using LinTer<Val,A,B,C,PC_INT_BND>::x2;
00442 using LinTer<Val,A,B,C,PC_INT_BND>::c;
00443
00445 EqTer(Space* home, bool share, EqTer& p);
00447 EqTer(Space* home, A x0, B x1, C x2, Val c);
00448 public:
00450 EqTer(Space* home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00452 virtual Actor* copy(Space* home, bool share);
00454 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00456 virtual Reflection::ActorSpec spec(const Space* home,
00457 Reflection::VarMap& m) const;
00459 static void post(Space* home, Reflection::VarMap& vars,
00460 const Reflection::ActorSpec& spec);
00462 static Support::Symbol ati(void);
00464 static ExecStatus post(Space* home, A x0, B x1, C x2, Val c);
00465 };
00466
00479 template <class Val, class A, class B, class C>
00480 class NqTer : public LinTer<Val,A,B,C,PC_INT_VAL> {
00481 protected:
00482 using LinTer<Val,A,B,C,PC_INT_VAL>::x0;
00483 using LinTer<Val,A,B,C,PC_INT_VAL>::x1;
00484 using LinTer<Val,A,B,C,PC_INT_VAL>::x2;
00485 using LinTer<Val,A,B,C,PC_INT_VAL>::c;
00486
00488 NqTer(Space* home, bool share, NqTer& p);
00490 NqTer(Space* home, A x0, B x1, C x2, Val c);
00491 public:
00493 NqTer(Space* home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00495 virtual Actor* copy(Space* home, bool share);
00497 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00499 virtual Reflection::ActorSpec spec(const Space* home,
00500 Reflection::VarMap& m) const;
00502 static void post(Space* home, Reflection::VarMap& vars,
00503 const Reflection::ActorSpec& spec);
00505 static Support::Symbol ati(void);
00507 static ExecStatus post(Space* home, A x0, B x1, C x2, Val c);
00508 };
00509
00522 template <class Val, class A, class B, class C>
00523 class LqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
00524 protected:
00525 using LinTer<Val,A,B,C,PC_INT_BND>::x0;
00526 using LinTer<Val,A,B,C,PC_INT_BND>::x1;
00527 using LinTer<Val,A,B,C,PC_INT_BND>::x2;
00528 using LinTer<Val,A,B,C,PC_INT_BND>::c;
00529
00531 LqTer(Space* home, bool share, LqTer& p);
00533 LqTer(Space* home, A x0, B x1, C x2, Val c);
00534 public:
00536 LqTer(Space* home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
00538 virtual Actor* copy(Space* home, bool share);
00540 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00542 virtual Reflection::ActorSpec spec(const Space* home,
00543 Reflection::VarMap& m) const;
00545 static void post(Space* home, Reflection::VarMap& vars,
00546 const Reflection::ActorSpec& spec);
00548 static Support::Symbol ati(void);
00550 static ExecStatus post(Space* home, A x0, B x1, C x2, Val c);
00551 };
00552
00553 }}}
00554
00555 #include "gecode/int/linear/int-ter.icc"
00556
00557 namespace Gecode { namespace Int { namespace Linear {
00558
00559
00560
00561
00562
00563
00573 template <class Val, class P, class N, PropCond pc>
00574 class Lin : public Propagator {
00575 protected:
00577 ViewArray<P> x;
00579 ViewArray<N> y;
00581 Val c;
00582
00584 Lin(Space* home, bool share, Lin& p);
00586 Lin(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00588 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00589 const Support::Symbol& name) const;
00590 public:
00592 virtual PropCost cost(ModEventDelta med) const;
00594 virtual size_t dispose(Space* home);
00595 };
00596
00606 template <class Val, class P, class N, PropCond pc, class Ctrl>
00607 class ReLin : public Lin<Val,P,N,pc> {
00608 protected:
00610 Ctrl b;
00612 ReLin(Space* home, bool share, ReLin& p);
00614 ReLin(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00616 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00617 const Support::Symbol& name) const;
00618 public:
00620 virtual size_t dispose(Space* home);
00621 };
00622
00628 template <class Val, class View>
00629 void bounds_p(ModEventDelta med, ViewArray<View>& x,
00630 Val& c, Val& sl, Val& su);
00631
00637 template <class Val, class View>
00638 void bounds_n(ModEventDelta med, ViewArray<View>& y,
00639 Val& c, Val& sl, Val& su);
00640
00653 template <class Val, class P, class N>
00654 class Eq : public Lin<Val,P,N,PC_INT_BND> {
00655 protected:
00656 using Lin<Val,P,N,PC_INT_BND>::x;
00657 using Lin<Val,P,N,PC_INT_BND>::y;
00658 using Lin<Val,P,N,PC_INT_BND>::c;
00659
00661 Eq(Space* home, bool share, Eq& p);
00662 public:
00664 Eq(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00666 virtual Actor* copy(Space* home, bool share);
00668 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00670 virtual Reflection::ActorSpec spec(const Space* home,
00671 Reflection::VarMap& m) const;
00673 static void post(Space* home, Reflection::VarMap& vars,
00674 const Reflection::ActorSpec& spec);
00676 static Support::Symbol ati(void);
00678 static ExecStatus
00679 post(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00680 };
00681
00692 template <class Val, class View>
00693 class DomEq
00694 : public Lin<Val,View,View,PC_INT_DOM> {
00695 protected:
00696 using Lin<Val,View,View,PC_INT_DOM>::x;
00697 using Lin<Val,View,View,PC_INT_DOM>::y;
00698 using Lin<Val,View,View,PC_INT_DOM>::c;
00699
00701 DomEq(Space* home, bool share, DomEq& p);
00702 public:
00704 DomEq(Space* home, ViewArray<View>& x, ViewArray<View>& y, Val c);
00706 virtual Actor* copy(Space* home, bool share);
00708 virtual PropCost cost(ModEventDelta med) const;
00710 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00712 virtual Reflection::ActorSpec spec(const Space* home,
00713 Reflection::VarMap& m) const;
00715 static void post(Space* home, Reflection::VarMap& vars,
00716 const Reflection::ActorSpec& spec);
00718 static Support::Symbol ati(void);
00720 static ExecStatus
00721 post(Space* home, ViewArray<View>& x, ViewArray<View>& y, Val c);
00722 };
00723
00736 template <class Val, class P, class N, class Ctrl>
00737 class ReEq : public ReLin<Val,P,N,PC_INT_BND,Ctrl> {
00738 protected:
00739 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::x;
00740 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::y;
00741 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::c;
00742 using ReLin<Val,P,N,PC_INT_BND,Ctrl>::b;
00743
00745 ReEq(Space* home, bool share, ReEq& p);
00746 public:
00748 ReEq(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00750 virtual Actor* copy(Space* home, bool share);
00752 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00754 virtual Reflection::ActorSpec spec(const Space* home,
00755 Reflection::VarMap& m) const;
00757 static void post(Space* home, Reflection::VarMap& vars,
00758 const Reflection::ActorSpec& spec);
00760 static Support::Symbol ati(void);
00762 static ExecStatus
00763 post(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
00764 };
00765
00778 template <class Val, class P, class N>
00779 class Nq : public Lin<Val,P,N,PC_INT_VAL> {
00780 protected:
00781 using Lin<Val,P,N,PC_INT_VAL>::x;
00782 using Lin<Val,P,N,PC_INT_VAL>::y;
00783 using Lin<Val,P,N,PC_INT_VAL>::c;
00784
00786 Nq(Space* home, bool share, Nq& p);
00787 public:
00789 Nq(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00791 virtual Actor* copy(Space* home, bool share);
00793 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00795 virtual Reflection::ActorSpec spec(const Space* home,
00796 Reflection::VarMap& m) const;
00798 static void post(Space* home, Reflection::VarMap& vars,
00799 const Reflection::ActorSpec& spec);
00801 static Support::Symbol ati(void);
00803 static ExecStatus
00804 post(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00805 };
00806
00819 template <class Val, class P, class N>
00820 class Lq : public Lin<Val,P,N,PC_INT_BND> {
00821 protected:
00822 using Lin<Val,P,N,PC_INT_BND>::x;
00823 using Lin<Val,P,N,PC_INT_BND>::y;
00824 using Lin<Val,P,N,PC_INT_BND>::c;
00825
00827 Lq(Space* home, bool share, Lq& p);
00828 public:
00830 Lq(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00832 virtual Actor* copy(Space* home, bool share);
00834 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00836 virtual Reflection::ActorSpec spec(const Space* home,
00837 Reflection::VarMap& m) const;
00839 static void post(Space* home, Reflection::VarMap& vars,
00840 const Reflection::ActorSpec& spec);
00842 static Support::Symbol ati(void);
00844 static ExecStatus
00845 post(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c);
00846 };
00847
00860 template <class Val, class P, class N>
00861 class ReLq : public ReLin<Val,P,N,PC_INT_BND,BoolView> {
00862 protected:
00863 using ReLin<Val,P,N,PC_INT_BND,BoolView>::x;
00864 using ReLin<Val,P,N,PC_INT_BND,BoolView>::y;
00865 using ReLin<Val,P,N,PC_INT_BND,BoolView>::c;
00866 using ReLin<Val,P,N,PC_INT_BND,BoolView>::b;
00867
00869 ReLq(Space* home, bool share, ReLq& p);
00870 public:
00872 ReLq(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
00874 virtual Actor* copy(Space* home, bool share);
00876 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00878 virtual Reflection::ActorSpec spec(const Space* home,
00879 Reflection::VarMap& m) const;
00881 static void post(Space* home, Reflection::VarMap& vars,
00882 const Reflection::ActorSpec& spec);
00884 static Support::Symbol ati(void);
00886 static ExecStatus
00887 post(Space* home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
00888 };
00889
00890 }}}
00891
00892 #include "gecode/int/linear/int-nary.icc"
00893 #include "gecode/int/linear/int-dom.icc"
00894
00895 namespace Gecode { namespace Int { namespace Linear {
00896
00897
00898
00899
00900
00901
00906 template <class VX>
00907 class MemoryLinBoolInt : public Propagator {
00908 protected:
00910 ViewArray<VX> x;
00912 int n_s;
00914 int c;
00916 MemoryLinBoolInt(Space* home, bool share, MemoryLinBoolInt& p);
00918 MemoryLinBoolInt(Space* home, ViewArray<VX>& x, int n_s, int c);
00920 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00921 const Support::Symbol& name) const;
00922 public:
00924 virtual PropCost cost(ModEventDelta med) const;
00926 virtual size_t dispose(Space* home);
00927 };
00928
00933 template <class VX>
00934 class SpeedLinBoolInt : public Propagator {
00935 protected:
00937 ViewArray<VX> x;
00939 int n_s;
00941 int c;
00943 Council<ViewAdvisor<VX> > co;
00945 SpeedLinBoolInt(Space* home, bool share, SpeedLinBoolInt& p);
00947 SpeedLinBoolInt(Space* home, ViewArray<VX>& x, int n_s, int c);
00949 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00950 const Support::Symbol& name) const;
00951 public:
00953 virtual PropCost cost(ModEventDelta med) const;
00955 virtual size_t dispose(Space* home);
00956 };
00957
00964 template <class VX>
00965 class EqBoolInt {
00966 public:
00968 static const int threshold = 32;
00970 class Memory : public MemoryLinBoolInt<VX> {
00971 protected:
00972 using MemoryLinBoolInt<VX>::x;
00973 using MemoryLinBoolInt<VX>::n_s;
00974 using MemoryLinBoolInt<VX>::c;
00975 public:
00977 Memory(Space* home, bool share, Memory& p);
00979 Memory(Space* home, ViewArray<VX>& x, int c);
00981 virtual Actor* copy(Space* home, bool share);
00983 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00985 virtual Reflection::ActorSpec spec(const Space* home,
00986 Reflection::VarMap& m) const;
00988 static void post(Space* home, Reflection::VarMap& vars,
00989 const Reflection::ActorSpec& spec);
00991 static Support::Symbol ati(void);
00992 };
00994 class Speed : public SpeedLinBoolInt<VX> {
00995 protected:
00996 using SpeedLinBoolInt<VX>::x;
00997 using SpeedLinBoolInt<VX>::n_s;
00998 using SpeedLinBoolInt<VX>::c;
00999 using SpeedLinBoolInt<VX>::co;
01000 public:
01002 Speed(Space* home, bool share, Speed& p);
01004 Speed(Space* home, ViewArray<VX>& x, int c);
01006 virtual Actor* copy(Space* home, bool share);
01008 virtual ExecStatus advise(Space* home, Advisor* a, const Delta* d);
01010 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01012 virtual Reflection::ActorSpec spec(const Space* home,
01013 Reflection::VarMap& m) const;
01015 static void post(Space* home, Reflection::VarMap& vars,
01016 const Reflection::ActorSpec& spec);
01018 static Support::Symbol ati(void);
01019 };
01020
01022 static ExecStatus post(Space* home, ViewArray<VX>& x, int c,
01023 PropKind pk=PK_DEF);
01024 };
01025
01032 template <class VX>
01033 class GqBoolInt {
01034 public:
01036 static const int threshold = 32;
01038 class Memory : public MemoryLinBoolInt<VX> {
01039 protected:
01040 using MemoryLinBoolInt<VX>::x;
01041 using MemoryLinBoolInt<VX>::n_s;
01042 using MemoryLinBoolInt<VX>::c;
01043 public:
01045 Memory(Space* home, bool share, Memory& p);
01047 Memory(Space* home, ViewArray<VX>& x, int c);
01049 virtual Actor* copy(Space* home, bool share);
01051 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01053 virtual Reflection::ActorSpec spec(const Space* home,
01054 Reflection::VarMap& m) const;
01056 static void post(Space* home, Reflection::VarMap& vars,
01057 const Reflection::ActorSpec& spec);
01059 static Support::Symbol ati(void);
01060 };
01062 class Speed : public SpeedLinBoolInt<VX> {
01063 protected:
01064 using SpeedLinBoolInt<VX>::x;
01065 using SpeedLinBoolInt<VX>::n_s;
01066 using SpeedLinBoolInt<VX>::c;
01067 using SpeedLinBoolInt<VX>::co;
01068 public:
01070 Speed(Space* home, bool share, Speed& p);
01072 Speed(Space* home, ViewArray<VX>& x, int c);
01074 virtual Actor* copy(Space* home, bool share);
01076 virtual ExecStatus advise(Space* home, Advisor* a, const Delta* d);
01078 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01080 virtual Reflection::ActorSpec spec(const Space* home,
01081 Reflection::VarMap& m) const;
01083 static void post(Space* home, Reflection::VarMap& vars,
01084 const Reflection::ActorSpec& spec);
01086 static Support::Symbol ati(void);
01087 };
01088 public:
01090 static ExecStatus post(Space* home, ViewArray<VX>& x, int c,
01091 PropKind pk=PK_DEF);
01092 };
01093
01100 template<class VX>
01101 class NqBoolInt : public BinaryPropagator<VX,PC_INT_VAL> {
01102 protected:
01103 using BinaryPropagator<VX,PC_INT_VAL>::x0;
01104 using BinaryPropagator<VX,PC_INT_VAL>::x1;
01106 ViewArray<VX> x;
01108 int c;
01110 bool resubscribe(Space* home, VX& y);
01112 NqBoolInt(Space* home, ViewArray<VX>& b, int c);
01114 NqBoolInt(Space* home, bool share, NqBoolInt<VX>& p);
01115 public:
01117 virtual Actor* copy(Space* home, bool share);
01119 virtual PropCost cost(ModEventDelta med) const;
01121 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01123 virtual Reflection::ActorSpec spec(const Space* home,
01124 Reflection::VarMap& m) const;
01126 static void post(Space* home, Reflection::VarMap& vars,
01127 const Reflection::ActorSpec& spec);
01129 static Support::Symbol ati(void);
01131 static ExecStatus post(Space* home, ViewArray<VX>& b, int c);
01132 };
01133
01134 }}}
01135
01136 #include "gecode/int/linear/bool-int.icc"
01137
01138 namespace Gecode { namespace Int { namespace Linear {
01139
01144 template <class XV, class YV>
01145 class LinBoolView : public Propagator {
01146 protected:
01148 ViewArray<XV> x;
01150 YV y;
01152 int c;
01154 LinBoolView(Space* home, bool share, LinBoolView& p);
01156 LinBoolView(Space* home, ViewArray<XV>& x, YV y, int c);
01158 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
01159 const Support::Symbol& name) const;
01160 public:
01162 virtual PropCost cost(ModEventDelta med) const;
01164 virtual size_t dispose(Space* home);
01165 };
01166
01167
01172 template <class XV, class YV, class BV>
01173 class ReLinBoolView : public LinBoolView<XV,YV> {
01174 protected:
01175 using LinBoolView<XV,YV>::x;
01176 using LinBoolView<XV,YV>::y;
01177 using LinBoolView<XV,YV>::c;
01179 BV b;
01181 ReLinBoolView(Space* home, bool share, ReLinBoolView& p);
01183 ReLinBoolView(Space* home, ViewArray<XV>& x, YV y, int c, BV b);
01185 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
01186 const Support::Symbol& name) const;
01187 public:
01189 virtual size_t dispose(Space* home);
01190 };
01191
01192
01199 template <class XV, class YV>
01200 class EqBoolView : public LinBoolView<XV,YV> {
01201 protected:
01202 using LinBoolView<XV,YV>::x;
01203 using LinBoolView<XV,YV>::y;
01204 using LinBoolView<XV,YV>::c;
01205
01207 EqBoolView(Space* home, bool share, EqBoolView& p);
01209 EqBoolView(Space* home, ViewArray<XV>& x, YV y, int c);
01210 public:
01212 virtual Actor* copy(Space* home, bool share);
01214 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01216 virtual Reflection::ActorSpec spec(const Space* home,
01217 Reflection::VarMap& m) const;
01219 static void post(Space* home, Reflection::VarMap& vars,
01220 const Reflection::ActorSpec& spec);
01222 static Support::Symbol ati(void);
01224 static ExecStatus post(Space* home, ViewArray<XV>& x, YV y, int c);
01225 };
01226
01233 template <class XV, class YV>
01234 class NqBoolView : public LinBoolView<XV,YV> {
01235 protected:
01236 using LinBoolView<XV,YV>::x;
01237 using LinBoolView<XV,YV>::y;
01238 using LinBoolView<XV,YV>::c;
01239
01241 NqBoolView(Space* home, bool share, NqBoolView& p);
01243 NqBoolView(Space* home, ViewArray<XV>& x, YV y, int c);
01244 public:
01246 virtual Actor* copy(Space* home, bool share);
01248 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01250 virtual Reflection::ActorSpec spec(const Space* home,
01251 Reflection::VarMap& m) const;
01253 static void post(Space* home, Reflection::VarMap& vars,
01254 const Reflection::ActorSpec& spec);
01256 static Support::Symbol ati(void);
01258 static ExecStatus post(Space* home, ViewArray<XV>& x, YV y, int c);
01259 };
01260
01267 template <class XV, class YV>
01268 class GqBoolView : public LinBoolView<XV,YV> {
01269 protected:
01270 using LinBoolView<XV,YV>::x;
01271 using LinBoolView<XV,YV>::y;
01272 using LinBoolView<XV,YV>::c;
01273
01275 GqBoolView(Space* home, bool share, GqBoolView& p);
01277 GqBoolView(Space* home, ViewArray<XV>& x, YV y, int c);
01278 public:
01280 virtual Actor* copy(Space* home, bool share);
01282 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01284 virtual Reflection::ActorSpec spec(const Space* home,
01285 Reflection::VarMap& m) const;
01287 static void post(Space* home, Reflection::VarMap& vars,
01288 const Reflection::ActorSpec& spec);
01290 static Support::Symbol ati(void);
01292 static ExecStatus post(Space* home, ViewArray<XV>& x, YV y, int c);
01293 };
01294
01301 template <class XV, class YV, class BV>
01302 class ReEqBoolView : public ReLinBoolView<XV,YV,BV> {
01303 protected:
01304 using ReLinBoolView<XV,YV,BV>::x;
01305 using ReLinBoolView<XV,YV,BV>::y;
01306 using ReLinBoolView<XV,YV,BV>::c;
01307 using ReLinBoolView<XV,YV,BV>::b;
01308
01310 ReEqBoolView(Space* home, bool share, ReEqBoolView& p);
01312 ReEqBoolView(Space* home, ViewArray<XV>& x, YV y, int c, BV b);
01313 public:
01315 virtual Actor* copy(Space* home, bool share);
01317 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01319 virtual Reflection::ActorSpec spec(const Space* home,
01320 Reflection::VarMap& m) const;
01322 static void post(Space* home, Reflection::VarMap& vars,
01323 const Reflection::ActorSpec& spec);
01325 static Support::Symbol ati(void);
01327 static ExecStatus post(Space* home, ViewArray<XV>& x, YV y, int c, BV b);
01328 };
01329
01336 template <class XV, class YV, class BV>
01337 class ReGqBoolView : public ReLinBoolView<XV,YV,BV> {
01338 protected:
01339 using ReLinBoolView<XV,YV,BV>::x;
01340 using ReLinBoolView<XV,YV,BV>::y;
01341 using ReLinBoolView<XV,YV,BV>::c;
01342 using ReLinBoolView<XV,YV,BV>::b;
01343
01345 ReGqBoolView(Space* home, bool share, ReGqBoolView& p);
01347 ReGqBoolView(Space* home, ViewArray<XV>& x, YV y, int c, BV b);
01348 public:
01350 virtual Actor* copy(Space* home, bool share);
01352 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01354 virtual Reflection::ActorSpec spec(const Space* home,
01355 Reflection::VarMap& m) const;
01357 static void post(Space* home, Reflection::VarMap& vars,
01358 const Reflection::ActorSpec& spec);
01360 static Support::Symbol ati(void);
01362 static ExecStatus post(Space* home, ViewArray<XV>& x, YV y, int c, BV b);
01363 };
01364
01365 }}}
01366
01367 #include "gecode/int/linear/bool-view.icc"
01368
01369 namespace Gecode { namespace Int { namespace Linear {
01370
01372 class ScaleBool {
01373 public:
01375 int a;
01377 BoolView x;
01378 };
01379
01381 class ScaleBoolArray {
01382 private:
01384 ScaleBool* _fst;
01386 ScaleBool* _lst;
01387 public:
01389 ScaleBoolArray(void);
01391 ScaleBoolArray(Space* home, int n);
01393 void subscribe(Space* home, Propagator* p);
01395 void cancel(Space* home, Propagator* p);
01397 void update(Space* home, bool share, ScaleBoolArray& sba);
01399 ScaleBool* fst(void) const;
01401 ScaleBool* lst(void) const;
01403 void fst(ScaleBool* f);
01405 void lst(ScaleBool* l);
01407 bool empty(void) const;
01409 int size(void) const;
01411 static Support::Symbol type(void);
01413 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
01414 private:
01416 class ScaleDec {
01417 public:
01418 bool
01419 operator()(const ScaleBool& x, const ScaleBool& y);
01420 };
01421 public:
01423 void sort(void);
01424 };
01425
01426
01428 class EmptyScaleBoolArray {
01429 public:
01431 EmptyScaleBoolArray(void);
01433 EmptyScaleBoolArray(Space* home, int n);
01435 void subscribe(Space* home, Propagator* p);
01437 void cancel(Space* home, Propagator* p);
01439 void update(Space* home, bool share, EmptyScaleBoolArray& esba);
01441 ScaleBool* fst(void) const;
01443 ScaleBool* lst(void) const;
01445 void fst(ScaleBool* f);
01447 void lst(ScaleBool* l);
01449 bool empty(void) const;
01451 int size(void) const;
01453 void sort(void);
01455 static Support::Symbol type(void);
01456 };
01457
01458
01463 template <class SBAP, class SBAN, class VX, PropCond pcx>
01464 class LinBoolScale : public Propagator {
01465 protected:
01467 SBAP p;
01469 SBAN n;
01471 VX x;
01473 int c;
01475 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
01476 const Support::Symbol& name) const;
01477 public:
01479 LinBoolScale(Space* home, SBAP& p, SBAN& n, VX x, int c);
01481 LinBoolScale(Space* home, bool share, Propagator& pr,
01482 SBAP& p, SBAN& n, VX x, int c);
01484 virtual PropCost cost(ModEventDelta med) const;
01486 virtual size_t dispose(Space* home);
01487 };
01488
01495 template <class SBAP, class SBAN, class VX>
01496 class EqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
01497 protected:
01498 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::p;
01499 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::n;
01500 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::x;
01501 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::c;
01502 public:
01504 EqBoolScale(Space* home, SBAP& p, SBAN& n, VX x, int c);
01506 EqBoolScale(Space* home, bool share, Propagator& pr,
01507 SBAP& p, SBAN& n, VX x, int c);
01509 virtual Actor* copy(Space* home, bool share);
01511 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01513 virtual Reflection::ActorSpec spec(const Space* home,
01514 Reflection::VarMap& m) const;
01516 static void post(Space* home, Reflection::VarMap& vars,
01517 const Reflection::ActorSpec& spec);
01519 static Support::Symbol ati(void);
01521 static ExecStatus post(Space* home, SBAP& p, SBAN& n, VX x, int c);
01522 };
01523
01530 template <class SBAP, class SBAN, class VX>
01531 class LqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
01532 protected:
01533 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::p;
01534 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::n;
01535 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::x;
01536 using LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>::c;
01537 public:
01539 LqBoolScale(Space* home, SBAP& p, SBAN& n, VX x, int c);
01541 LqBoolScale(Space* home, bool share, Propagator& pr,
01542 SBAP& p, SBAN& n, VX x, int c);
01544 virtual Actor* copy(Space* home, bool share);
01546 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01548 virtual Reflection::ActorSpec spec(const Space* home,
01549 Reflection::VarMap& m) const;
01551 static void post(Space* home, Reflection::VarMap& vars,
01552 const Reflection::ActorSpec& spec);
01554 static Support::Symbol ati(void);
01556 static ExecStatus post(Space* home, SBAP& p, SBAN& n, VX x, int c);
01557 };
01558
01565 template <class SBAP, class SBAN, class VX>
01566 class NqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL> {
01567 protected:
01568 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::p;
01569 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::n;
01570 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::x;
01571 using LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>::c;
01572 public:
01574 NqBoolScale(Space* home, SBAP& p, SBAN& n, VX x, int c);
01576 NqBoolScale(Space* home, bool share, Propagator& pr,
01577 SBAP& p, SBAN& n, VX x, int c);
01579 virtual Actor* copy(Space* home, bool share);
01581 virtual ExecStatus propagate(Space* home, ModEventDelta med);
01583 virtual Reflection::ActorSpec spec(const Space* home,
01584 Reflection::VarMap& m) const;
01586 static void post(Space* home, Reflection::VarMap& vars,
01587 const Reflection::ActorSpec& spec);
01589 static Support::Symbol ati(void);
01591 static ExecStatus post(Space* home, SBAP& p, SBAN& n, VX x, int c);
01592 };
01593
01594 }}}
01595
01596 #include "gecode/int/linear/bool-scale.icc"
01597
01598 namespace Gecode { namespace Int { namespace Linear {
01599
01604 template<class View>
01605 class Term {
01606 public:
01608 int a;
01610 View x;
01611 };
01612
01627 template<class View>
01628 void estimate(Term<View>* t, int n, int c,
01629 int& l, int& u);
01630
01652 template<class View>
01653 bool normalize(Term<View>* t, int &n,
01654 Term<View>* &t_p, int &n_p,
01655 Term<View>* &t_n, int &n_n);
01656
01657
01684 GECODE_INT_EXPORT void
01685 post(Space* home, Term<IntView>* t, int n, IntRelType r, int c,
01686 IntConLevel=ICL_DEF, PropKind pk=PK_DEF);
01687
01716 GECODE_INT_EXPORT void
01717 post(Space* home, Term<IntView>* t, int n, IntRelType r, int c, BoolView b,
01718 IntConLevel=ICL_DEF, PropKind pk=PK_DEF);
01719
01746 GECODE_INT_EXPORT void
01747 post(Space* home, Term<BoolView>* t, int n, IntRelType r, int c,
01748 IntConLevel=ICL_DEF, PropKind=PK_DEF);
01749
01777 GECODE_INT_EXPORT void
01778 post(Space* home, Term<BoolView>* t, int n, IntRelType r, int c, BoolView b,
01779 IntConLevel=ICL_DEF, PropKind=PK_DEF);
01780
01808 GECODE_INT_EXPORT void
01809 post(Space* home, Term<BoolView>* t, int n, IntRelType r, IntView y, int c=0,
01810 IntConLevel=ICL_DEF, PropKind=PK_DEF);
01811
01839 GECODE_INT_EXPORT void
01840 post(Space* home, Term<BoolView>* t, int n, IntRelType r, IntView y,
01841 BoolView b, IntConLevel=ICL_DEF, PropKind=PK_DEF);
01842
01843 }}}
01844
01845 #include "gecode/int/linear/post.icc"
01846
01847 #endif
01848
01849