%Test whether \a x is solution
| 379 | tm({0,1,1,0}) {} |
| 380 | /// %Test whether \a x is solution |
| 381 | virtual bool solution(const Assignment& x) const { |
| 382 | // x-coordinate: x[0], y-coordinate: x[0], result: x[1] |
| 383 | using namespace Gecode; |
| 384 | if (x[0] > 1) |
| 385 | return false; |
| 386 | Matrix<IntArgs> m(tm,2,2); |
| 387 | return m(x[0],x[0]) == x[1]; |
| 388 | } |
| 389 | /// Post constraint on \a x |
| 390 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 391 | // x-coordinate: x[0], y-coordinate: x[0], result: x[1] |