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

Method propagate

gecode/int/linear/bool-scale.hpp:251–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249
250 template<class SBAP, class SBAN, class VX>
251 ExecStatus
252 EqBoolScale<SBAP,SBAN,VX>::propagate(Space& home, const ModEventDelta& med) {
253 int sl_p = 0; // Lower bound, computed positive
254 int su_n = 0; // Upper bound, computed negative
255 if (BoolView::me(med) == ME_BOOL_VAL) {
256 // Eliminate assigned positive views while keeping order
257 {
258 // Skip not assigned views
259 ScaleBool* f = p.fst();
260 ScaleBool* l = p.lst();
261 while ((f < l) && f->x.none()) {
262 su_n += f->a; f++;
263 }
264 // Copy unassigned views to t
265 ScaleBool* t = f;
266 while (f < l) {
267 if (f->x.one()) {
268 c -= f->a;
269 } else if (f->x.none()) {
270 su_n += f->a; *t = *f; t++;
271 }
272 f++;
273 }
274 p.lst(t);
275 }
276 // Eliminate assigned negative views while keeping order
277 {
278 // Skip not assigned views
279 ScaleBool* f = n.fst();
280 ScaleBool* l = n.lst();
281 while ((f < l) && f->x.none()) {
282 sl_p += f->a; f++;
283 }
284 // Copy unassigned views to t
285 ScaleBool* t = f;
286 while (f < l) {
287 if (f->x.one()) {
288 c += f->a;
289 } else if (f->x.none()) {
290 sl_p += f->a; *t = *f; t++;
291 }
292 f++;
293 }
294 n.lst(t);
295 }
296 } else {
297 for (ScaleBool* f=p.fst(); f<p.lst(); f++)
298 su_n += f->a;
299 for (ScaleBool* f=n.fst(); f<n.lst(); f++)
300 sl_p += f->a;
301 }
302
303 if (p.empty() && n.empty()) {
304 GECODE_ME_CHECK(x.eq(home,-c));
305 return home.ES_SUBSUMED(*this);
306 }
307
308 sl_p += x.max() + c;

Callers

nothing calls this directly

Calls 15

me_failedFunction · 0.85
me_modifiedFunction · 0.85
ES_SUBSUMEDMethod · 0.80
fstMethod · 0.45
lstMethod · 0.45
noneMethod · 0.45
oneMethod · 0.45
emptyMethod · 0.45
eqMethod · 0.45
maxMethod · 0.45
minMethod · 0.45
zero_noneMethod · 0.45

Tested by

no test coverage detected