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

Method solution

test/set/int.cpp:70–76  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

68 : SetTest(t,1,ds_33,true,1) {}
69 /// %Test whether \a x is solution
70 virtual bool solution(const SetAssignment& x) const {
71 unsigned int s = 0;
72 for (CountableSetRanges xr(x.lub, x[0]);xr();++xr) s+= xr.width();
73 if (x.intval() < 0)
74 return false;
75 return s==(unsigned int)x.intval();
76 }
77 /// Post constraint on \a x
78 virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
79 Gecode::cardinality(home, x[0], y[0]);

Callers

nothing calls this directly

Calls 2

intvalMethod · 0.80
widthMethod · 0.45

Tested by

no test coverage detected