// Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include #include // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchActual.hpp" #include "CoinTime.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif using namespace std; //############################################################################# int main (int argc, const char *argv[]) { OsiClpSolverInterface solver; solver.setHintParam(OsiDoReducePrint,true,OsiHintTry); solver.readMps("fixed", "mps"); CbcModel model(solver); model.initialSolve(); model.setIntParam(CbcModel::CbcMaxNumNode, 1); model.branchAndBound(); int numIntegInfeas, numObjInfeas; bool feas=model.feasibleSolution(numIntegInfeas,numObjInfeas); if (feas) printf("feasible: yes\n"); else printf("feasible: no\n"); printf("infeasibilities: %d+%d\n", numIntegInfeas, numObjInfeas); for (int i=0; igetNumCols(); ++i) if (model.solver()->isInteger(i)) printf("integ. var. %d = %f\n", i, model.solver()->getColSolution()[i]); return 0; }