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

Method solution

test/float/mm-lin.cpp:143–159  ·  view source on GitHub ↗

%Test whether \a x is solution

Source from the content-addressed store, hash-verified

141 }
142 /// %Test whether \a x is solution
143 virtual bool solution(const Int::Assignment& x) const {
144 using namespace Gecode;
145 int l_reg[3] = {x[0],x[1],x[2]};
146 int l = eval(l_lis,l_reg);
147 int r_reg[3] = {x[0],x[1],x[2]};
148 int r = eval(r_lis,r_reg);
149 switch (frt) {
150 case FRT_EQ: return l == r;
151 case FRT_NQ: return l != r;
152 case FRT_LE: return l < r;
153 case FRT_GR: return l > r;
154 case FRT_LQ: return l <= r;
155 case FRT_GQ: return l >= r;
156 default: GECODE_NEVER;
157 }
158 return false;
159 }
160 /// Post constraint on \a x
161 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
162 using namespace Gecode;

Callers

nothing calls this directly

Calls 1

evalFunction · 0.70

Tested by

no test coverage detected