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 { namespace Int {
00039
00057 template<class View, PropCond pc, class CtrlView>
00058 class ReUnaryPropagator : public Propagator {
00059 protected:
00061 View x0;
00063 CtrlView b;
00065 ReUnaryPropagator(Space& home, bool share, ReUnaryPropagator& p);
00067 ReUnaryPropagator(Space& home, bool share, Propagator& p,
00068 View x0, CtrlView b);
00070 ReUnaryPropagator(Space& home, View x0, CtrlView b);
00071 public:
00073 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00075 virtual size_t dispose(Space& home);
00076 };
00077
00088 template<class View, PropCond pc, class CtrlView>
00089 class ReBinaryPropagator : public Propagator {
00090 protected:
00092 View x0, x1;
00094 CtrlView b;
00096 ReBinaryPropagator(Space& home, bool share, ReBinaryPropagator& p);
00098 ReBinaryPropagator(Space& home, bool share, Propagator& p,
00099 View x0, View x1, CtrlView b);
00101 ReBinaryPropagator(Space& home, View x0, View x1, CtrlView b);
00102 public:
00104 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00106 virtual size_t dispose(Space& home);
00107 };
00109
00110
00122 template<class View0, PropCond pc0, class View1, PropCond pc1,
00123 class CtrlView>
00124 class ReMixBinaryPropagator : public Propagator {
00125 protected:
00127 View0 x0;
00129 View1 x1;
00131 CtrlView b;
00133 ReMixBinaryPropagator(Space& home, bool share, ReMixBinaryPropagator& p);
00135 ReMixBinaryPropagator(Space& home, View0 x0, View1 x1, CtrlView b);
00137 ReMixBinaryPropagator(Space& home, bool share, Propagator& p,
00138 View0 x0, View1 x1, CtrlView b);
00139 public:
00141 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00143 virtual size_t dispose(Space& home);
00144 };
00145
00146
00147
00148
00149
00150
00151 template<class View, PropCond pc, class CtrlView>
00152 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00153 (Space& home, View y0, CtrlView b0)
00154 : Propagator(home), x0(y0), b(b0) {
00155 if (pc != PC_GEN_NONE)
00156 x0.subscribe(home,*this,pc);
00157 b.subscribe(home,*this,Int::PC_INT_VAL);
00158 }
00159
00160 template<class View, PropCond pc, class CtrlView>
00161 forceinline
00162 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00163 (Space& home, bool share, ReUnaryPropagator<View,pc,CtrlView>& p)
00164 : Propagator(home,share,p) {
00165 x0.update(home,share,p.x0);
00166 b.update(home,share,p.b);
00167 }
00168
00169 template<class View, PropCond pc, class CtrlView>
00170 forceinline
00171 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00172 (Space& home, bool share, Propagator& p, View y0, CtrlView b0)
00173 : Propagator(home,share,p) {
00174 x0.update(home,share,y0);
00175 b.update(home,share,b0);
00176 }
00177
00178 template<class View, PropCond pc, class CtrlView>
00179 PropCost
00180 ReUnaryPropagator<View,pc,CtrlView>::cost(const Space&, const ModEventDelta&) const {
00181 return PropCost::unary(PropCost::LO);
00182 }
00183
00184 template<class View, PropCond pc, class CtrlView>
00185 forceinline size_t
00186 ReUnaryPropagator<View,pc,CtrlView>::dispose(Space& home) {
00187 if (pc != PC_GEN_NONE)
00188 x0.cancel(home,*this,pc);
00189 b.cancel(home,*this,Int::PC_INT_VAL);
00190 (void) Propagator::dispose(home);
00191 return sizeof(*this);
00192 }
00193
00194
00195
00196
00197
00198 template<class View, PropCond pc, class CtrlView>
00199 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00200 (Space& home, View y0, View y1, CtrlView b1)
00201 : Propagator(home), x0(y0), x1(y1), b(b1) {
00202 if (pc != PC_GEN_NONE) {
00203 x0.subscribe(home,*this,pc);
00204 x1.subscribe(home,*this,pc);
00205 }
00206 b.subscribe(home,*this,Int::PC_INT_VAL);
00207 }
00208
00209 template<class View, PropCond pc, class CtrlView>
00210 forceinline
00211 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00212 (Space& home, bool share, ReBinaryPropagator<View,pc,CtrlView>& p)
00213 : Propagator(home,share,p) {
00214 x0.update(home,share,p.x0);
00215 x1.update(home,share,p.x1);
00216 b.update(home,share,p.b);
00217 }
00218
00219 template<class View, PropCond pc, class CtrlView>
00220 forceinline
00221 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00222 (Space& home, bool share, Propagator& p, View y0, View y1, CtrlView b0)
00223 : Propagator(home,share,p) {
00224 x0.update(home,share,y0);
00225 x1.update(home,share,y1);
00226 b.update(home,share,b0);
00227 }
00228
00229 template<class View, PropCond pc, class CtrlView>
00230 PropCost
00231 ReBinaryPropagator<View,pc,CtrlView>::cost(const Space&, const ModEventDelta&) const {
00232 return PropCost::binary(PropCost::LO);
00233 }
00234
00235 template<class View, PropCond pc, class CtrlView>
00236 forceinline size_t
00237 ReBinaryPropagator<View,pc,CtrlView>::dispose(Space& home) {
00238 if (pc != PC_GEN_NONE) {
00239 x0.cancel(home,*this,pc);
00240 x1.cancel(home,*this,pc);
00241 }
00242 b.cancel(home,*this,Int::PC_INT_VAL);
00243 (void) Propagator::dispose(home);
00244 return sizeof(*this);
00245 }
00246
00247
00248
00249
00250
00251 template<class View0, PropCond pc0, class View1, PropCond pc1,
00252 class CtrlView>
00253 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>
00254 ::ReMixBinaryPropagator(Space& home, View0 y0, View1 y1, CtrlView b1)
00255 : Propagator(home), x0(y0), x1(y1), b(b1) {
00256 if (pc0 != PC_GEN_NONE)
00257 x0.subscribe(home,*this,pc0);
00258 if (pc1 != PC_GEN_NONE)
00259 x1.subscribe(home,*this,pc1);
00260 b.subscribe(home,*this,Int::PC_INT_VAL);
00261 }
00262
00263 template<class View0, PropCond pc0, class View1, PropCond pc1,
00264 class CtrlView>
00265 forceinline
00266 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>::ReMixBinaryPropagator
00267 (Space& home, bool share,
00268 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>& p)
00269 : Propagator(home,share,p) {
00270 x0.update(home,share,p.x0);
00271 x1.update(home,share,p.x1);
00272 b.update(home,share,p.b);
00273 }
00274
00275 template<class View0, PropCond pc0, class View1, PropCond pc1,
00276 class CtrlView>
00277 forceinline
00278 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>
00279 ::ReMixBinaryPropagator
00280 (Space& home, bool share, Propagator& p, View0 y0, View1 y1, CtrlView b0)
00281 : Propagator(home,share,p) {
00282 x0.update(home,share,y0);
00283 x1.update(home,share,y1);
00284 b.update(home,share,b0);
00285 }
00286
00287 template<class View0, PropCond pc0, class View1, PropCond pc1,
00288 class CtrlView>
00289 PropCost
00290 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>
00291 ::cost(const Space&, const ModEventDelta&) const {
00292 return PropCost::binary(PropCost::LO);
00293 }
00294
00295 template<class View0, PropCond pc0, class View1, PropCond pc1,
00296 class CtrlView>
00297 forceinline size_t
00298 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>::dispose(Space& home) {
00299 if (pc0 != PC_GEN_NONE)
00300 x0.cancel(home,*this,pc0);
00301 if (pc1 != PC_GEN_NONE)
00302 x1.cancel(home,*this,pc1);
00303 b.cancel(home,*this,Int::PC_INT_VAL);
00304 (void) Propagator::dispose(home);
00305 return sizeof(*this);
00306 }
00307
00308 }}
00309
00310
00311