Generated on Wed Nov 1 15:04:46 2006 for Gecode by doxygen 1.4.5

subset.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Contributing authors:
00007  *     Gabor Szokoli <szokoli@gecode.org>
00008  *
00009  *  Copyright:
00010  *     Guido Tack, 2004
00011  *     Christian Schulte, 2004
00012  *     Gabor Szokoli, 2004
00013  *
00014  *  Last modified:
00015  *     $Date: 2005-11-15 17:40:47 +0100 (Tue, 15 Nov 2005) $ by $Author: tack $
00016  *     $Revision: 2576 $
00017  *
00018  *  This file is part of Gecode, the generic constraint
00019  *  development environment:
00020  *     http://www.gecode.org
00021  *
00022  *  See the file "LICENSE" for information on usage and
00023  *  redistribution of this file, and for a
00024  *     DISCLAIMER OF ALL WARRANTIES.
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 // STATISTICS: set-prop