%Test whether \a x is solution
| 353 | } |
| 354 | /// %Test whether \a x is solution |
| 355 | virtual bool solution(const SetAssignment& x) const { |
| 356 | // Get integer assignment |
| 357 | const Int::Assignment& y = x.ints(); |
| 358 | // x-coordinate: y[0], y-coordinate: y[1], result: x[0] |
| 359 | using namespace Gecode; |
| 360 | if ((y[0] > 1) || (y[1] > 1)) |
| 361 | return false; |
| 362 | Matrix<IntSetArgs> m(tm,2,2); |
| 363 | IntSetRanges a(m(y[0],y[1])); |
| 364 | CountableSetRanges b(x.lub, x[0]); |
| 365 | return Iter::Ranges::equal(a,b); |
| 366 | } |
| 367 | /// Post constraint on \a x and \a y |
| 368 | virtual void post(Gecode::Space& home, Gecode::SetVarArray& x, |
| 369 | Gecode::IntVarArray& y) { |