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(Home home, View x0, CtrlView b);
00071 public:
00073 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00075 virtual void reschedule(Space& home);
00077 virtual size_t dispose(Space& home);
00078 };
00079
00090 template<class View, PropCond pc, class CtrlView>
00091 class ReBinaryPropagator : public Propagator {
00092 protected:
00094 View x0, x1;
00096 CtrlView b;
00098 ReBinaryPropagator(Space& home, bool share, ReBinaryPropagator& p);
00100 ReBinaryPropagator(Space& home, bool share, Propagator& p,
00101 View x0, View x1, CtrlView b);
00103 ReBinaryPropagator(Home home, View x0, View x1, CtrlView b);
00104 public:
00106 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00108 virtual void reschedule(Space& home);
00110 virtual size_t dispose(Space& home);
00111 };
00113
00114
00126 template<class View0, PropCond pc0, class View1, PropCond pc1,
00127 class CtrlView>
00128 class ReMixBinaryPropagator : public Propagator {
00129 protected:
00131 View0 x0;
00133 View1 x1;
00135 CtrlView b;
00137 ReMixBinaryPropagator(Space& home, bool share, ReMixBinaryPropagator& p);
00139 ReMixBinaryPropagator(Home home, View0 x0, View1 x1, CtrlView b);
00141 ReMixBinaryPropagator(Space& home, bool share, Propagator& p,
00142 View0 x0, View1 x1, CtrlView b);
00143 public:
00145 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00147 virtual void reschedule(Space& home);
00149 virtual size_t dispose(Space& home);
00150 };
00151
00152
00153
00154
00155
00156
00157 template<class View, PropCond pc, class CtrlView>
00158 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00159 (Home home, View y0, CtrlView b0)
00160 : Propagator(home), x0(y0), b(b0) {
00161 if (pc != PC_GEN_NONE)
00162 x0.subscribe(home,*this,pc);
00163 b.subscribe(home,*this,Int::PC_INT_VAL);
00164 }
00165
00166 template<class View, PropCond pc, class CtrlView>
00167 forceinline
00168 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00169 (Space& home, bool share, ReUnaryPropagator<View,pc,CtrlView>& p)
00170 : Propagator(home,share,p) {
00171 x0.update(home,share,p.x0);
00172 b.update(home,share,p.b);
00173 }
00174
00175 template<class View, PropCond pc, class CtrlView>
00176 forceinline
00177 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00178 (Space& home, bool share, Propagator& p, View y0, CtrlView b0)
00179 : Propagator(home,share,p) {
00180 x0.update(home,share,y0);
00181 b.update(home,share,b0);
00182 }
00183
00184 template<class View, PropCond pc, class CtrlView>
00185 PropCost
00186 ReUnaryPropagator<View,pc,CtrlView>::cost(const Space&, const ModEventDelta&) const {
00187 return PropCost::unary(PropCost::LO);
00188 }
00189
00190 template<class View, PropCond pc, class CtrlView>
00191 void
00192 ReUnaryPropagator<View,pc,CtrlView>::reschedule(Space& home) {
00193 if (pc != PC_GEN_NONE)
00194 x0.reschedule(home,*this,pc);
00195 b.reschedule(home,*this,Int::PC_INT_VAL);
00196 }
00197
00198 template<class View, PropCond pc, class CtrlView>
00199 forceinline size_t
00200 ReUnaryPropagator<View,pc,CtrlView>::dispose(Space& home) {
00201 if (pc != PC_GEN_NONE)
00202 x0.cancel(home,*this,pc);
00203 b.cancel(home,*this,Int::PC_INT_VAL);
00204 (void) Propagator::dispose(home);
00205 return sizeof(*this);
00206 }
00207
00208
00209
00210
00211
00212 template<class View, PropCond pc, class CtrlView>
00213 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00214 (Home home, View y0, View y1, CtrlView b1)
00215 : Propagator(home), x0(y0), x1(y1), b(b1) {
00216 if (pc != PC_GEN_NONE) {
00217 x0.subscribe(home,*this,pc);
00218 x1.subscribe(home,*this,pc);
00219 }
00220 b.subscribe(home,*this,Int::PC_INT_VAL);
00221 }
00222
00223 template<class View, PropCond pc, class CtrlView>
00224 forceinline
00225 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00226 (Space& home, bool share, ReBinaryPropagator<View,pc,CtrlView>& p)
00227 : Propagator(home,share,p) {
00228 x0.update(home,share,p.x0);
00229 x1.update(home,share,p.x1);
00230 b.update(home,share,p.b);
00231 }
00232
00233 template<class View, PropCond pc, class CtrlView>
00234 forceinline
00235 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00236 (Space& home, bool share, Propagator& p, View y0, View y1, CtrlView b0)
00237 : Propagator(home,share,p) {
00238 x0.update(home,share,y0);
00239 x1.update(home,share,y1);
00240 b.update(home,share,b0);
00241 }
00242
00243 template<class View, PropCond pc, class CtrlView>
00244 PropCost
00245 ReBinaryPropagator<View,pc,CtrlView>::cost(const Space&, const ModEventDelta&) const {
00246 return PropCost::binary(PropCost::LO);
00247 }
00248
00249 template<class View, PropCond pc, class CtrlView>
00250 void
00251 ReBinaryPropagator<View,pc,CtrlView>::reschedule(Space& home) {
00252 if (pc != PC_GEN_NONE) {
00253 x0.reschedule(home,*this,pc);
00254 x1.reschedule(home,*this,pc);
00255 }
00256 b.reschedule(home,*this,Int::PC_INT_VAL);
00257 }
00258
00259 template<class View, PropCond pc, class CtrlView>
00260 forceinline size_t
00261 ReBinaryPropagator<View,pc,CtrlView>::dispose(Space& home) {
00262 if (pc != PC_GEN_NONE) {
00263 x0.cancel(home,*this,pc);
00264 x1.cancel(home,*this,pc);
00265 }
00266 b.cancel(home,*this,Int::PC_INT_VAL);
00267 (void) Propagator::dispose(home);
00268 return sizeof(*this);
00269 }
00270
00271
00272
00273
00274
00275 template<class View0, PropCond pc0, class View1, PropCond pc1,
00276 class CtrlView>
00277 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>
00278 ::ReMixBinaryPropagator(Home home, View0 y0, View1 y1, CtrlView b1)
00279 : Propagator(home), x0(y0), x1(y1), b(b1) {
00280 if (pc0 != PC_GEN_NONE)
00281 x0.subscribe(home,*this,pc0);
00282 if (pc1 != PC_GEN_NONE)
00283 x1.subscribe(home,*this,pc1);
00284 b.subscribe(home,*this,Int::PC_INT_VAL);
00285 }
00286
00287 template<class View0, PropCond pc0, class View1, PropCond pc1,
00288 class CtrlView>
00289 forceinline
00290 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>::ReMixBinaryPropagator
00291 (Space& home, bool share,
00292 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>& p)
00293 : Propagator(home,share,p) {
00294 x0.update(home,share,p.x0);
00295 x1.update(home,share,p.x1);
00296 b.update(home,share,p.b);
00297 }
00298
00299 template<class View0, PropCond pc0, class View1, PropCond pc1,
00300 class CtrlView>
00301 forceinline
00302 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>
00303 ::ReMixBinaryPropagator
00304 (Space& home, bool share, Propagator& p, View0 y0, View1 y1, CtrlView b0)
00305 : Propagator(home,share,p) {
00306 x0.update(home,share,y0);
00307 x1.update(home,share,y1);
00308 b.update(home,share,b0);
00309 }
00310
00311 template<class View0, PropCond pc0, class View1, PropCond pc1,
00312 class CtrlView>
00313 PropCost
00314 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>
00315 ::cost(const Space&, const ModEventDelta&) const {
00316 return PropCost::binary(PropCost::LO);
00317 }
00318
00319 template<class View0, PropCond pc0, class View1, PropCond pc1,
00320 class CtrlView>
00321 void
00322 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>::reschedule(Space& home) {
00323 if (pc0 != PC_GEN_NONE)
00324 x0.reschedule(home,*this,pc0);
00325 if (pc1 != PC_GEN_NONE)
00326 x1.reschedule(home,*this,pc1);
00327 b.reschedule(home,*this,Int::PC_INT_VAL);
00328 }
00329
00330 template<class View0, PropCond pc0, class View1, PropCond pc1,
00331 class CtrlView>
00332 forceinline size_t
00333 ReMixBinaryPropagator<View0,pc0,View1,pc1,CtrlView>::dispose(Space& home) {
00334 if (pc0 != PC_GEN_NONE)
00335 x0.cancel(home,*this,pc0);
00336 if (pc1 != PC_GEN_NONE)
00337 x1.cancel(home,*this,pc1);
00338 b.cancel(home,*this,Int::PC_INT_VAL);
00339 (void) Propagator::dispose(home);
00340 return sizeof(*this);
00341 }
00342
00343 }}
00344
00345
00346