%Test whether \a x is solution
| 197 | : SetTest(t,5,ds_12,false) {} |
| 198 | /// %Test whether \a x is solution |
| 199 | virtual bool solution(const SetAssignment& x) const { |
| 200 | int selected = 0; |
| 201 | for (CountableSetValues sel2(x.lub, x[3]); sel2(); |
| 202 | ++sel2, selected++) {} |
| 203 | CountableSetRanges x4r(x.lub, x[4]); |
| 204 | if (selected==0) |
| 205 | return Iter::Ranges::size(x4r)==4; |
| 206 | CountableSetRanges* sel = new CountableSetRanges[selected]; |
| 207 | CountableSetValues selector(x.lub, x[3]); |
| 208 | for (int i=selected; i--;++selector) { |
| 209 | if (selector.val()>=3 || selector.val()<0) { |
| 210 | delete[] sel; |
| 211 | return false; |
| 212 | } |
| 213 | sel[i].init(x.lub, x[selector.val()]); |
| 214 | } |
| 215 | bool ret; |
| 216 | { |
| 217 | Region r; |
| 218 | Iter::Ranges::NaryInter u(r,sel, selected); |
| 219 | |
| 220 | CountableSetRanges z(x.lub, x[4]); |
| 221 | ret = Iter::Ranges::equal(u, z); |
| 222 | } |
| 223 | delete [] sel; |
| 224 | return ret; |
| 225 | } |
| 226 | /// Post constraint on \a x |
| 227 | virtual void post(Space& home, SetVarArray& x, IntVarArray&) { |
| 228 | SetVarArgs xs(x.size()-2); |