Check whether \a x is solution
| 348 | op(op0) {} |
| 349 | /// Check whether \a x is solution |
| 350 | virtual bool solution(const Assignment& x) const { |
| 351 | int n = x.size() / 2; |
| 352 | int b; |
| 353 | if (n == 1) { |
| 354 | b = check(x[0],op,!x[1]); |
| 355 | } else { |
| 356 | b = check(x[0],op,!x[n]); |
| 357 | for (int i=1; i<n; i++) |
| 358 | b = check(b,op,check(x[i],op,!x[n+i])); |
| 359 | } |
| 360 | return b == x[0]; |
| 361 | } |
| 362 | /// Post constraint |
| 363 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 364 | using namespace Gecode; |