%Test whether \a x is solution
| 295 | tm({0,1,2,3,4,5}) {} |
| 296 | /// %Test whether \a x is solution |
| 297 | virtual bool solution(const Assignment& x) const { |
| 298 | // x-coordinate: x[0], y-coordinate: x[1], result: x[2] |
| 299 | using namespace Gecode; |
| 300 | if ((x[0] > 2) || (x[1] > 1)) |
| 301 | return false; |
| 302 | Matrix<IntArgs> m(tm,3,2); |
| 303 | return m(x[0],x[1]) == x[2]; |
| 304 | } |
| 305 | /// Post constraint on \a x |
| 306 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 307 | // x-coordinate: x[0], y-coordinate: x[1], result: x[2] |