%Test whether \a x is solution
| 351 | tm({0,1,1,0}) {} |
| 352 | /// %Test whether \a x is solution |
| 353 | virtual bool solution(const Assignment& x) const { |
| 354 | // x-coordinate: x[0], y-coordinate: x[1], result: x[2] |
| 355 | using namespace Gecode; |
| 356 | if ((x[0] > 1) || (x[1] > 1)) |
| 357 | return false; |
| 358 | Matrix<IntArgs> m(tm,2,2); |
| 359 | return m(x[0],x[1]) == x[2]; |
| 360 | } |
| 361 | /// Post constraint on \a x |
| 362 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 363 | // x-coordinate: x[0], y-coordinate: x[1], result: x[2] |