%Test whether \a x is solution
| 189 | , is(iss[intSet]), sot(sot0), srt(srt0) {} |
| 190 | /// %Test whether \a x is solution |
| 191 | bool solution(const SetAssignment& x) const { |
| 192 | CountableSetRanges xr0(x.lub, x[0]); |
| 193 | CountableSetRanges xr1(x.lub, x[1]); |
| 194 | IntSetRanges isr(is); |
| 195 | switch (sot) { |
| 196 | case SOT_UNION: |
| 197 | { |
| 198 | Iter::Ranges::Union<CountableSetRanges, CountableSetRanges> |
| 199 | u(xr0, xr1); |
| 200 | return sol(u,isr); |
| 201 | } |
| 202 | break; |
| 203 | case SOT_DUNION: |
| 204 | { |
| 205 | Iter::Ranges::Inter<CountableSetRanges, CountableSetRanges> |
| 206 | inter(xr0, xr1); |
| 207 | if (inter()) |
| 208 | return false; |
| 209 | Iter::Ranges::Union<CountableSetRanges, CountableSetRanges> |
| 210 | u(xr0, xr1); |
| 211 | return sol(u,isr); |
| 212 | } |
| 213 | break; |
| 214 | case SOT_INTER: |
| 215 | { |
| 216 | Iter::Ranges::Inter<CountableSetRanges, CountableSetRanges> |
| 217 | u(xr0,xr1); |
| 218 | return sol(u,isr); |
| 219 | } |
| 220 | break; |
| 221 | case SOT_MINUS: |
| 222 | { |
| 223 | Iter::Ranges::Diff<CountableSetRanges, CountableSetRanges> |
| 224 | u(xr0,xr1); |
| 225 | return sol(u,isr); |
| 226 | } |
| 227 | break; |
| 228 | default: GECODE_NEVER; |
| 229 | } |
| 230 | GECODE_NEVER; |
| 231 | return false; |
| 232 | } |
| 233 | /// Post constraint on \a x |
| 234 | void post(Space& home, SetVarArray& x, IntVarArray&) { |
| 235 | Gecode::rel(home, x[0], sot, x[1], srt, is); |