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

Method solution

test/set/precede.cpp:104–113  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

102 : SetTest("Precede::Multi::"+str(c0),4,ds,false), c(c0) {}
103 /// %Test whether \a x is solution
104 virtual bool solution(const SetAssignment& x) const {
105 for (int j=0; j<c.size()-1; j++)
106 for (int i=0; i<x.size(); i++) {
107 if (!in(c[j],x[i]) && in(c[j+1],x[i]))
108 return false;
109 if (in(c[j],x[i]) && !in(c[j+1],x[i]))
110 break;
111 }
112 return true;
113 }
114 /// Post constraint on \a x
115 virtual void post(Gecode::Space& home, Gecode::SetVarArray& x,
116 Gecode::IntVarArray&) {

Callers

nothing calls this directly

Calls 2

inFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected