| 388 | |
| 389 | template<class Val, class View> |
| 390 | ExecStatus |
| 391 | DomEq<Val,View>::propagate(Space& home, const ModEventDelta& med) { |
| 392 | if (View::me(med) != ME_INT_DOM) { |
| 393 | ExecStatus es = prop_bnd<Val,View,View>(home,med,*this,x,y,c); |
| 394 | GECODE_ES_CHECK(es); |
| 395 | return home.ES_FIX_PARTIAL(*this,View::med(ME_INT_DOM)); |
| 396 | } |
| 397 | |
| 398 | // Value of equation for partial assignment |
| 399 | Val d = -c; |
| 400 | |
| 401 | int n = x.size(); |
| 402 | int m = y.size(); |
| 403 | |
| 404 | Region r; |
| 405 | // Create support-base iterators |
| 406 | PosSupportIter<Val>* xp = r.alloc<PosSupportIter<Val> >(n); |
| 407 | NegSupportIter<Val>* yp = r.alloc<NegSupportIter<Val> >(m); |
| 408 | |
| 409 | // Initialize views for assignments |
| 410 | { |
| 411 | Val l = 0; |
| 412 | Val u = 0; |
| 413 | for (int j=m; j--; ) { |
| 414 | yp[j].init(r,-y[j].scale(),y[j].base(),l,u); |
| 415 | l += y[j].max(); u += y[j].min(); |
| 416 | } |
| 417 | for (int i=n; i--; ) { |
| 418 | xp[i].init(r,x[i].scale(),x[i].base(),l,u); |
| 419 | l -= x[i].min(); u -= x[i].max(); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | // Collect support information by iterating assignments |
| 424 | { |
| 425 | // Force reset of all iterators in first round |
| 426 | int i = 0; |
| 427 | int j = 0; |
| 428 | |
| 429 | next_i: |
| 430 | // Reset all iterators for positive views and update d |
| 431 | while (i<n) { |
| 432 | if (!xp[i].reset(d)) goto prev_i; |
| 433 | i++; |
| 434 | } |
| 435 | next_j: |
| 436 | // Reset all iterators for negative views and update d |
| 437 | while (j<m) { |
| 438 | if (!yp[j].reset(d)) goto prev_j; |
| 439 | j++; |
| 440 | } |
| 441 | // Check whether current assignment is solution |
| 442 | if (d == 0) { |
| 443 | // Record support |
| 444 | for (int is=0; is<n; is++) xp[is].support(); |
| 445 | for (int js=0; js<m; js++) yp[js].support(); |
| 446 | } |
| 447 | prev_j: |
nothing calls this directly
no test coverage detected