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

Function partitionNXi

gecode/set/rel-op/common.hpp:396–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394 // Xi UB is subset of YUB minus union of Xj LBs
395 template<class View0, class View1>
396 ExecStatus
397 partitionNXi(Space& home,
398 bool& modified, ViewArray<View0>& x, View1& y) {
399 int xsize = x.size();
400 Region r;
401 GLBndSet* afterUB =
402 static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
403 GLBndSet* afterLB =
404 static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
405
406 {
407 GLBndSet sofarAfterUB;
408 GLBndSet sofarAfterLB;
409 for (int i=xsize; i--;) {
410 new (&afterUB[i]) GLBndSet(home);
411 new (&afterLB[i]) GLBndSet(home);
412 afterUB[i].update(home,sofarAfterUB);
413 afterLB[i].update(home,sofarAfterLB);
414 LubRanges<View0> xiub(x[i]);
415 GlbRanges<View0> xilb(x[i]);
416 sofarAfterUB.includeI(home,xiub);
417 sofarAfterLB.includeI(home,xilb);
418 }
419 sofarAfterUB.dispose(home);
420 sofarAfterLB.dispose(home);
421 }
422
423 {
424 GLBndSet sofarBeforeUB;
425 GLBndSet sofarBeforeLB;
426 for (int i=0; i<xsize; i++) {
427 LubRanges<View1> yub(y);
428 BndSetRanges slb(sofarBeforeLB);
429 BndSetRanges afterlb(afterLB[i]);
430 Iter::Ranges::Union<BndSetRanges,
431 BndSetRanges> xjlb(slb, afterlb);
432 Iter::Ranges::Diff<LubRanges<View1>,
433 Iter::Ranges::Union<BndSetRanges,
434 BndSetRanges> > diff1(yub, xjlb);
435 GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home,diff1));
436
437 GlbRanges<View1> ylb(y);
438 BndSetRanges sub(sofarBeforeUB);
439 BndSetRanges afterub(afterUB[i]);
440 Iter::Ranges::Union<BndSetRanges,
441 BndSetRanges> xjub(sub, afterub);
442 Iter::Ranges::Diff<GlbRanges<View1>,
443 Iter::Ranges::Union<BndSetRanges,
444 BndSetRanges> > diff2(ylb, xjub);
445 GECODE_ME_CHECK_MODIFIED(modified, x[i].includeI(home,diff2));
446
447 LubRanges<View0> xiub(x[i]);
448 GlbRanges<View0> xilb(x[i]);
449 sofarBeforeUB.includeI(home,xiub);
450 sofarBeforeLB.includeI(home,xilb);
451 }
452 sofarBeforeLB.dispose(home);
453 sofarBeforeUB.dispose(home);

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.45
rallocMethod · 0.45
updateMethod · 0.45
includeIMethod · 0.45
disposeMethod · 0.45
intersectIMethod · 0.45

Tested by

no test coverage detected