%Test whether \a x is solution
| 461 | : Test("Element::Matrix::BoolVar::BoolVar::XY",3+4,0,1,false) {} |
| 462 | /// %Test whether \a x is solution |
| 463 | virtual bool solution(const Assignment& x) const { |
| 464 | // x-coordinate: x[0], y-coordinate: x[1], result: x[2] |
| 465 | // remaining: matrix |
| 466 | using namespace Gecode; |
| 467 | IntArgs tm(4); |
| 468 | tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6]; |
| 469 | Matrix<IntArgs> m(tm,2,2); |
| 470 | return m(x[0],x[1]) == x[2]; |
| 471 | } |
| 472 | /// Post constraint on \a x |
| 473 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 474 | // x-coordinate: x[0], y-coordinate: x[1], result: x[2] |