| 510 | // Xi LB includes YLB minus union Xj UB |
| 511 | template<class View0, class View1> |
| 512 | ExecStatus |
| 513 | partitionNXiLB(Space& home, |
| 514 | bool& modified, ViewArray<View0>& x, View1& y, |
| 515 | GLBndSet& unionOfDets) { |
| 516 | int xsize = x.size(); |
| 517 | Region r; |
| 518 | GLBndSet* afterUB = |
| 519 | static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize)); |
| 520 | |
| 521 | { |
| 522 | GLBndSet sofarAfterUB; |
| 523 | for (int i=xsize; i--;) { |
| 524 | new (&afterUB[i]) GLBndSet(home); |
| 525 | afterUB[i].update(home,sofarAfterUB); |
| 526 | LubRanges<View0> xiub(x[i]); |
| 527 | sofarAfterUB.includeI(home,xiub); |
| 528 | } |
| 529 | sofarAfterUB.dispose(home); |
| 530 | } |
| 531 | |
| 532 | { |
| 533 | //The union of previously determined x[j]-s is added to the mix here: |
| 534 | GLBndSet sofarBeforeUB; |
| 535 | sofarBeforeUB.update(home,unionOfDets); |
| 536 | for (int i=0; i<xsize; i++) { |
| 537 | GlbRanges<View1> ylb(y); |
| 538 | BndSetRanges sub(sofarBeforeUB); |
| 539 | BndSetRanges afterub(afterUB[i]); |
| 540 | Iter::Ranges::Union<BndSetRanges, |
| 541 | BndSetRanges> xjub(sub, afterub); |
| 542 | Iter::Ranges::Diff<GlbRanges<View1>, |
| 543 | Iter::Ranges::Union<BndSetRanges, |
| 544 | BndSetRanges> > diff2(ylb, xjub); |
| 545 | GECODE_ME_CHECK_MODIFIED(modified, x[i].includeI(home,diff2)); |
| 546 | |
| 547 | LubRanges<View0> xiub(x[i]); |
| 548 | sofarBeforeUB.includeI(home,xiub); |
| 549 | } |
| 550 | sofarBeforeUB.dispose(home); |
| 551 | } |
| 552 | for (int i=xsize;i--;) |
| 553 | afterUB[i].dispose(home); |
| 554 | return ES_NOFIX; |
| 555 | } |
| 556 | |
| 557 | // Y LB contains union of X LBs |
| 558 | template<class View0, class View1> |