Run test
| 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 |