| 125 | // Propagate domain information from x to y |
| 126 | template<class View, class Offset> |
| 127 | ExecStatus |
| 128 | prop_dom(Space& home, int n, DomInfo<View,Offset>* x, Offset& ox, |
| 129 | DomInfo<View,Offset>* y, Offset& oy, ProcessStack& ya) { |
| 130 | for (int i=0; i<n; i++) |
| 131 | // Only views with not yet propagated missing values |
| 132 | if (x[i].dodom()) { |
| 133 | // Iterate the values in the complement of x[i] |
| 134 | ViewRanges<typename Offset::ViewType> |
| 135 | xir(ox(x[i].view)); |
| 136 | Iter::Ranges::ComplVal<ViewRanges<typename Offset::ViewType> > |
| 137 | xirc(x[i].min,x[i].max,xir); |
| 138 | Iter::Ranges::ToValues<Iter::Ranges::ComplVal< |
| 139 | ViewRanges<typename Offset::ViewType> > > jv(xirc); |
| 140 | while (jv()) { |
| 141 | // j is not in the domain of x[i], so prune i from y[j] |
| 142 | int j = jv.val(); |
| 143 | ModEvent me = oy(y[j].view).nq(home,i); |
| 144 | if (me_failed(me)) |
| 145 | return ES_FAILED; |
| 146 | if (me_modified(me)) { |
| 147 | if (me == ME_INT_VAL) { |
| 148 | // Record that y[j] has been assigned and must be propagated |
| 149 | ya.push(j); |
| 150 | } else { |
| 151 | // Obvious as x[i] is different from j |
| 152 | y[j].removed(i); |
| 153 | } |
| 154 | } |
| 155 | ++jv; |
| 156 | } |
| 157 | // Update which values have been propagated and what are the new bounds |
| 158 | x[i].done(ox); |
| 159 | } |
| 160 | return ES_OK; |
| 161 | } |
| 162 | |
| 163 | /* |
| 164 | * The actual propagator |