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
00039
00040 #ifndef __GECODE_SET_REL_HH__
00041 #define __GECODE_SET_REL_HH__
00042
00043 #include <gecode/set.hh>
00044
00045 namespace Gecode { namespace Set { namespace Rel {
00046
00052
00053 template<class VX, class VY>
00054 bool same(VX c, VY y);
00055
00063 template<class View0, class View1>
00064 class Subset :
00065 public MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB> {
00066 protected:
00067 using MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB>::x0;
00068 using MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB>::x1;
00070 Subset(Space& home, Subset& p);
00072 Subset(Home home, View0 x0, View1 x1);
00073 public:
00075 virtual Actor* copy(Space& home);
00077 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00079 static ExecStatus post(Home home, View0 x, View1 y);
00080 };
00081
00089 template<class View0, class View1>
00090 class NoSubset :
00091 public MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB> {
00092 protected:
00093 using MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB>::x0;
00094 using MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB>::x1;
00096 NoSubset(Space& home, NoSubset& p);
00098 NoSubset(Home home, View0 x0, View1 x1);
00099 public:
00101 virtual Actor* copy(Space& home);
00103 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00105 static ExecStatus post(Home home,View0 x,View1 y);
00106 };
00107
00114 template<class View0, class View1, class CtrlView, ReifyMode rm>
00115 class ReSubset : public Propagator {
00116 protected:
00118 View0 x0;
00120 View1 x1;
00122 CtrlView b;
00124 ReSubset(Space& home, ReSubset& p);
00126 ReSubset(Home home, View0 x0, View1 x1, CtrlView b);
00127 public:
00129 virtual Actor* copy(Space& home);
00131 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00133 virtual void reschedule(Space& home);
00135 virtual size_t dispose(Space& home);
00137 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00139 static ExecStatus post(Home home, View0 x, View1 y,
00140 CtrlView b);
00141 };
00142
00149 template<class View0, class View1>
00150 class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00151 protected:
00152 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00153 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00155 Eq(Space& home, Eq& p);
00157 Eq(Home home, View0 x0, View1 x1);
00158 public:
00160 virtual Actor* copy(Space& home);
00162 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00164 static ExecStatus post(Home home, View0 x, View1 y);
00165 };
00166
00173 template<class View0, class View1, class CtrlView, ReifyMode rm>
00174 class ReEq : public Propagator {
00175 protected:
00176 View0 x0;
00177 View1 x1;
00178 CtrlView b;
00180 ReEq(Space& home, ReEq&);
00182 ReEq(Home home, View0 x0, View1 x1, CtrlView b);
00183 public:
00185 virtual Actor* copy(Space& home);
00187 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00189 virtual void reschedule(Space& home);
00191 virtual size_t dispose(Space& home);
00193 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00195 static ExecStatus post(Home home, View0 x, View1 y,
00196 CtrlView b);
00197 };
00198
00207 template<class View0, class View1, bool strict=false>
00208 class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00209 protected:
00210 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00211 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00213 Lq(Space& home, Lq& p);
00215 Lq(Home home, View0 x0, View1 x1);
00216 public:
00218 virtual Actor* copy(Space& home);
00220 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00222 static ExecStatus post(Home home, View0 x, View1 y);
00223 };
00224
00233 template<class View0, class View1, ReifyMode rm, bool strict=false>
00234 class ReLq : public Propagator {
00235 protected:
00236 View0 x0;
00237 View1 x1;
00238 Gecode::Int::BoolView b;
00240 ReLq(Space& home, ReLq& p);
00242 ReLq(Home home, View0 x0, View1 x1, Gecode::Int::BoolView b);
00243 public:
00245 virtual Actor* copy(Space& home);
00247 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00249 virtual void reschedule(Space& home);
00251 virtual size_t dispose(Space& home);
00253 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00255 static ExecStatus post(Home home, View0 x, View1 y,
00256 Gecode::Int::BoolView b);
00257 };
00258
00266 template<class View0, class View1>
00267 class Distinct :
00268 public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
00269 protected:
00270 using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x0;
00271 using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x1;
00273 Distinct(Space& home, Distinct& p);
00275 Distinct(Home home, View0 x0, View1 x1);
00276 public:
00278 virtual Actor* copy(Space& home);
00280 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00282 static ExecStatus post(Home home, View0 x, View1 y);
00283 };
00284
00295 template<class View0>
00296 class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
00297 protected:
00298 using UnaryPropagator<View0,PC_SET_ANY>::x0;
00300 ConstSetView y;
00302 DistinctDoit(Space& home, DistinctDoit&);
00304 DistinctDoit(Home home, View0 x0, ConstSetView y);
00305 public:
00307 virtual Actor* copy(Space& home);
00309 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00311 static ExecStatus post(Home home, View0 x, ConstSetView y);
00312 };
00313
00314 }}}
00315
00316 #include <gecode/set/rel/common.hpp>
00317 #include <gecode/set/rel/subset.hpp>
00318 #include <gecode/set/rel/nosubset.hpp>
00319 #include <gecode/set/rel/re-subset.hpp>
00320 #include <gecode/set/rel/eq.hpp>
00321 #include <gecode/set/rel/re-eq.hpp>
00322 #include <gecode/set/rel/nq.hpp>
00323 #include <gecode/set/rel/lq.hpp>
00324 #include <gecode/set/rel/re-lq.hpp>
00325
00326 #endif
00327
00328