imp-hdr.icc
Go to the documentation of this file.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 namespace Gecode { namespace Int {
00027
00034
00035 const Gecode::ModEvent ME_INT_FAILED = Gecode::ME_GEN_FAILED;
00036
00038 const Gecode::ModEvent ME_INT_NONE = Gecode::ME_GEN_NONE;
00039
00041 const Gecode::ModEvent ME_INT_VAL = Gecode::ME_GEN_ASSIGNED;
00042
00051 const Gecode::ModEvent ME_INT_BND = Gecode::ME_GEN_ASSIGNED + 1;
00052
00061 const Gecode::ModEvent ME_INT_DOM = Gecode::ME_GEN_ASSIGNED + 2;
00062
00070 const Gecode::PropCond PC_INT_VAL = Gecode::PC_GEN_ASSIGNED;
00071
00080 const Gecode::PropCond PC_INT_BND = Gecode::PC_GEN_ASSIGNED + 1;
00081
00090 const Gecode::PropCond PC_INT_DOM = Gecode::PC_GEN_ASSIGNED + 2;
00091
00093
00095 class IntMeDiff {
00096 public:
00098 ModEvent operator()(ModEvent me1, ModEvent me2) const;
00099 };
00100
00102 class IntVarImpBase : public Gecode::Variable<VTI_INT,PC_INT_DOM,IntMeDiff> {
00103 protected:
00105 class Processor : public Gecode::VarTypeProcessor<VTI_INT,PC_INT_DOM,IntMeDiff> {
00106 public:
00108 GECODE_INT_EXPORT virtual void process(Space* home, VarBase* x);
00109 };
00111 GECODE_INT_EXPORT static Processor p;
00113 IntVarImpBase(Space* home, bool share, IntVarImpBase& x);
00114 public:
00116 IntVarImpBase(Space* home);
00118
00119
00131 void subscribe(Space* home, Propagator* p, PropCond pc, bool assigned, bool process);
00133 void notify(Space* home, ModEvent me);
00135
00136
00137 };
00138
00139
00140 forceinline ModEvent
00141 IntMeDiff::operator()(ModEvent me1, ModEvent me2) const {
00142 const int med = (
00143 (
00144 ((ME_INT_NONE ^ ME_INT_NONE) << 0) |
00145 ((ME_INT_VAL ^ ME_INT_VAL) << 2) |
00146 ((ME_INT_BND ^ ME_INT_BND) << 4) |
00147 ((ME_INT_DOM ^ ME_INT_DOM) << 6)
00148 ) |
00149 (
00150 ((ME_INT_NONE ^ ME_INT_VAL) << 8) |
00151 ((ME_INT_VAL ^ ME_INT_VAL) << 10) |
00152 ((ME_INT_BND ^ ME_INT_VAL) << 12) |
00153 ((ME_INT_DOM ^ ME_INT_VAL) << 14)
00154 ) |
00155 (
00156 ((ME_INT_NONE ^ ME_INT_BND) << 16) |
00157 ((ME_INT_VAL ^ ME_INT_VAL) << 18) |
00158 ((ME_INT_BND ^ ME_INT_BND) << 20) |
00159 ((ME_INT_DOM ^ ME_INT_BND) << 22)
00160 ) |
00161 (
00162 ((ME_INT_NONE ^ ME_INT_DOM) << 24) |
00163 ((ME_INT_VAL ^ ME_INT_VAL) << 26) |
00164 ((ME_INT_BND ^ ME_INT_BND) << 28) |
00165 ((ME_INT_DOM ^ ME_INT_DOM) << 30)
00166 )
00167 );
00168 return (((med >> (me1 << 3)) >> (me2 << 1)) & 3);
00169 }
00170
00171 forceinline
00172 IntVarImpBase::IntVarImpBase(Space* home)
00173 : Gecode::Variable<VTI_INT,PC_INT_DOM,IntMeDiff>(home) {}
00174
00175 forceinline
00176 IntVarImpBase::IntVarImpBase(Space* home, bool share, IntVarImpBase& x)
00177 : Gecode::Variable<VTI_INT,PC_INT_DOM,IntMeDiff>(home,share,x) {}
00178
00179 forceinline void
00180 IntVarImpBase::subscribe(Space* home, Propagator* p, PropCond pc, bool assigned, bool process) {
00181 Gecode::Variable<VTI_INT,PC_INT_DOM,IntMeDiff>::subscribe(home,p,pc,assigned,ME_INT_BND,process);
00182 }
00183
00184 forceinline void
00185 IntVarImpBase::notify(Space* home, ModEvent me) {
00186 Gecode::Variable<VTI_INT,PC_INT_DOM,IntMeDiff>::notify(home,me);
00187 }
00188
00189 }}
00190
00191