| 99 | |
| 100 | |
| 101 | ExecStatus |
| 102 | Pair::propagate(Space& home, const ModEventDelta&) { |
| 103 | Region r; |
| 104 | |
| 105 | if (x0.assigned()) { |
| 106 | // Bitset for supported div and mod values |
| 107 | Support::BitSet<Region> d(r,static_cast<unsigned int>((x2.max() / w)+1)); |
| 108 | for (ViewValues<IntView> i(x2); i(); ++i) { |
| 109 | d.set(static_cast<unsigned int>(i.val() / w)); |
| 110 | } |
| 111 | Iter::Values::BitSet<Support::BitSet<Region> > id(d,x1.min(),x1.max()); |
| 112 | GECODE_ME_CHECK(x1.inter_v(home,id,false)); |
| 113 | } else { |
| 114 | // Bitset for supported div and mod values |
| 115 | Support::BitSet<Region> |
| 116 | d(r,static_cast<unsigned int>((x2.max() / w)+1)), |
| 117 | m(r,static_cast<unsigned int>(w)); |
| 118 | for (ViewValues<IntView> i(x2); i(); ++i) { |
| 119 | d.set(static_cast<unsigned int>(i.val() / w)); |
| 120 | m.set(static_cast<unsigned int>(i.val() % w)); |
| 121 | } |
| 122 | Iter::Values::BitSet<Support::BitSet<Region> > im(m,x0.min(),x0.max()); |
| 123 | GECODE_ME_CHECK(x0.inter_v(home,im,false)); |
| 124 | Iter::Values::BitSet<Support::BitSet<Region> > id(d,x1.min(),x1.max()); |
| 125 | GECODE_ME_CHECK(x1.inter_v(home,id,false)); |
| 126 | } |
| 127 | |
| 128 | if (x0.assigned() && x1.assigned()) { |
| 129 | GECODE_ME_CHECK(x2.eq(home,x0.val()+w*x1.val())); |
| 130 | return home.ES_SUBSUMED(*this); |
| 131 | } else if (x1.assigned()) { |
| 132 | OffsetView x0x1w(x0,x1.val()*w); |
| 133 | GECODE_REWRITE(*this,(Rel::EqDom<OffsetView,IntView> |
| 134 | ::post(home(*this),x0x1w,x2))); |
| 135 | } |
| 136 | |
| 137 | PairValues<IntView> xy(x0,x1,w); |
| 138 | GECODE_ME_CHECK(x2.inter_v(home,xy,false)); |
| 139 | |
| 140 | if (x2.assigned()) { |
| 141 | GECODE_ME_CHECK(x0.eq(home,x2.val() % w)); |
| 142 | GECODE_ME_CHECK(x1.eq(home,static_cast<int>(x2.val() / w))); |
| 143 | return home.ES_SUBSUMED(*this); |
| 144 | } |
| 145 | |
| 146 | return ES_NOFIX; |
| 147 | } |
| 148 | |
| 149 | Actor* |
| 150 | PairWithOffsets::copy(Space& home) { |