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

Method solution

test/int/bool.cpp:225–231  ·  view source on GitHub ↗

Check whether \a x is solution

Source from the content-addressed store, hash-verified

223 : Test("Bool::Nary::"+str(op0)+"::"+str(n),n+1,0,1), op(op0) {}
224 /// Check whether \a x is solution
225 virtual bool solution(const Assignment& x) const {
226 int n = x.size()-1;
227 int b = check(x[n-2],op,x[n-1]);
228 for (int i=0; i<n-2; i++)
229 b = check(x[i],op,b);
230 return b == x[n];
231 }
232 /// Post constraint
233 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
234 using namespace Gecode;

Callers

nothing calls this directly

Calls 2

checkFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected