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 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