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
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 namespace Gecode { namespace Set { namespace Rel {
00041
00042 template<class View0, class View1>
00043 forceinline
00044 Eq<View0,View1>::Eq(Home home, View0 x, View1 y)
00045 : MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>(home,x,y) {}
00046
00047 template<class View0, class View1>
00048 forceinline
00049 Eq<View0,View1>::Eq(Space& home, Eq& p)
00050 : MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>(home,p) {}
00051
00052 template<class View0, class View1>
00053 ExecStatus
00054 Eq<View0,View1>::post(Home home, View0 x, View1 y) {
00055 if (!same(x,y))
00056 (void) new (home) Eq(home,x,y);
00057 return ES_OK;
00058 }
00059
00060 template<class View0, class View1>
00061 Actor*
00062 Eq<View0,View1>::copy(Space& home) {
00063 return new (home) Eq(home,*this);
00064 }
00065
00066 template<class View0, class View1>
00067 ExecStatus
00068 Eq<View0,View1>::propagate(Space& home, const ModEventDelta& med) {
00069
00070 ModEvent me0 = View0::me(med);
00071 ModEvent me1 = View1::me(med);
00072
00073 Region r;
00074
00075 if (testSetEventLB(me0,me1)) {
00076 GlbRanges<View0> x0lb(x0);
00077 GlbRanges<View1> x1lb(x1);
00078 Iter::Ranges::Union<GlbRanges<View0>,GlbRanges<View1> > lbu(x0lb,x1lb);
00079 Iter::Ranges::Cache lbuc(r,lbu);
00080 GECODE_ME_CHECK(x0.includeI(home,lbuc));
00081 lbuc.reset();
00082 GECODE_ME_CHECK(x1.includeI(home,lbuc));
00083 }
00084
00085 if (testSetEventUB(me0,me1)) {
00086 LubRanges<View0> x0ub(x0);
00087 LubRanges<View1> x1ub(x1);
00088 Iter::Ranges::Inter<LubRanges<View0>,LubRanges<View1> > ubi(x0ub,x1ub);
00089 Iter::Ranges::Cache ubic(r,ubi);
00090 GECODE_ME_CHECK(x0.intersectI(home,ubic));
00091 ubic.reset();
00092 GECODE_ME_CHECK(x1.intersectI(home,ubic));
00093 }
00094
00095 if (testSetEventCard(me0,me1)) {
00096 unsigned int max = std::min(x0.cardMax(),x1.cardMax());
00097 unsigned int min = std::max(x0.cardMin(),x1.cardMin());
00098 GECODE_ME_CHECK(x0.cardMax(home,max));
00099 GECODE_ME_CHECK(x1.cardMax(home,max));
00100 GECODE_ME_CHECK(x0.cardMin(home,min));
00101 GECODE_ME_CHECK(x1.cardMin(home,min));
00102 }
00103
00104 if (x0.assigned()) {
00105 assert (x1.assigned());
00106 return home.ES_SUBSUMED(*this);
00107 }
00108 return shared(x0,x1) ? ES_NOFIX : ES_FIX;
00109 }
00110
00111 }}}
00112
00113