nosubset.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 Set { namespace Rel {
00027
00028
00029
00030
00031
00032
00033 template <class View0, class View1>
00034 forceinline
00035 NoSubSet<View0,View1>::NoSubSet(Space* home, View0 y0, View1 y1)
00036 : InhomBinaryPropagator<View0,PC_SET_CLUB,
00037 View1,PC_SET_CGLB>(home,y0,y1) {}
00038
00039 template <class View0, class View1>
00040 forceinline
00041 NoSubSet<View0,View1>::NoSubSet(Space* home, bool share,
00042 NoSubSet<View0,View1>& p)
00043 : InhomBinaryPropagator<View0,PC_SET_CLUB,
00044 View1,PC_SET_CGLB>(home,share,p) {}
00045
00046 template <class View0, class View1>
00047 ExecStatus
00048 NoSubSet<View0,View1>::post(Space* home, View0 x, View1 y) {
00049 if (me_failed(x.cardMin(home,1)))
00050 return ES_FAILED;
00051 (void) new (home) NoSubSet<View0,View1>(home,x,y);
00052 return ES_OK;
00053 }
00054
00055 template <class View0, class View1>
00056 Actor*
00057 NoSubSet<View0,View1>::copy(Space* home, bool share) {
00058 return new (home) NoSubSet<View0,View1>(home,share,*this);
00059 }
00060
00061 template <class View0, class View1>
00062 ExecStatus
00063 NoSubSet<View0,View1>::propagate(Space* home) {
00064 GlbRanges<View0> x0lb(x0);
00065 LubRanges<View1> x1ub(x1);
00066 if (!Iter::Ranges::subset(x0lb, x1ub))
00067 return ES_SUBSUMED;
00068 if (x0.cardMin()>x1.cardMax()) { return ES_SUBSUMED; }
00069 LubRanges<View0> x0ub(x0);
00070 GlbRanges<View1> x1lb(x1);
00071 Iter::Ranges::Diff<LubRanges<View0>,GlbRanges<View1> >
00072 breakers(x0ub,x1lb);
00073 if (!breakers()) { return ES_FAILED; }
00074 if (breakers.min() == breakers.max()) {
00075 int b1 = breakers.min();
00076 ++breakers;
00077 if (breakers()) { return ES_FIX; }
00078
00079 GECODE_ME_CHECK( x0.include(home,b1) );
00080 GECODE_ME_CHECK( x1.exclude(home,b1) );
00081 return ES_SUBSUMED;
00082 }
00083 return ES_FIX;
00084 }
00085
00086 }}}
00087
00088