%Test whether \a x is solution
| 219 | bis0(bis00), bis1(bis10), srt(srt0) {} |
| 220 | /// %Test whether \a x is solution |
| 221 | virtual bool solution(const Assignment& x) const { |
| 222 | int reg0[4] = {(x[0] != x[2]), x[1], |
| 223 | (x[2] > 0), x[3]}; |
| 224 | bool failed0; |
| 225 | int ret0 = eval(bis0, reg0, failed0); |
| 226 | if (failed0) |
| 227 | return false; |
| 228 | |
| 229 | int reg1[4] = {(x[4] != x[6]), x[5], |
| 230 | (x[6] > 0), x[7]}; |
| 231 | bool failed1; |
| 232 | int ret1 = eval(bis1, reg1, failed1); |
| 233 | |
| 234 | if (failed1) |
| 235 | return false; |
| 236 | |
| 237 | switch (srt) { |
| 238 | case Gecode::SRT_EQ: return ret0 == ret1; |
| 239 | case Gecode::SRT_NQ: return ret0 != ret1; |
| 240 | case Gecode::SRT_SUB: return ret0 <= ret1; |
| 241 | case Gecode::SRT_SUP: return ret0 >= ret1; |
| 242 | case Gecode::SRT_DISJ: return ret0+ret1 != 2; |
| 243 | case Gecode::SRT_CMPL: return ret0 != ret1; |
| 244 | default: GECODE_NEVER; |
| 245 | } |
| 246 | GECODE_NEVER; |
| 247 | return false; |
| 248 | } |
| 249 | /// Post constraint on \a x |
| 250 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 251 | using namespace Gecode; |