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

Method solution

test/int/bool.cpp:314–325  ·  view source on GitHub ↗

Check whether \a x is solution

Source from the content-addressed store, hash-verified

312 : Test("Bool::Clause::XYZ::"+str(op0)+"::"+str(n),n+1,0,1), op(op0) {}
313 /// Check whether \a x is solution
314 virtual bool solution(const Assignment& x) const {
315 int n = (x.size()-1) / 2;
316 int b;
317 if (n == 1) {
318 b = check(x[0],op,!x[1]);
319 } else {
320 b = check(x[0],op,!x[n]);
321 for (int i=1; i<n; i++)
322 b = check(b,op,check(x[i],op,!x[n+i]));
323 }
324 return b == x[x.size()-1];
325 }
326 /// Post constraint
327 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
328 using namespace Gecode;

Callers

nothing calls this directly

Calls 2

checkFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected