| 464 | // Xi UB is subset of YUB minus union of Xj LBs |
| 465 | template<class View0, class View1> |
| 466 | ExecStatus |
| 467 | partitionNXiUB(Space& home, |
| 468 | bool& modified, ViewArray<View0>& x, View1& y, |
| 469 | GLBndSet& unionOfDets) { |
| 470 | int xsize = x.size(); |
| 471 | Region r; |
| 472 | GLBndSet* afterLB = |
| 473 | static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize)); |
| 474 | |
| 475 | { |
| 476 | GLBndSet sofarAfterLB; |
| 477 | for (int i=xsize; i--;) { |
| 478 | new (&afterLB[i]) GLBndSet(home); |
| 479 | afterLB[i].update(home,sofarAfterLB); |
| 480 | GlbRanges<View0> xilb(x[i]); |
| 481 | sofarAfterLB.includeI(home,xilb); |
| 482 | } |
| 483 | sofarAfterLB.dispose(home); |
| 484 | } |
| 485 | |
| 486 | { |
| 487 | GLBndSet sofarBeforeLB; |
| 488 | sofarBeforeLB.update(home,unionOfDets); |
| 489 | for (int i=0; i<xsize; i++) { |
| 490 | LubRanges<View1> yub(y); |
| 491 | BndSetRanges slb(sofarBeforeLB); |
| 492 | BndSetRanges afterlb(afterLB[i]); |
| 493 | Iter::Ranges::Union<BndSetRanges, |
| 494 | BndSetRanges> xjlb(slb, afterlb); |
| 495 | Iter::Ranges::Diff<LubRanges<View1>, |
| 496 | Iter::Ranges::Union<BndSetRanges, |
| 497 | BndSetRanges> > diff1(yub, xjlb); |
| 498 | GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home,diff1)); |
| 499 | |
| 500 | GlbRanges<View0> xilb(x[i]); |
| 501 | sofarBeforeLB.includeI(home,xilb); |
| 502 | } |
| 503 | sofarBeforeLB.dispose(home); |
| 504 | } |
| 505 | for (int i=xsize; i--;) |
| 506 | afterLB[i].dispose(home); |
| 507 | return ES_NOFIX; |
| 508 | } |
| 509 | |
| 510 | // Xi LB includes YLB minus union Xj UB |
| 511 | template<class View0, class View1> |