| 40 | : TernaryPropagator<IntView,PC_INT_DOM>(home,x0,x1,x2), w(w0) {} |
| 41 | |
| 42 | inline ExecStatus |
| 43 | Pair::post(Home home, IntView x0, IntView x1, IntView x2, |
| 44 | int w, int h) { |
| 45 | GECODE_ME_CHECK(x0.gq(home,0)); GECODE_ME_CHECK(x0.le(home,w)); |
| 46 | GECODE_ME_CHECK(x1.gq(home,0)); GECODE_ME_CHECK(x1.le(home,h)); |
| 47 | GECODE_ME_CHECK(x2.gq(home,0)); GECODE_ME_CHECK(x2.le(home,w*h)); |
| 48 | if (x0.assigned() && x1.assigned()) { |
| 49 | GECODE_ME_CHECK(x2.eq(home,x0.val()+w*x1.val())); |
| 50 | } else if (x1.assigned()) { |
| 51 | OffsetView x0x1w(x0,x1.val()*w); |
| 52 | return Rel::EqDom<OffsetView,IntView>::post(home,x0x1w,x2); |
| 53 | } else if (x2.assigned()) { |
| 54 | GECODE_ME_CHECK(x0.eq(home,x2.val() % w)); |
| 55 | GECODE_ME_CHECK(x1.eq(home,static_cast<int>(x2.val() / w))); |
| 56 | } else { |
| 57 | assert(!shared(x0,x2) && !shared(x1,x2)); |
| 58 | (void) new (home) Pair(home,x0,x1,x2,w); |
| 59 | } |
| 60 | return ES_OK; |
| 61 | } |
| 62 | |
| 63 | forceinline |
| 64 | Pair::Pair(Space& home, Pair& p) |