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

Method run

test/float.cpp:477–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475 Gecode::Reify) {}
476
477 bool
478 Test::run(void) {
479 using namespace Gecode;
480 const char* test = "NONE";
481 const char* problem = "NONE";
482
483 // Set up assignments
484 Assignment* ap = assignment();
485 Assignment& a = *ap;
486
487 // Set up space for all solution search
488 TestSpace* search_s = new TestSpace(arity,dom,step,this);
489 post(*search_s,search_s->x);
490 branch(*search_s,search_s->x,FLOAT_VAR_NONE(),FLOAT_VAL_SPLIT_MIN());
491 Search::Options search_o;
492 search_o.threads = 1;
493 DFS<TestSpace> * e_s = new DFS<TestSpace>(search_s,search_o);
494 while (a.has_more()) {
495 MaybeType sol = solution(a);
496 if (opt.log) {
497 olog << ind(1) << "Assignment: " << a;
498 switch (sol) {
499 case MT_TRUE: olog << " (solution)"; break;
500 case MT_FALSE: olog << " (no solution)"; break;
501 case MT_MAYBE: olog << " (maybe)"; break;
502 }
503 olog << std::endl;
504 }
505 START_TEST("Assignment (after posting)");
506 {
507 TestSpace* s = new TestSpace(arity,dom,step,this);
508 TestSpace* sc = nullptr;
509 s->post();
510 switch (_rand(2)) {
511 case 0:
512 if (opt.log)
513 olog << ind(3) << "No copy" << std::endl;
514 sc = s;
515 s = nullptr;
516 break;
517 case 1:
518 if (opt.log)
519 olog << ind(3) << "Copy" << std::endl;
520 if (s->status() != SS_FAILED) {
521 sc = static_cast<TestSpace*>(s->clone());
522 } else {
523 sc = s; s = nullptr;
524 }
525 break;
526 default: assert(false);
527 }
528 sc->assign(a, sol, false, _rand);
529 if (sol == MT_TRUE) {
530 CHECK_TEST(!sc->failed(), "Failed on solution");
531 CHECK_TEST(subsumed(*sc), "No subsumption");
532 } else if (sol == MT_FALSE) {
533 CHECK_TEST(sc->failed(), "Solved on non-solution");
534 }

Callers

nothing calls this directly

Calls 15

FLOAT_VAR_NONEFunction · 0.85
FLOAT_VAL_SPLIT_MINFunction · 0.85
indClass · 0.85
subsumedFunction · 0.85
eqvFunction · 0.85
impFunction · 0.85
pmiFunction · 0.85
matchAssignmentMethod · 0.80
dropUntilMethod · 0.80
postFunction · 0.50
branchFunction · 0.50
overlapFunction · 0.50

Tested by

no test coverage detected