%Test whether \a x is solution
| 408 | : Test("Arithmetic::DivMod::"+s,4,d) {} |
| 409 | /// %Test whether \a x is solution |
| 410 | virtual bool solution(const Assignment& x) const { |
| 411 | return x[0] == x[1]*x[2]+x[3] && |
| 412 | abs(x[3]) < abs(x[1]) && |
| 413 | (x[3] == 0 || sgn(x[3]) == sgn(x[0])); |
| 414 | } |
| 415 | /// Post constraint on \a x |
| 416 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 417 | Gecode::divmod(home, x[0], x[1], x[2], x[3]); |