MCPcopy Create free account
hub / github.com/Gecode/gecode / propagate

Method propagate

gecode/int/member/re-prop.hpp:114–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113 template<class View, ReifyMode rm>
114 ExecStatus
115 ReProp<View,rm>::propagate(Space& home, const ModEventDelta& med) {
116 // Add assigned views to value set
117 if (View::me(med) == ME_INT_VAL)
118 add(home,vs,x);
119
120 if (b.one()) {
121 if (rm == RM_PMI)
122 return home.ES_SUBSUMED(*this);
123 ValSet vsc(vs);
124 vs.flush();
125 GECODE_REWRITE(*this,Prop<View>::post(home(*this),vsc,x,y));
126 }
127
128 if (b.zero()) {
129 if (rm != RM_IMP) {
130 ValSet::Ranges vsr(vs);
131 GECODE_ME_CHECK(y.minus_r(home,vsr,false));
132 for (int i=0; i<x.size(); i++)
133 GECODE_ES_CHECK((Rel::Nq<View,View>::post(Home(home),x[i],y)));
134 }
135 return home.ES_SUBSUMED(*this);
136 }
137
138 // Eliminate views from x
139 eliminate(home);
140
141 switch (vs.compare(y)) {
142 case Iter::Ranges::CS_SUBSET:
143 if (rm != RM_IMP)
144 GECODE_ME_CHECK(b.one(home));
145 return home.ES_SUBSUMED(*this);
146 case Iter::Ranges::CS_DISJOINT:
147 if (x.size() == 0) {
148 if (rm != RM_PMI)
149 GECODE_ME_CHECK(b.zero(home));
150 return home.ES_SUBSUMED(*this);
151 }
152 break;
153 case Iter::Ranges::CS_NONE:
154 break;
155 default:
156 GECODE_NEVER;
157 }
158
159 // Check whether y is in union of x and value set
160 if (x.size() > 0) {
161 Region r;
162
163 ValSet::Ranges vsr(vs);
164 ViewRanges<View> xsr(x[0]);
165 Iter::Ranges::NaryUnion u(r,vsr,xsr);
166 for (int i=1; i<x.size(); i++) {
167 ViewRanges<View> xir(x[i]);
168 u |= xir;
169 }
170
171 ViewRanges<View> yr(y);

Callers

nothing calls this directly

Calls 12

addFunction · 0.85
HomeClass · 0.85
disjointFunction · 0.85
ES_SUBSUMEDMethod · 0.80
postFunction · 0.50
eliminateFunction · 0.50
oneMethod · 0.45
flushMethod · 0.45
zeroMethod · 0.45
minus_rMethod · 0.45
sizeMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected