| 339 | |
| 340 | template<class View0, class View1, bool strict> |
| 341 | ExecStatus |
| 342 | Lq<View0,View1,strict>::propagate(Space& home, const ModEventDelta&) { |
| 343 | if ( (!strict) && x1.cardMax()==0) { |
| 344 | GECODE_ME_CHECK(x0.cardMax(home,0)); |
| 345 | } |
| 346 | |
| 347 | if (x0.cardMax()==0) { |
| 348 | return home.ES_SUBSUMED(*this); |
| 349 | } |
| 350 | |
| 351 | if (x0.glbMin() < x1.lubMin()) |
| 352 | return ES_FAILED; |
| 353 | if (x1.glbMin() < x0.lubMin()) |
| 354 | return home.ES_SUBSUMED(*this); |
| 355 | |
| 356 | bool assigned = x0.assigned() && x1.assigned(); |
| 357 | |
| 358 | Region re; |
| 359 | CharacteristicSets cs(re,x0,x1); |
| 360 | |
| 361 | /* |
| 362 | * State 1 |
| 363 | * |
| 364 | */ |
| 365 | unsigned int i=0; |
| 366 | unsigned int firsti=0; |
| 367 | unsigned int n=cs.size(); |
| 368 | while ((i<n) && (cs.xmin(i) == cs.ymax(i))) { |
| 369 | // case: =, >= |
| 370 | GECODE_ME_CHECK(cs.xlq(i,cs.ymax(i))); |
| 371 | GECODE_ME_CHECK(cs.ygq(i,cs.xmin(i))); |
| 372 | i++; |
| 373 | } |
| 374 | |
| 375 | if (i == n) {// case: $ |
| 376 | if (strict) { |
| 377 | return ES_FAILED; |
| 378 | } else { |
| 379 | GECODE_ES_CHECK(cs.prune(home,x0,x1)); |
| 380 | return home.ES_SUBSUMED(*this); |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | // Possible cases left: <, <=, > (yields failure), ? |
| 385 | GECODE_ME_CHECK(cs.xlq(i,cs.ymax(i))); |
| 386 | GECODE_ME_CHECK(cs.ygq(i,cs.xmin(i))); |
| 387 | |
| 388 | if (cs.xmax(i) < cs.ymin(i)) { // case: < (after tell) |
| 389 | GECODE_ES_CHECK(cs.prune(home,x0,x1)); |
| 390 | return home.ES_SUBSUMED(*this); |
| 391 | } |
| 392 | |
| 393 | firsti=i; |
| 394 | |
| 395 | /* |
| 396 | * State 2 |
| 397 | * prefix: (?|<=) |
| 398 | * |