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

Method solution

test/set/sequence.cpp:58–71  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

56 : SetTest(t,4,ds_33,false) {}
57 /// %Test whether \a x is solution
58 virtual bool solution(const SetAssignment& x) const {
59 int max = Gecode::Set::Limits::min - 1;
60 for (int i=0; i<4; i++) {
61 CountableSetRanges xir(x.lub, x[i]);
62 IntSet xi(xir);
63 if (xi.ranges() > 0) {
64 int oldMax = max;
65 max = xi.max();
66 if (xi.min() <= oldMax)
67 return false;
68 }
69 }
70 return true;
71 }
72 /// Post constraint on \a x
73 virtual void post(Space& home, SetVarArray& x, IntVarArray&) {
74 Gecode::sequence(home, x);

Callers

nothing calls this directly

Calls 3

rangesMethod · 0.45
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected