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

Method solution

test/set/rel-op-const.cpp:282–329  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

280 , inverse(inverse0) {}
281 /// %Test whether \a x is solution
282 bool solution(const SetAssignment& x) const {
283 CountableSetRanges xr0(x.lub, x[0]);
284 IntSetRanges isr0(is0);
285 IntSetRanges isr1(is1);
286 switch (sot) {
287 case SOT_UNION:
288 {
289 Iter::Ranges::Union<IntSetRanges, CountableSetRanges>
290 u(isr0, xr0);
291 return sol(u,isr1);
292 }
293 break;
294 case SOT_DUNION:
295 {
296 Iter::Ranges::Inter<IntSetRanges, CountableSetRanges>
297 inter(isr0, xr0);
298 if (inter())
299 return false;
300 Iter::Ranges::Union<IntSetRanges, CountableSetRanges>
301 u(isr0, xr0);
302 return sol(u,isr1);
303 }
304 break;
305 case SOT_INTER:
306 {
307 Iter::Ranges::Inter<IntSetRanges, CountableSetRanges>
308 u(isr0,xr0);
309 return sol(u,isr1);
310 }
311 break;
312 case SOT_MINUS:
313 {
314 if (!inverse) {
315 Iter::Ranges::Diff<IntSetRanges, CountableSetRanges>
316 u(isr0,xr0);
317 return sol(u,isr1);
318 } else {
319 Iter::Ranges::Diff<CountableSetRanges, IntSetRanges>
320 u(xr0,isr0);
321 return sol(u,isr1);
322 }
323 }
324 break;
325 default: GECODE_NEVER;
326 }
327 GECODE_NEVER;
328 return false;
329 }
330 /// Post constraint on \a x
331 void post(Space& home, SetVarArray& x, IntVarArray&) {
332 if (!inverse)

Callers

nothing calls this directly

Calls 1

interFunction · 0.85

Tested by

no test coverage detected