projector.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 {
00023
00024 forceinline
00025 Projector::Projector(void) : i(0), glb(), lub() {}
00026
00027 forceinline
00028 Projector::Projector(SetExpr::var_idx x,
00029 const SetExpr& sglb, const SetExpr& slub)
00030 : i(x), glb(sglb.encode()), lub(slub.encode()),
00031 _arity(std::max(sglb.arity(), slub.arity())) {}
00032
00033 template <bool negated>
00034 inline ExecStatus
00035 Projector::propagate(Space* home, ViewArray<Set::SetView>& x) {
00036 if (negated) {
00037 switch (ExecStatus es=check(home, x)) {
00038 case ES_FAILED: return ES_SUBSUMED;
00039 case ES_SUBSUMED: return ES_FAILED;
00040 default: return es;
00041 }
00042 } else {
00043
00044 {
00045 SetExprRanges glbranges(x,glb,false);
00046 GECODE_ME_CHECK(x[i].includeI(home, glbranges));
00047 }
00048 {
00049 SetExprRanges lubranges(x,lub,true);
00050 GECODE_ME_CHECK(x[i].intersectI(home, lubranges));
00051 }
00052 return ES_NOFIX;
00053 }
00054 }
00055
00056 forceinline unsigned int
00057 Projector::glbSize(ViewArray<Set::SetView>& x) {
00058 SetExprRanges glbranges(x, glb, false);
00059 return Iter::Ranges::size(glbranges);
00060 }
00061
00062 forceinline unsigned int
00063 Projector::lubSize(ViewArray<Set::SetView>& x) {
00064 SetExprRanges lubranges(x, lub, true);
00065 return Iter::Ranges::size(lubranges);
00066 }
00067
00068 forceinline const SetExprCode&
00069 Projector::getGlb(void) const { return glb; }
00070
00071 forceinline const SetExprCode&
00072 Projector::getLub(void) const { return lub; }
00073
00074 forceinline int
00075 Projector::getIdx(void) const { return i; }
00076
00077 }
00078
00079