00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 namespace Gecode {
00023
00039 template <class View, PropCond pc, class CtrlView>
00040 class ReUnaryPropagator : public Propagator {
00041 protected:
00043 View x0;
00045 CtrlView b;
00047 ReUnaryPropagator(Space* home, bool share, ReUnaryPropagator& p);
00049 ReUnaryPropagator(Space* home, View x0, CtrlView b, bool fd=false);
00050 public:
00052 virtual PropCost cost(void) const;
00054 virtual ~ReUnaryPropagator(void);
00055 };
00056
00063 template <class View, PropCond pc, class CtrlView>
00064 class ReBinaryPropagator : public Propagator {
00065 protected:
00067 View x0, x1;
00069 CtrlView b;
00071 ReBinaryPropagator(Space* home, bool share, ReBinaryPropagator& p);
00073 ReBinaryPropagator(Space* home, View x0, View x1,
00074 CtrlView b, bool fd=false);
00075 public:
00077 virtual PropCost cost(void) const;
00079 virtual ~ReBinaryPropagator(void);
00080 };
00082
00083
00084
00085
00086
00087
00088
00089 template <class View, PropCond pc, class CtrlView>
00090 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00091 (Space* home, View y0, CtrlView b0, bool fd)
00092 : Propagator(home,fd), x0(y0), b(b0) {
00093 x0.subscribe(home,this,pc);
00094 b.subscribe(home,this,Int::PC_INT_VAL);
00095 }
00096
00097 template <class View, PropCond pc, class CtrlView>
00098 forceinline
00099 ReUnaryPropagator<View,pc,CtrlView>::ReUnaryPropagator
00100 (Space* home, bool share, ReUnaryPropagator<View,pc,CtrlView>& p)
00101 : Propagator(home,share,p) {
00102 x0.update(home,share,p.x0);
00103 b.update(home,share,p.b);
00104 }
00105
00106 template <class View, PropCond pc, class CtrlView>
00107 PropCost
00108 ReUnaryPropagator<View,pc,CtrlView>::cost(void) const {
00109 return PC_UNARY_LO;
00110 }
00111
00112 template <class View, PropCond pc, class CtrlView>
00113 ReUnaryPropagator<View,pc,CtrlView>::~ReUnaryPropagator(void) {
00114 x0.cancel(this,pc);
00115 b.cancel(this,Int::PC_INT_VAL);
00116 }
00117
00118
00119
00120
00121
00122
00123
00124 template <class View, PropCond pc, class CtrlView>
00125 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00126 (Space* home, View y0, View y1, CtrlView b1, bool fd)
00127 : Propagator(home,fd), x0(y0), x1(y1), b(b1) {
00128 x0.subscribe(home,this,pc);
00129 x1.subscribe(home,this,pc);
00130 b.subscribe(home,this,Int::PC_INT_VAL);
00131 }
00132
00133 template <class View, PropCond pc, class CtrlView>
00134 forceinline
00135 ReBinaryPropagator<View,pc,CtrlView>::ReBinaryPropagator
00136 (Space* home, bool share, ReBinaryPropagator<View,pc,CtrlView>& p)
00137 : Propagator(home,share,p) {
00138 x0.update(home,share,p.x0);
00139 x1.update(home,share,p.x1);
00140 b.update(home,share,p.b);
00141 }
00142
00143 template <class View, PropCond pc, class CtrlView>
00144 PropCost
00145 ReBinaryPropagator<View,pc,CtrlView>::cost(void) const {
00146 return PC_BINARY_LO;
00147 }
00148
00149 template <class View, PropCond pc, class CtrlView>
00150 ReBinaryPropagator<View,pc,CtrlView>::~ReBinaryPropagator(void) {
00151 x0.cancel(this,pc);
00152 x1.cancel(this,pc);
00153 b.cancel(this,Int::PC_INT_VAL);
00154 }
00155
00156 }
00157
00158
00159