/* * Main authors: * Guido Tack * Christian Schulte * * Contributing authors: * Gabor Szokoli * * Copyright: * Guido Tack, 2004 * Christian Schulte, 2004 * Gabor Szokoli, 2004 * * Last modified: * $Date: 2005-11-15 17:40:47 +0100 (Tue, 15 Nov 2005) $ by $Author: tack $ * $Revision: 2576 $ * * This file is part of Gecode, the generic constraint * development environment: * http://www.gecode.org * * See the file "LICENSE" for information on usage and * redistribution of this file, and for a * DISCLAIMER OF ALL WARRANTIES. * */ namespace Gecode { namespace Set { namespace Rel { template forceinline SubSet::SubSet(Space* home, View0 y0, View1 y1) : InhomBinaryPropagator(home,y0,y1) {} template forceinline SubSet::SubSet(Space* home, bool share, SubSet& p) : InhomBinaryPropagator(home,share,p) {} template ExecStatus SubSet::post(Space* home, View0 x, View1 y) { (void) new (home) SubSet(home,x,y); return ES_OK; } template Actor* SubSet::copy(Space* home, bool share) { return new (home) SubSet(home,share,*this); } template ExecStatus SubSet::propagate(Space* home) { bool oneassigned = x0.assigned() || x1.assigned(); unsigned int x0glbsize; do { GlbRanges x0lb(x0); GECODE_ME_CHECK ( x1.includeI(home,x0lb) ); GECODE_ME_CHECK ( x1.cardMin(home,x0.cardMin()) ); LubRanges x1ub(x1); x0glbsize = x0.glbSize(); GECODE_ME_CHECK ( x0.intersectI(home,x1ub) ); GECODE_ME_CHECK ( x0.cardMax(home,x1.cardMax()) ); } while (x0.glbSize() > x0glbsize); if (x0.cardMin()==x1.cardMax()) { GECODE_ES_CHECK((Eq::post(home,x0,x1))); return ES_SUBSUMED; } if (shared(x0,x1)) { return oneassigned ? ES_SUBSUMED : ES_NOFIX; } return (x0.assigned() || x1.assigned()) ? ES_SUBSUMED : ES_FIX; } }}} // STATISTICS: set-prop