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
00041
00042
00043
00044 #ifndef __GECODE_SET_REL_HH__
00045 #define __GECODE_SET_REL_HH__
00046
00047 #include <gecode/set.hh>
00048
00049 namespace Gecode { namespace Set { namespace Rel {
00050
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, bool share,Subset& p);
00072 Subset(Home home,View0, View1);
00073 public:
00075 virtual Actor* copy(Space& home,bool);
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, bool share,NoSubset& p);
00098 NoSubset(Home home,View0,View1);
00099 public:
00101 virtual Actor* copy(Space& home,bool);
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>
00115 class ReSubset : public Propagator {
00116 protected:
00117 View0 x0;
00118 View1 x1;
00119 Gecode::Int::BoolView b;
00120
00122 ReSubset(Space& home, bool share,ReSubset&);
00124 ReSubset(Home home,View0, View1, Gecode::Int::BoolView);
00125 public:
00127 virtual Actor* copy(Space& home,bool);
00129 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00131 virtual size_t dispose(Space& home);
00133 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00135 static ExecStatus post(Home home,View0 x, View1 y,
00136 Gecode::Int::BoolView b);
00137 };
00138
00145 template<class View0, class View1>
00146 class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00147 protected:
00148 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00149 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00151 Eq(Space& home, bool share,Eq& p);
00153 Eq(Home home,View0, View1);
00154 public:
00156 virtual Actor* copy(Space& home,bool);
00158 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00160 static ExecStatus post(Home home,View0,View1);
00161 };
00162
00169 template<class View0, class View1>
00170 class ReEq : public Propagator {
00171 protected:
00172 View0 x0;
00173 View1 x1;
00174 Gecode::Int::BoolView b;
00175
00177 ReEq(Space& home, bool share,ReEq&);
00179 ReEq(Home home,View0, View1, Gecode::Int::BoolView);
00180 public:
00182 virtual Actor* copy(Space& home,bool);
00184 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00186 virtual size_t dispose(Space& home);
00188 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00190 static ExecStatus post(Home home,View0 x, View1 y,
00191 Gecode::Int::BoolView b);
00192 };
00193
00202 template<class View0, class View1, bool strict=false>
00203 class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00204 protected:
00205 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00206 using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00208 Lq(Space& home, bool share,Lq& p);
00210 Lq(Home home,View0, View1);
00211 public:
00213 virtual Actor* copy(Space& home,bool);
00215 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00217 static ExecStatus post(Home home,View0,View1);
00218 };
00219
00228 template<class View0, class View1, bool strict=false>
00229 class ReLq : public Propagator {
00230 protected:
00231 View0 x0;
00232 View1 x1;
00233 Gecode::Int::BoolView b;
00234
00236 ReLq(Space& home, bool share,ReLq&);
00238 ReLq(Home home,View0, View1, Gecode::Int::BoolView);
00239 public:
00241 virtual Actor* copy(Space& home,bool);
00243 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00245 virtual size_t dispose(Space& home);
00247 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00249 static ExecStatus post(Home home,View0 x, View1 y,
00250 Gecode::Int::BoolView b);
00251 };
00252
00260 template<class View0, class View1>
00261 class Distinct :
00262 public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
00263 protected:
00264 using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x0;
00265 using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x1;
00267 Distinct(Space& home, bool share,Distinct& p);
00269 Distinct(Home home,View0,View1);
00270 public:
00272 virtual Actor* copy(Space& home,bool);
00274 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00276 static ExecStatus post(Home home,View0,View1);
00277 };
00278
00289 template<class View0>
00290 class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
00291 protected:
00292 using UnaryPropagator<View0,PC_SET_ANY>::x0;
00294 ConstSetView y;
00296 DistinctDoit(Space& home, bool share,DistinctDoit&);
00298 DistinctDoit(Home home, View0, ConstSetView);
00299 public:
00301 virtual Actor* copy(Space& home, bool);
00303 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00305 static ExecStatus post(Home home, View0, ConstSetView);
00306 };
00307
00308 }}}
00309
00310 #include <gecode/set/rel/common.hpp>
00311 #include <gecode/set/rel/subset.hpp>
00312 #include <gecode/set/rel/nosubset.hpp>
00313 #include <gecode/set/rel/re-subset.hpp>
00314 #include <gecode/set/rel/eq.hpp>
00315 #include <gecode/set/rel/re-eq.hpp>
00316 #include <gecode/set/rel/nq.hpp>
00317 #include <gecode/set/rel/lq.hpp>
00318 #include <gecode/set/rel/re-lq.hpp>
00319
00320 #endif
00321
00322