subset.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
00027
00028 namespace Gecode { namespace Set { namespace Rel {
00029
00030 template <class View0, class View1>
00031 forceinline
00032 SubSet<View0,View1>::SubSet(Space* home, View0 y0, View1 y1)
00033 : InhomBinaryPropagator<View0,PC_SET_CGLB,
00034 View1,PC_SET_CLUB>(home,y0,y1) {}
00035
00036 template <class View0, class View1>
00037 forceinline
00038 SubSet<View0,View1>::SubSet(Space* home, bool share, SubSet& p)
00039 : InhomBinaryPropagator<View0,PC_SET_CGLB,
00040 View1,PC_SET_CLUB>(home,share,p) {}
00041
00042 template <class View0, class View1>
00043 ExecStatus SubSet<View0,View1>::post(Space* home, View0 x, View1 y) {
00044 (void) new (home) SubSet(home,x,y);
00045 return ES_OK;
00046 }
00047
00048 template <class View0, class View1>
00049 Actor*
00050 SubSet<View0,View1>::copy(Space* home, bool share) {
00051 return new (home) SubSet(home,share,*this);
00052 }
00053
00054 template <class View0, class View1>
00055 ExecStatus
00056 SubSet<View0,View1>::propagate(Space* home) {
00057 bool oneassigned = x0.assigned() || x1.assigned();
00058 unsigned int x0glbsize;
00059 do {
00060 GlbRanges<View0> x0lb(x0);
00061 GECODE_ME_CHECK ( x1.includeI(home,x0lb) );
00062 GECODE_ME_CHECK ( x1.cardMin(home,x0.cardMin()) );
00063 LubRanges<View1> x1ub(x1);
00064 x0glbsize = x0.glbSize();
00065 GECODE_ME_CHECK ( x0.intersectI(home,x1ub) );
00066 GECODE_ME_CHECK ( x0.cardMax(home,x1.cardMax()) );
00067 } while (x0.glbSize() > x0glbsize);
00068 if (x0.cardMin()==x1.cardMax()) {
00069 GECODE_ES_CHECK((Eq<View0,View1>::post(home,x0,x1)));
00070 return ES_SUBSUMED;
00071 }
00072 if (shared(x0,x1)) {
00073 return oneassigned ? ES_SUBSUMED : ES_NOFIX;
00074 }
00075 return (x0.assigned() || x1.assigned()) ? ES_SUBSUMED : ES_FIX;
00076 }
00077
00078 }}}
00079
00080