/* ************************************************************************* */ void runLargeExample() { Scheduler scheduler = largeExample(); scheduler.print(); // BUILD THE GRAPH ! size_t addMutex = 2; scheduler.buildGraph(addMutex); // Do brute force product and output that to file if (scheduler.nrStudents() == 1) { // otherwise too slow DecisionTreeFactor product = scheduler.product(); product.dot("scheduling-large", false); } // Do exact inference // SETDEBUG("timing-verbose", true); SETDEBUG("DiscreteConditional::DiscreteConditional", true); gttic(large); DiscreteFactor::sharedValues MPE = scheduler.optimalAssignment(); gttoc(large); tictoc_finishedIteration(); tictoc_print(); scheduler.printAssignment(MPE); }
/* ************************************************************************* */ void runLargeExample() { Scheduler scheduler = largeExample(); scheduler.print(); // BUILD THE GRAPH ! size_t addMutex = 3; // SETDEBUG("Scheduler::buildGraph", true); scheduler.buildGraph(addMutex); // Do brute force product and output that to file if (scheduler.nrStudents() == 1) { // otherwise too slow DecisionTreeFactor product = scheduler.product(); product.dot("scheduling-large", false); } // Do exact inference // SETDEBUG("timing-verbose", true); SETDEBUG("DiscreteConditional::DiscreteConditional", true); #define SAMPLE #ifdef SAMPLE tic(2, "large"); DiscreteBayesNet::shared_ptr chordal = scheduler.eliminate(); toc(2, "large"); tictoc_finishedIteration(); tictoc_print(); for (size_t i=0;i<100;i++) { DiscreteFactor::sharedValues assignment = sample(*chordal); vector<size_t> stats(scheduler.nrFaculty()); scheduler.accumulateStats(assignment, stats); size_t max = *max_element(stats.begin(), stats.end()); size_t min = *min_element(stats.begin(), stats.end()); size_t nz = count_if(stats.begin(), stats.end(), NonZero); // cout << min << ", " << max << ", " << nz << endl; if (nz >= 13 && min >=1 && max <= 4) { cout << "======================================================\n"; scheduler.printAssignment(assignment); } } #else tic(2, "large"); DiscreteFactor::sharedValues MPE = scheduler.optimalAssignment(); toc(2, "large"); tictoc_finishedIteration(); tictoc_print(); scheduler.printAssignment(MPE); #endif }