Post constraint on \a x
| 171 | } |
| 172 | /// Post constraint on \a x |
| 173 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 174 | Gecode::IntVarArgs s(x.size()/2); |
| 175 | Gecode::IntVarArgs px(x.slice(x.size()/2)); |
| 176 | Gecode::IntVarArgs e(home,x.size()/2, |
| 177 | Gecode::Int::Limits::min, |
| 178 | Gecode::Int::Limits::max); |
| 179 | for (int i=s.size(); i--;) { |
| 180 | s[i] = expr(home, off+x[i]); |
| 181 | rel(home, s[i]+px[i] == e[i]); |
| 182 | rel(home, _minP <= px[i]); |
| 183 | rel(home, _maxP >= px[i]); |
| 184 | } |
| 185 | Gecode::unary(home, s, px, e, ipl); |
| 186 | } |
| 187 | }; |
| 188 | |
| 189 | /// %Test for unary constraint with optional tasks |