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

Method solution

test/set/element.cpp:355–366  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

353 }
354 /// %Test whether \a x is solution
355 virtual bool solution(const SetAssignment& x) const {
356 // Get integer assignment
357 const Int::Assignment& y = x.ints();
358 // x-coordinate: y[0], y-coordinate: y[1], result: x[0]
359 using namespace Gecode;
360 if ((y[0] > 1) || (y[1] > 1))
361 return false;
362 Matrix<IntSetArgs> m(tm,2,2);
363 IntSetRanges a(m(y[0],y[1]));
364 CountableSetRanges b(x.lub, x[0]);
365 return Iter::Ranges::equal(a,b);
366 }
367 /// Post constraint on \a x and \a y
368 virtual void post(Gecode::Space& home, Gecode::SetVarArray& x,
369 Gecode::IntVarArray& y) {

Callers

nothing calls this directly

Calls 2

mFunction · 0.85
equalFunction · 0.50

Tested by

no test coverage detected