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

Method solution

test/set/channel.cpp:184–202  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

182 : SetTest(t,x0size+x1size,d,false), _x0size(x0size), _x1size(x1size) {}
183 /// %Test whether \a x is solution
184 virtual bool solution(const SetAssignment& x) const {
185 for (int i=0; i<_x0size; i++) {
186 CountableSetRanges x0ir(x.lub, x[i]);
187 IntSet x0is(x0ir);
188 if (x0is.min() < 0 || x0is.max() >= _x1size)
189 return false;
190 for (int j=0; j<_x1size; j++) {
191 CountableSetRanges x1ir(x.lub, x[_x0size+j]);
192 IntSet x1is(x1ir);
193 if (x1is.min() < 0 || x1is.max() >= _x0size)
194 return false;
195 bool jInI = x0is.in(j);
196 bool iInJ = x1is.in(i);
197 if (jInI != iInJ)
198 return false;
199 }
200 }
201 return true;
202 }
203 /// Post constraint on \a x
204 virtual void post(Space& home, SetVarArray& x, IntVarArray&) {
205 SetVarArgs x0(x.slice(0,1,_x0size));

Callers

nothing calls this directly

Calls 3

minMethod · 0.45
maxMethod · 0.45
inMethod · 0.45

Tested by

no test coverage detected