| 105 | |
| 106 | template<class View0, class View1, ReifyMode rm, bool strict> |
| 107 | ExecStatus |
| 108 | ReLq<View0,View1,rm,strict>::propagate(Space& home, const ModEventDelta&) { |
| 109 | if (b.one()) { |
| 110 | if (rm == RM_PMI) |
| 111 | return home.ES_SUBSUMED(*this); |
| 112 | GECODE_REWRITE(*this,(Lq<View0,View1,strict>::post(home(*this),x0,x1))); |
| 113 | } |
| 114 | if (b.zero()) { |
| 115 | if (rm == RM_IMP) |
| 116 | return home.ES_SUBSUMED(*this); |
| 117 | GECODE_REWRITE(*this, |
| 118 | (Lq<View1,View0,!strict>::post(home(*this),x1,x0))); |
| 119 | } |
| 120 | if (x0.cardMax() == 0) { |
| 121 | if ( (!strict) || x1.cardMin() > 0) { |
| 122 | if (rm != RM_IMP) |
| 123 | GECODE_ME_CHECK(b.one_none(home)); |
| 124 | return home.ES_SUBSUMED(*this); |
| 125 | } |
| 126 | if (strict && x1.cardMax() == 0) { |
| 127 | if (rm != RM_PMI) |
| 128 | GECODE_ME_CHECK(b.zero_none(home)); |
| 129 | return home.ES_SUBSUMED(*this); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | if (x0.assigned() && x1.assigned()) { |
| 134 | // directly test x0<=x1 |
| 135 | int min01; |
| 136 | { |
| 137 | GlbRanges<View0> x0l(x0); |
| 138 | GlbRanges<View1> x1l(x1); |
| 139 | Iter::Ranges::Diff<GlbRanges<View1>,GlbRanges<View0> > d(x1l,x0l); |
| 140 | if (!d()) { |
| 141 | if ((!strict) && x0.cardMax() == x1.cardMax()) { |
| 142 | // equal |
| 143 | if (rm != RM_IMP) |
| 144 | GECODE_ME_CHECK(b.one_none(home)); |
| 145 | } else { |
| 146 | // subset |
| 147 | if (rm != RM_PMI) |
| 148 | GECODE_ME_CHECK(b.zero_none(home)); |
| 149 | } |
| 150 | return home.ES_SUBSUMED(*this); |
| 151 | } |
| 152 | min01 = d.min(); |
| 153 | } |
| 154 | int min10; |
| 155 | { |
| 156 | GlbRanges<View0> x0l(x0); |
| 157 | GlbRanges<View1> x1l(x1); |
| 158 | Iter::Ranges::Diff<GlbRanges<View0>,GlbRanges<View1> > d(x0l,x1l); |
| 159 | if (!d()) { |
| 160 | if (strict && x0.cardMax() == x1.cardMax()) { |
| 161 | // equal |
| 162 | if (rm != RM_PMI) |
| 163 | GECODE_ME_CHECK(b.zero_none(home)); |
| 164 | } else { |