%Test whether \a x is solution
| 351 | 2,d,false,ipl), n(n0) {} |
| 352 | /// %Test whether \a x is solution |
| 353 | virtual bool solution(const Assignment& x) const { |
| 354 | if (n == 1) |
| 355 | return x[0] == x[1]; |
| 356 | if ((n % 2 == 0) && ((x[0] < 0) || (x[1] < 0))) |
| 357 | return false; |
| 358 | int r = (x[0] < 0) ? -cnroot(n,-x[0]) : fnroot(n,x[0]); |
| 359 | return r == x[1]; |
| 360 | } |
| 361 | /// Post constraint on \a x |
| 362 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 363 | using namespace Gecode; |