MCPcopy Create free account
hub / github.com/Gecode/gecode / solution

Method solution

test/int/arithmetic.cpp:353–360  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 2

cnrootFunction · 0.85
fnrootFunction · 0.85

Tested by

no test coverage detected