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

Method solution

test/int/element.cpp:434–444  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

432 : Test("Element::Matrix::IntVar::IntVar::XX",2+4,0,3,false) {}
433 /// %Test whether \a x is solution
434 virtual bool solution(const Assignment& x) const {
435 // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
436 // remaining: matrix
437 using namespace Gecode;
438 if (x[0] > 1)
439 return false;
440 IntArgs tm(4);
441 tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
442 Matrix<IntArgs> m(tm,2,2);
443 return m(x[0],x[0]) == x[1];
444 }
445 /// Post constraint on \a x
446 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
447 // x-coordinate: x[0], y-coordinate: x[1], result: x[1]

Callers

nothing calls this directly

Calls 1

mFunction · 0.85

Tested by

no test coverage detected