%Test whether \a x is solution
| 57 | : SetTest(t,3,ds_33,false) {} |
| 58 | /// %Test whether \a x is solution |
| 59 | virtual bool solution(const SetAssignment& x) const { |
| 60 | { |
| 61 | CountableSetRanges xr0(x.lub, x[0]); |
| 62 | CountableSetRanges xr1(x.lub, x[1]); |
| 63 | Iter::Ranges::Inter<CountableSetRanges,CountableSetRanges> |
| 64 | i(xr0,xr1); |
| 65 | if (Iter::Ranges::size(i)>1) |
| 66 | return false; |
| 67 | } |
| 68 | { |
| 69 | CountableSetRanges xr0(x.lub, x[0]); |
| 70 | CountableSetRanges xr2(x.lub, x[2]); |
| 71 | Iter::Ranges::Inter<CountableSetRanges,CountableSetRanges> |
| 72 | i(xr0,xr2); |
| 73 | if (Iter::Ranges::size(i)>1) |
| 74 | return false; |
| 75 | } |
| 76 | { |
| 77 | CountableSetRanges xr1(x.lub, x[1]); |
| 78 | CountableSetRanges xr2(x.lub, x[2]); |
| 79 | Iter::Ranges::Inter<CountableSetRanges,CountableSetRanges> |
| 80 | i(xr1,xr2); |
| 81 | if (Iter::Ranges::size(i)>1) |
| 82 | return false; |
| 83 | } |
| 84 | { |
| 85 | CountableSetRanges xr0(x.lub, x[0]); |
| 86 | CountableSetRanges xr1(x.lub, x[1]); |
| 87 | CountableSetRanges xr2(x.lub, x[2]); |
| 88 | if (Iter::Ranges::size(xr0)!=3 || |
| 89 | Iter::Ranges::size(xr1)!=3 || |
| 90 | Iter::Ranges::size(xr2)!=3) |
| 91 | return false; |
| 92 | } |
| 93 | return true; |
| 94 | } |
| 95 | /// Post constraint on \a x |
| 96 | virtual void post(Space& home, SetVarArray& x, IntVarArray&) { |
| 97 | SetVar s1(home, IntSet::empty, -2, 2, 0U, 1U); |