| 144 | |
| 145 | template<class P, class N> |
| 146 | ExecStatus |
| 147 | Eq<P,N>::propagate(Space& home, const ModEventDelta& med) { |
| 148 | // Eliminate singletons |
| 149 | Rounding r; |
| 150 | eliminate_p<P>(med, x, c); |
| 151 | eliminate_n<N>(med, y, c); |
| 152 | |
| 153 | if ((FloatView::me(med) == ME_FLOAT_VAL) && ((x.size() + y.size()) <= 1)) { |
| 154 | if (x.size() == 1) { |
| 155 | GECODE_ME_CHECK(x[0].eq(home,c)); |
| 156 | return home.ES_SUBSUMED(*this); |
| 157 | } |
| 158 | if (y.size() == 1) { |
| 159 | GECODE_ME_CHECK(y[0].eq(home,-c)); |
| 160 | return home.ES_SUBSUMED(*this); |
| 161 | } |
| 162 | return (c.in(0.0)) ? home.ES_SUBSUMED(*this) : ES_FAILED; |
| 163 | } |
| 164 | |
| 165 | ExecStatus es = ES_FIX; |
| 166 | bool assigned = true; |
| 167 | |
| 168 | // Propagate max bound for positive variables |
| 169 | for (int i = x.size(); i--; ) { |
| 170 | // Compute bound |
| 171 | FloatNum sl = c.max(); |
| 172 | for (int j = x.size(); j--; ) { |
| 173 | if (i == j) continue; |
| 174 | sl = r.sub_up(sl,x[j].min()); |
| 175 | } |
| 176 | for (int j = y.size(); j--; ) |
| 177 | sl = r.add_up(sl,y[j].max()); |
| 178 | ModEvent me = x[i].lq(home,sl); |
| 179 | if (me_failed(me)) |
| 180 | return ES_FAILED; |
| 181 | if (me != ME_FLOAT_VAL) |
| 182 | assigned = false; |
| 183 | if (me_modified(me)) |
| 184 | es = ES_NOFIX; |
| 185 | } |
| 186 | // Propagate min bound for negative variables |
| 187 | for (int i = y.size(); i--; ) { |
| 188 | // Compute bound |
| 189 | FloatNum sl = -c.max(); |
| 190 | for (int j = x.size(); j--; ) |
| 191 | sl = r.add_down(sl,x[j].min()); |
| 192 | for (int j = y.size(); j--; ) { |
| 193 | if (i == j) continue; |
| 194 | sl = r.sub_down(sl,y[j].max()); |
| 195 | } |
| 196 | ModEvent me = y[i].gq(home,sl); |
| 197 | if (me_failed(me)) |
| 198 | return ES_FAILED; |
| 199 | if (me != ME_FLOAT_VAL) |
| 200 | assigned = false; |
| 201 | if (me_modified(me)) |
| 202 | es = ES_NOFIX; |
| 203 | } |
nothing calls this directly
no test coverage detected