| 74 | |
| 75 | template<class OptTask, class PL> |
| 76 | ExecStatus |
| 77 | OptProp<OptTask,PL>::propagate(Space& home, const ModEventDelta& med) { |
| 78 | // Did one of the Boolean views change? |
| 79 | if (BoolView::me(med) == ME_BOOL_VAL) |
| 80 | GECODE_ES_CHECK((purge<OptTask,PL>(home,*this,t))); |
| 81 | |
| 82 | GECODE_ES_CHECK((overload<OptTask,PL>(home,*this,t))); |
| 83 | |
| 84 | if (PL::basic) |
| 85 | GECODE_ES_CHECK(timetabling(home,*this,t)); |
| 86 | |
| 87 | if (PL::advanced) { |
| 88 | GECODE_ES_CHECK((detectable<OptTask,PL>(home,*this,t))); |
| 89 | GECODE_ES_CHECK((notfirstnotlast<OptTask,PL>(home,*this,t))); |
| 90 | |
| 91 | // Partition into mandatory and optional activities |
| 92 | int n = t.size(); |
| 93 | int i=0, j=n-1; |
| 94 | while (true) { |
| 95 | while ((i < n) && t[i].mandatory()) i++; |
| 96 | while ((j >= 0) && !t[j].mandatory()) j--; |
| 97 | if (i >= j) break; |
| 98 | std::swap(t[i],t[j]); |
| 99 | } |
| 100 | |
| 101 | if (i > 1) { |
| 102 | // Truncate array to only contain mandatory tasks |
| 103 | t.size(i); |
| 104 | GECODE_ES_CHECK(edgefinding(home,t)); |
| 105 | // Restore to also include optional tasks |
| 106 | t.size(n); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | if (!PL::basic) |
| 111 | GECODE_ES_CHECK(subsumed(home,*this,t)); |
| 112 | |
| 113 | return ES_NOFIX; |
| 114 | } |
| 115 | |
| 116 | }}} |
| 117 |
nothing calls this directly
no test coverage detected