Check whether \a x is solution
| 312 | : Test("Bool::Clause::XYZ::"+str(op0)+"::"+str(n),n+1,0,1), op(op0) {} |
| 313 | /// Check whether \a x is solution |
| 314 | virtual bool solution(const Assignment& x) const { |
| 315 | int n = (x.size()-1) / 2; |
| 316 | int b; |
| 317 | if (n == 1) { |
| 318 | b = check(x[0],op,!x[1]); |
| 319 | } else { |
| 320 | b = check(x[0],op,!x[n]); |
| 321 | for (int i=1; i<n; i++) |
| 322 | b = check(b,op,check(x[i],op,!x[n+i])); |
| 323 | } |
| 324 | return b == x[x.size()-1]; |
| 325 | } |
| 326 | /// Post constraint |
| 327 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 328 | using namespace Gecode; |