std::vector<VariablePtr> findBranchingVariables(ConstraintPtr constraints) { std::vector<VariablePtr> bvars = constraints->getComplicatingVariables(); auto vars = constraints->getVariables(); for (auto var : vars) { if (var->getType() == VariableType::BINARY || var->getType() == VariableType::INTEGER) { // Add to bv if not already there if (std::find(bvars.begin(), bvars.end(), var) == bvars.end()) { bvars.push_back(var); } } } return bvars; }
bool OBBT::doTightening(ConstraintPtr constraints) { // Get convex relaxation ConstraintPtr convexConstraints = constraints->getConvexRelaxation(); assert(convexConstraints != nullptr); assert(convexConstraints->isConstraintConvex()); // Tighten bounds of all complicating variables std::vector<VariablePtr> variables; for (auto var : constraints->getComplicatingVariables()) { if (assertNear(var->getUpperBound(), var->getLowerBound())) continue; variables.push_back(var); } // Check if there are any variables to tighten if (variables.size() < 1) return true; // Tighten bounds return tightenBoundsSequential(convexConstraints, variables); // bool success = true; // if (doParallelComputing) // { // tightenBoundsParallel(convexConstraints, variables); // } // else // { // success = tightenBoundsSequential(convexConstraints, variables); // } // return success; }