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

Method solution

test/int/element.cpp:405–415  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

403 : Test("Element::Matrix::IntVar::IntVar::XY",3+4,0,3,false) {}
404 /// %Test whether \a x is solution
405 virtual bool solution(const Assignment& x) const {
406 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
407 // remaining: matrix
408 using namespace Gecode;
409 if ((x[0] > 1) || (x[1] > 1))
410 return false;
411 IntArgs tm(4);
412 tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
413 Matrix<IntArgs> m(tm,2,2);
414 return m(x[0],x[1]) == x[2];
415 }
416 /// Post constraint on \a x
417 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
418 // 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