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

Method propagate

gecode/int/element/view.hpp:311–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309
310 template<class VA, class VB, class VC>
311 ExecStatus
312 ViewBnd<VA,VB,VC>::propagate(Space& home, const ModEventDelta&) {
313 assert(iv.size() > 1);
314 RelTestBnd<VA,VC> rt;
315 GECODE_ES_CHECK((scan<VA,VB,VC,PC_INT_BND,RelTestBnd<VA,VC> >
316 (home,iv,x0,x1,*this,rt)));
317 if (iv.size() == 1) {
318 ExecStatus es = home.ES_SUBSUMED(*this);
319 (void) new (home) Rel::EqBnd<VA,VC>(home(*this),iv[0].view,x1);
320 return es;
321 }
322 assert(iv.size() > 1);
323 // Compute new result
324 int min = iv[0].view.min();
325 int max = iv[0].view.max();
326 for (int i=1; i<iv.size(); i++) {
327 min = std::min(iv[i].view.min(),min);
328 max = std::max(iv[i].view.max(),max);
329 }
330 ExecStatus es = shared(x0,x1) ? ES_NOFIX : ES_FIX;
331 {
332 ModEvent me = x1.lq(home,max);
333 if (me_failed(me))
334 return ES_FAILED;
335 if (me_modified(me) && (x1.max() != max))
336 es = ES_NOFIX;
337 }
338 {
339 ModEvent me = x1.gq(home,min);
340 if (me_failed(me))
341 return ES_FAILED;
342 if (me_modified(me) && (x1.min() != min))
343 es = ES_NOFIX;
344 }
345 return (x1.assigned() && (min == max)) ?
346 home.ES_SUBSUMED(*this) : es;
347 }
348
349
350

Callers

nothing calls this directly

Calls 15

me_failedFunction · 0.85
me_modifiedFunction · 0.85
ES_SUBSUMEDMethod · 0.80
ES_NOFIX_PARTIALMethod · 0.80
minFunction · 0.50
maxFunction · 0.50
sharedFunction · 0.50
sizeMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
lqMethod · 0.45
gqMethod · 0.45

Tested by

no test coverage detected