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

eq.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   Eq<View0,View1>::Eq(Space* home, View0 x, View1 y)
00033     : InhomBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>(home,x,y) {}
00034 
00035   template <class View0, class View1>
00036   forceinline
00037   Eq<View0,View1>::Eq(Space* home, bool share, Eq& p)
00038     : InhomBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>(home,share,p) {}
00039 
00040   template <class View0, class View1>
00041   ExecStatus
00042   Eq<View0,View1>::post(Space* home, View0 x, View1 y) {
00043     (void) new (home) Eq(home,x,y);
00044     return ES_OK;
00045   }
00046 
00047   template <class View0, class View1>
00048   Actor*
00049   Eq<View0,View1>::copy(Space* home, bool share) {
00050     return new (home) Eq(home,share,*this);
00051   }
00052 
00053 
00054   template <class View0, class View1>
00055   ExecStatus
00056   Eq<View0,View1>::propagate(Space* home) {
00057 
00058     ModEvent me0 = View0::pme(this);
00059     ModEvent me1 = View1::pme(this);
00060 
00061     if ( testSetEventLB(me0,me1) ) {
00062       GlbRanges<View0> x0lb(x0);
00063       GlbRanges<View1> x1lb(x1);
00064       Iter::Ranges::Union<GlbRanges<View0>,GlbRanges<View1> > lbu(x0lb,x1lb);
00065       Iter::Ranges::Cache<Iter::Ranges::Union
00066         <GlbRanges<View0>, GlbRanges<View1> > > lbuc(lbu);
00067       GECODE_ME_CHECK ( x0.includeI(home,lbuc) );
00068       lbuc.reset();
00069       GECODE_ME_CHECK ( x1.includeI(home,lbuc) );
00070     }
00071 
00072     if (testSetEventUB(me0,me1) ) {
00073       LubRanges<View0> x0ub(x0);
00074       LubRanges<View1> x1ub(x1);
00075       Iter::Ranges::Inter<LubRanges<View0>,LubRanges<View1> > ubi(x0ub,x1ub);
00076       Iter::Ranges::Cache<Iter::Ranges::Inter
00077         <LubRanges<View0>,LubRanges<View1> > > ubic(ubi);
00078       GECODE_ME_CHECK ( x0.intersectI(home,ubic) );
00079       ubic.reset();
00080       GECODE_ME_CHECK ( x1.intersectI(home,ubic) );
00081     }
00082 
00083     if (testSetEventCard(me0,me1) ) {
00084       unsigned int max = std::min(x0.cardMax(),x1.cardMax());
00085       unsigned int min = std::max(x0.cardMin(),x1.cardMin());
00086       GECODE_ME_CHECK ( x0.cardMax(home,max) );
00087       GECODE_ME_CHECK ( x1.cardMax(home,max) );
00088       GECODE_ME_CHECK ( x0.cardMin(home,min) );
00089       GECODE_ME_CHECK ( x1.cardMin(home,min) );
00090     }
00091 
00092     if (x0.assigned()) {
00093       assert (x1.assigned());
00094       return ES_SUBSUMED;
00095     }
00096     return shared(x0,x1) ? ES_NOFIX : ES_FIX;
00097   }
00098 
00099 }}}
00100 
00101 // STATISTICS: set-prop