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

Method best

test/search.cpp:257–283  ·  view source on GitHub ↗

Verify that this is best solution

Source from the content-addressed store, hash-verified

255 }
256 /// Verify that this is best solution
257 virtual bool best(void) const {
258 if ((htb1 == HTB_NONE) || (htb2 == HTB_NONE) || (htb3 == HTB_NONE) ||
259 (htb1 == HTB_UNARY) || (htb2 == HTB_UNARY) || (htb3 == HTB_UNARY))
260 return true;
261 switch (htc) {
262 case HTC_NONE:
263 return true;
264 case HTC_LEX_LE:
265 return ((x[0].val()==4) && (x[1].val()==5) &&
266 (x[2].val()==2) && (x[3].val()==3) &&
267 (x[4].val()==0) && (x[5].val()==1));
268 case HTC_LEX_GR:
269 return ((x[0].val()==5) && (x[1].val()==4) &&
270 (x[2].val()==3) && (x[3].val()==2) &&
271 (x[4].val()==1) && (x[5].val()==0));
272 case HTC_BAL_LE:
273 return ((x[0].val()==4) && (x[1].val()==5) &&
274 (x[2].val()==2) && (x[3].val()==3) &&
275 (x[4].val()==0) && (x[5].val()==1));
276 case HTC_BAL_GR:
277 return ((x[0].val()==4) && (x[1].val()==5) &&
278 (x[2].val()==3) && (x[3].val()==2) &&
279 (x[4].val()==0) && (x[5].val()==1));
280 default: GECODE_NEVER;
281 }
282 return false;
283 }
284 /// Return name
285 static std::string name(void) {
286 return "Sol";

Callers 3

runMethod · 0.45
runMethod · 0.45
runMethod · 0.45

Calls 1

valMethod · 0.45

Tested by

no test coverage detected