common.icc
Go to the documentation of this file.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 Sequence {
00029
00030 forceinline
00031 ExecStatus propagateSeq(Space* home,
00032 bool& modified, bool& assigned,
00033 ViewArray<SetView>& x) {
00034
00035 int lastElem = x.size()-1;
00036 int cur_max = BndSet::MAX_OF_EMPTY;
00037 int cur_min = BndSet::MIN_OF_EMPTY;
00038
00039 for (int i=0; i<lastElem; i++) {
00040 if (x[i].glbSize() > 0) {
00041 int glbMax = x[i].glbMax();
00042 cur_max = std::max(cur_max, glbMax);
00043 }
00044 if (cur_max>=Limits::Set::int_min)
00045 GECODE_SET_ME_CHECK_VAL_B(modified,
00046 x[i+1].exclude(home, Limits::Set::int_min,
00047 cur_max),
00048 assigned);
00049
00050 if (x[lastElem-i].lubSize() > 0) {
00051 int glbMin = x[lastElem-i].glbMin();
00052 cur_min = std::min(cur_min, glbMin);
00053 }
00054 if (Limits::Set::int_max>=cur_min)
00055 GECODE_SET_ME_CHECK_VAL_B(modified,
00056 x[lastElem-i-1].exclude(home, cur_min,
00057 Limits::Set::int_max),
00058 assigned);
00059 }
00060 return ES_FIX;
00061 }
00062
00063 forceinline
00064 ExecStatus propagateSeqUnion(Space* home,
00065 bool& modified, ViewArray<SetView>& x, SetView& y) {
00066
00067 GECODE_AUTOARRAY(GlbRanges<SetView>, XLBs,x.size());
00068 for (int i=x.size(); i--; ){
00069 GlbRanges<SetView> lb(x[i]);
00070 XLBs[i]=lb;
00071 }
00072 Iter::Ranges::NaryAppend<GlbRanges<SetView> > u(XLBs,x.size());
00073 GECODE_ME_CHECK_MODIFIED(modified, y.includeI(home,u));
00074 return ES_FIX;
00075 }
00076
00077 }}}
00078
00079