spec.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 namespace Gecode { namespace Int { namespace Dom {
00023
00024 template <class View>
00025 forceinline
00026 ReIntSet<View>::ReIntSet
00027 (Space* home, View x, const IntSet& s, BoolView b)
00028 : ReUnaryPropagator<View,PC_INT_DOM,BoolView>(home,x,b,true), is(s) {}
00029
00030 template <class View>
00031 ExecStatus
00032 ReIntSet<View>::post(Space* home, View x, const IntSet& s, BoolView b) {
00033 if (s.size() == 0) {
00034 GECODE_ME_CHECK(b.t_zero(home));
00035 } else if (s.size() == 1) {
00036 return ReRange<View>::post(home,x,s.min(),s.max(),b);
00037 } else {
00038 (void) new (home) ReIntSet<View>(home,x,s,b);
00039 }
00040 return ES_OK;
00041 }
00042
00043
00044 template <class View>
00045 forceinline
00046 ReIntSet<View>::ReIntSet(Space* home, bool share, ReIntSet& p)
00047 : ReUnaryPropagator<View,PC_INT_DOM,BoolView>(home,share,p) {
00048 is.update(share,p.is);
00049 }
00050
00051 template <class View>
00052 Actor*
00053 ReIntSet<View>::copy(Space* home, bool share) {
00054 return new (home) ReIntSet(home,share,*this);
00055 }
00056
00057 template <class View>
00058 ExecStatus
00059 ReIntSet<View>::propagate(Space* home) {
00060 IntSetRanges i_is(is);
00061 if (b.one()) {
00062 GECODE_ME_CHECK(x0.inter(home,i_is)); return ES_SUBSUMED;
00063 }
00064 if (b.zero()) {
00065 GECODE_ME_CHECK(x0.minus(home,i_is)); return ES_SUBSUMED;
00066 }
00067
00068 ViewRanges<View> i_x(x0);
00069
00070 switch (Iter::Ranges::subsumes(i_is,i_x)) {
00071 case Iter::Ranges::SS_SUBSUMED:
00072 b.t_one_none(home); return ES_SUBSUMED;
00073 case Iter::Ranges::SS_EMPTY:
00074 b.t_zero_none(home); return ES_SUBSUMED;
00075 case Iter::Ranges::SS_NONE:
00076 break;
00077 default: GECODE_NEVER;
00078 }
00079 return ES_FIX;
00080 }
00081
00082 }}}
00083
00084
00085