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

Method solution

test/int/element.cpp:297–304  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

295 tm({0,1,2,3,4,5}) {}
296 /// %Test whether \a x is solution
297 virtual bool solution(const Assignment& x) const {
298 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
299 using namespace Gecode;
300 if ((x[0] > 2) || (x[1] > 1))
301 return false;
302 Matrix<IntArgs> m(tm,3,2);
303 return m(x[0],x[1]) == x[2];
304 }
305 /// Post constraint on \a x
306 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
307 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]

Callers

nothing calls this directly

Calls 1

mFunction · 0.85

Tested by

no test coverage detected