%Test whether \a x is solution
| 82 | } |
| 83 | /// %Test whether \a x is solution |
| 84 | bool solution(const SetAssignment& x) const { |
| 85 | int x1 = shared ? x[0] : x[1]; |
| 86 | CountableSetRanges xr0(x.lub, x[0]); |
| 87 | CountableSetRanges xr1(x.lub, x1); |
| 88 | switch (srt) { |
| 89 | case SRT_EQ: return Iter::Ranges::equal(xr0, xr1); |
| 90 | case SRT_NQ: return !Iter::Ranges::equal(xr0, xr1); |
| 91 | |
| 92 | case SRT_LQ: return (!xr0()) || in(minSymDiff(x),xr1,true); |
| 93 | case SRT_LE: return xr0() ? in(minSymDiff(x),xr1) : xr1(); |
| 94 | case SRT_GQ: return (!xr1()) || in(minSymDiff(x),xr0,true); |
| 95 | case SRT_GR: return xr1() ? in(minSymDiff(x),xr0) : xr0(); |
| 96 | |
| 97 | case SRT_SUB: return Iter::Ranges::subset(xr0, xr1); |
| 98 | case SRT_SUP: return Iter::Ranges::subset(xr1, xr0); |
| 99 | case SRT_DISJ: |
| 100 | { |
| 101 | Iter::Ranges::Inter<CountableSetRanges,CountableSetRanges> |
| 102 | inter(xr0,xr1); |
| 103 | return !inter(); |
| 104 | } |
| 105 | case SRT_CMPL: |
| 106 | { |
| 107 | Gecode::Set::RangesCompl<CountableSetRanges> rc(xr0); |
| 108 | return Iter::Ranges::equal(rc,xr1); |
| 109 | } |
| 110 | default: |
| 111 | GECODE_NEVER; |
| 112 | } |
| 113 | GECODE_NEVER; |
| 114 | return false; |
| 115 | } |
| 116 | /// Post constraint on \a x |
| 117 | void post(Space& home, SetVarArray& x, IntVarArray&) { |
| 118 | if (!shared) |
nothing calls this directly
no test coverage detected