void DependencyDigraph::breakCycles() { // int broken = 0; // std::cout << cycles.size() << std::endl; // debug; // std::vector<std::shared_ptr < invariantNode>> Broken; for (unsigned cycle = 0; cycle < cycles.size(); cycle++) { if (brokenCycles[cycle]) { // std::cout << "continue" << std::endl; continue; } // broken++; std::shared_ptr<invariantNode> best = breakTie(cycle); // Broken.push_back(best); // brokenInvariants.at(best->id) = true; best->invar->setBroken(true); for (int cyc : invariantsCycles.at(best->id)) { brokenCycles.at(cyc) = true; // std::cout << cyc << " " << cycle << std::endl; } undefineVariable(best); } // for(std::shared_ptr<invariantNode> in : Broken ){ // in->invar->getVariable()->undefine(); // } // std::cout << broken << std::endl; }
// Best lower bound first search bool BBCompare::backupCompare(BBNode *x, BBNode *y) { int lbx = x->lpObjVal(); int lby = y->lpObjVal(); if (lbx != lby) { return lbx > lby; } else { return breakTie(x, y); } }
// Return true if x is less than y (y is better) bool BBCompare::compare(BBNode *x, BBNode *y) { // for debug bool optx = x->isInclOptSol(); bool opty = y->isInclOptSol(); if ((optx || opty) && (optx != (x->score()-y->score() > 0))) { log_info("wrong decision"); } double diff = x->score() - y->score(); if (diff == 0) { return breakTie(x, y); //return backupCompare(x, y); } else { return diff > 0 ? false : true; } }