| 128 | |
| 129 | template<class VX> |
| 130 | ExecStatus |
| 131 | GqBoolInt<VX>::advise(Space& home, Advisor& a, const Delta& d) { |
| 132 | // Check whether propagator is running |
| 133 | if (n_as == 0) |
| 134 | return ES_FIX; |
| 135 | |
| 136 | if (VX::one(d)) { |
| 137 | c--; goto check; |
| 138 | } |
| 139 | if (c+1 < n_as) |
| 140 | goto check; |
| 141 | // Find a new subscription |
| 142 | for (int i = x.size()-1; i>=n_hs; i--) |
| 143 | if (x[i].none()) { |
| 144 | std::swap(x[i],x[n_hs]); |
| 145 | x[n_hs++].subscribe(home,a); |
| 146 | x.size(i+1); |
| 147 | return ES_FIX; |
| 148 | } else if (x[i].one()) { |
| 149 | c--; |
| 150 | if (c+1 < n_as) { |
| 151 | x.size(i); |
| 152 | assert(n_hs <= x.size()); |
| 153 | goto check; |
| 154 | } |
| 155 | } |
| 156 | // No view left for subscription |
| 157 | x.size(n_hs); |
| 158 | check: |
| 159 | // Do not update subscription |
| 160 | n_as--; |
| 161 | int n = x.size()-n_hs+n_as; |
| 162 | if ((n < c) && !disabled()) |
| 163 | return ES_FAILED; |
| 164 | if ((c <= 0) || (c == n)) |
| 165 | return ES_NOFIX; |
| 166 | else |
| 167 | return ES_FIX; |
| 168 | } |
| 169 | |
| 170 | template<class VX> |
| 171 | void |