| 67 | |
| 68 | template<class Box> |
| 69 | ExecStatus |
| 70 | ManProp<Box>::propagate(Space& home, const ModEventDelta&) { |
| 71 | Region r; |
| 72 | |
| 73 | // Number of disjoint boxes |
| 74 | int* db = r.alloc<int>(n); |
| 75 | for (int i=0; i<n; i++) |
| 76 | db[i] = n-1; |
| 77 | |
| 78 | // Number of boxes to be eliminated |
| 79 | int e = 0; |
| 80 | |
| 81 | for (int i=0; i<n; i++) |
| 82 | for (int j=0; j<i; j++) |
| 83 | if (b[i].nooverlap(b[j])) { |
| 84 | assert(db[i] > 0); assert(db[j] > 0); |
| 85 | if (--db[i] == 0) e++; |
| 86 | if (--db[j] == 0) e++; |
| 87 | continue; |
| 88 | } else { |
| 89 | GECODE_ES_CHECK(b[i].nooverlap(home,b[j])); |
| 90 | } |
| 91 | |
| 92 | if (e == n) |
| 93 | return home.ES_SUBSUMED(*this); |
| 94 | |
| 95 | { |
| 96 | int i = n-1; |
| 97 | while (e > 0) { |
| 98 | // Eliminate boxes that do not overlap |
| 99 | while (db[i] > 0) |
| 100 | i--; |
| 101 | b[i].cancel(home, *this); |
| 102 | b[i] = b[--n]; |
| 103 | e--; i--; |
| 104 | } |
| 105 | if (n < 2) |
| 106 | return home.ES_SUBSUMED(*this); |
| 107 | } |
| 108 | |
| 109 | return ES_NOFIX; |
| 110 | } |
| 111 | |
| 112 | }}} |
| 113 |
nothing calls this directly
no test coverage detected