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 namespace Gecode { namespace Set { namespace Rel {
00043
00044
00045
00046
00047
00048
00049 template <class View0, class View1>
00050 forceinline
00051 NoSubSet<View0,View1>::NoSubSet(Space* home, View0 y0, View1 y1)
00052 : MixBinaryPropagator<View0,PC_SET_CLUB,
00053 View1,PC_SET_CGLB>(home,y0,y1) {}
00054
00055 template <class View0, class View1>
00056 forceinline
00057 NoSubSet<View0,View1>::NoSubSet(Space* home, bool share,
00058 NoSubSet<View0,View1>& p)
00059 : MixBinaryPropagator<View0,PC_SET_CLUB,
00060 View1,PC_SET_CGLB>(home,share,p) {}
00061
00062 template <class View0, class View1>
00063 ExecStatus
00064 NoSubSet<View0,View1>::post(Space* home, View0 x, View1 y) {
00065 if (me_failed(x.cardMin(home,1)))
00066 return ES_FAILED;
00067 (void) new (home) NoSubSet<View0,View1>(home,x,y);
00068 return ES_OK;
00069 }
00070
00071 template <class View0, class View1>
00072 Actor*
00073 NoSubSet<View0,View1>::copy(Space* home, bool share) {
00074 return new (home) NoSubSet<View0,View1>(home,share,*this);
00075 }
00076
00077 template <class View0, class View1>
00078 Support::Symbol
00079 NoSubSet<View0,View1>::ati(void) {
00080 return Reflection::mangle<View0,View1>("Gecode::Set::Rel::NoSubSet");
00081 }
00082
00083 template <class View0, class View1>
00084 Reflection::ActorSpec
00085 NoSubSet<View0,View1>::spec(const Space* home,
00086 Reflection::VarMap& m) const {
00087 return MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB>
00088 ::spec(home, m, ati());
00089 }
00090
00091 template <class View0, class View1>
00092 void
00093 NoSubSet<View0,View1>::post(Space* home, Reflection::VarMap& vars,
00094 const Reflection::ActorSpec& spec) {
00095 spec.checkArity(2);
00096 View0 x0(home, vars, spec[0]);
00097 View1 x1(home, vars, spec[1]);
00098 (void) new (home) NoSubSet(home,x0,x1);
00099 }
00100
00101 template <class View0, class View1>
00102 ExecStatus
00103 NoSubSet<View0,View1>::propagate(Space* home, ModEventDelta) {
00104 GlbRanges<View0> x0lb(x0);
00105 LubRanges<View1> x1ub(x1);
00106 if (!Iter::Ranges::subset(x0lb, x1ub))
00107 return ES_SUBSUMED(this,home);
00108 if (x0.cardMin()>x1.cardMax()) { return ES_SUBSUMED(this,home); }
00109 LubRanges<View0> x0ub(x0);
00110 GlbRanges<View1> x1lb(x1);
00111 Iter::Ranges::Diff<LubRanges<View0>,GlbRanges<View1> >
00112 breakers(x0ub,x1lb);
00113 if (!breakers()) { return ES_FAILED; }
00114 if (breakers.min() == breakers.max()) {
00115 int b1 = breakers.min();
00116 ++breakers;
00117 if (breakers()) { return ES_FIX; }
00118
00119 GECODE_ME_CHECK( x0.include(home,b1) );
00120 GECODE_ME_CHECK( x1.exclude(home,b1) );
00121 return ES_SUBSUMED(this,home);
00122 }
00123 return ES_FIX;
00124 }
00125
00126 }}}
00127
00128