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

Method run

test/search.cpp:535–572  ·  view source on GitHub ↗

Run test

Source from the content-addressed store, hash-verified

533 HTB_BINARY,HTB_BINARY,HTB_BINARY), best(b), a(a0), t(t0) {}
534 /// Run test
535 virtual bool run(void) {
536 Model* m = new Model(htb1,htb2,htb3);
537 Gecode::Search::FailStop f(2);
538 Gecode::Search::Options o;
539 o.assets = a;
540 o.threads = t;
541 o.d_l = 100;
542 o.stop = &f;
543 Gecode::PBS<Model,Engine> pbs(m,o);
544 if (best) {
545 Model* b = nullptr;
546 while (true) {
547 Model* s = pbs.next();
548 if (s != nullptr) {
549 delete b; b=s;
550 }
551 if ((s == nullptr) && !pbs.stopped())
552 break;
553 f.limit(f.limit()+2);
554 }
555 bool ok = (b == nullptr) || b->best();
556 delete b;
557 return ok;
558 } else {
559 int n = ((t > 1) ? std::min(a,t) : a) * m->solutions();
560 delete m;
561 while (true) {
562 Model* s = pbs.next();
563 if (s != nullptr) {
564 n--; delete s;
565 }
566 if ((s == nullptr) && !pbs.stopped())
567 break;
568 f.limit(f.limit()+2);
569 }
570 return n >= 0;
571 }
572 }
573 };
574
575 /// %Test for portfolio-based search using SEBs

Callers

nothing calls this directly

Calls 6

minFunction · 0.50
nextMethod · 0.45
stoppedMethod · 0.45
limitMethod · 0.45
bestMethod · 0.45
solutionsMethod · 0.45

Tested by

no test coverage detected