%Test whether \a x is solution
| 68 | : SetTest(t,1,ds_33,true,1) {} |
| 69 | /// %Test whether \a x is solution |
| 70 | virtual bool solution(const SetAssignment& x) const { |
| 71 | unsigned int s = 0; |
| 72 | for (CountableSetRanges xr(x.lub, x[0]);xr();++xr) s+= xr.width(); |
| 73 | if (x.intval() < 0) |
| 74 | return false; |
| 75 | return s==(unsigned int)x.intval(); |
| 76 | } |
| 77 | /// Post constraint on \a x |
| 78 | virtual void post(Space& home, SetVarArray& x, IntVarArray& y) { |
| 79 | Gecode::cardinality(home, x[0], y[0]); |