%Test whether \a x is solution
| 323 | tm({0,1,2,3}) {} |
| 324 | /// %Test whether \a x is solution |
| 325 | virtual bool solution(const Assignment& x) const { |
| 326 | // x-coordinate: x[0], y-coordinate: x[0], result: x[1] |
| 327 | using namespace Gecode; |
| 328 | if (x[0] > 1) |
| 329 | return false; |
| 330 | Matrix<IntArgs> m(tm,2,2); |
| 331 | return m(x[0],x[0]) == x[1]; |
| 332 | } |
| 333 | /// Post constraint on \a x |
| 334 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 335 | // x-coordinate: x[0], y-coordinate: x[0], result: x[1] |