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 namespace Gecode {
00039
00049
00050
00057 template<class View, PropCond pcs, PropCond pci>
00058 class IntSetPropagator : public Propagator {
00059 protected:
00060 View x0;
00061 Gecode::Int::IntView x1;
00063 IntSetPropagator(Space& home,bool,IntSetPropagator&);
00065 IntSetPropagator(Space& home,View,Gecode::Int::IntView);
00066 public:
00068 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00070 virtual size_t dispose(Space& home);
00071 };
00072
00079 template<class View, PropCond pcs, PropCond pci>
00080 class IntSetRePropagator : public Propagator {
00081 protected:
00082 View x0;
00083 Gecode::Int::IntView x1;
00084 Gecode::Int::BoolView b;
00086 IntSetRePropagator(Space& home,bool,IntSetRePropagator&);
00088 IntSetRePropagator(Space& home,View,Gecode::Int::IntView,
00089 Gecode::Int::BoolView);
00090 public:
00092 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00094 virtual size_t dispose(Space& home);
00095 };
00096
00098
00099 template<class View, PropCond pcs, PropCond pci>
00100 IntSetPropagator<View,pcs,pci>::IntSetPropagator
00101 (Space& home, View y0, Gecode::Int::IntView y1)
00102 : Propagator(home), x0(y0), x1(y1) {
00103 x0.subscribe(home,*this,pcs);
00104 x1.subscribe(home,*this,pci);
00105 }
00106
00107 template<class View, PropCond pcs, PropCond pci>
00108 forceinline
00109 IntSetPropagator<View,pcs,pci>::IntSetPropagator
00110 (Space& home, bool share, IntSetPropagator<View,pcs,pci>& p)
00111 : Propagator(home,share,p) {
00112 x0.update(home,share,p.x0);
00113 x1.update(home,share,p.x1);
00114 }
00115
00116 template<class View, PropCond pcs, PropCond pci>
00117 PropCost
00118 IntSetPropagator<View,pcs,pci>::cost(const Space&,
00119 const ModEventDelta&) const {
00120 return PropCost::binary(PropCost::LO);
00121 }
00122
00123 template<class View, PropCond pcs, PropCond pci>
00124 size_t
00125 IntSetPropagator<View,pcs,pci>::dispose(Space& home) {
00126 if (!home.failed()) {
00127 x0.cancel(home,*this,pcs);
00128 x1.cancel(home,*this,pci);
00129 }
00130 (void) Propagator::dispose(home);
00131 return sizeof(*this);
00132 }
00133
00134 template<class View, PropCond pcs, PropCond pci>
00135 IntSetRePropagator<View,pcs,pci>::IntSetRePropagator
00136 (Space& home, View y0, Gecode::Int::IntView y1, Gecode::Int::BoolView b2)
00137 : Propagator(home), x0(y0), x1(y1), b(b2) {
00138 x0.subscribe(home,*this,pcs);
00139 x1.subscribe(home,*this,pci);
00140 b.subscribe(home,*this,Gecode::Int::PC_INT_VAL);
00141 }
00142
00143 template<class View, PropCond pcs, PropCond pci>
00144 forceinline
00145 IntSetRePropagator<View,pcs,pci>::IntSetRePropagator
00146 (Space& home, bool share, IntSetRePropagator<View,pcs,pci>& p)
00147 : Propagator(home,share,p) {
00148 x0.update(home,share,p.x0);
00149 x1.update(home,share,p.x1);
00150 b.update(home,share,p.b);
00151 }
00152
00153 template<class View, PropCond pcs, PropCond pci>
00154 PropCost
00155 IntSetRePropagator<View,pcs,pci>
00156 ::cost(const Space&, const ModEventDelta&) const {
00157 return PropCost::ternary(PropCost::LO);
00158 }
00159
00160 template<class View, PropCond pcs, PropCond pci>
00161 size_t
00162 IntSetRePropagator<View,pcs,pci>::dispose(Space& home) {
00163 if (!home.failed()) {
00164 x0.cancel(home,*this,pcs);
00165 x1.cancel(home,*this,pci);
00166 b.cancel(home,*this,Gecode::Int::PC_INT_VAL);
00167 }
00168 (void) Propagator::dispose(home);
00169 return sizeof(*this);
00170 }
00171
00172 }
00173
00174
00175