%Test whether \a x is solution
| 527 | } |
| 528 | /// %Test whether \a x is solution |
| 529 | virtual bool solution(const Assignment& x) const { |
| 530 | using namespace Gecode; |
| 531 | for (int i = 0; i < t.tuples(); ++i) { |
| 532 | TupleSet::Tuple l = t[i]; |
| 533 | bool same = true; |
| 534 | for (int j = 0; j < t.arity() && same; ++j) |
| 535 | if (l[j] != x[j]) same = false; |
| 536 | if (same) |
| 537 | return pos; |
| 538 | } |
| 539 | return !pos; |
| 540 | } |
| 541 | /// Post constraint on \a x |
| 542 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 543 | using namespace Gecode; |