// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //----------------------------------------------------- // Simple example usage of the cut generation library. // // This sample program iteratively tightens a // given formulation by adding cuts, then calls // branch-and-bound to solve the tightened // formulation. // // usage: // cgl1 mpsFileName objectiveSense // where: // mpsFileName: Name of an mps file (without the // file extension) // objectiveSense: min for minimization, // max for maximization. // example: // cgl1 ../../Data/Sample/p0033 min //----------------------------------------------------- // The knapsack cut generator assumes the primal solution is feasible. #include #include #include #include "CoinError.hpp" #include "OsiCuts.hpp" #include "OsiClpSolverInterface.hpp" //#include "OsiOslSolverInterface.hpp" #include "CoinWarmStartBasis.hpp" #include #include "CglKnapsackCover.hpp" #include "CglSimpleRounding.hpp" using std::cerr; using std::cout; using std::endl; using std::string; int main(int argc, const char *argv[]) { // If no parms specified then use these string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc == 1) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif string objSense = "min"; // Make sure a file name and objective sense or nothing // were specified if ( argc!=1 && argc!=3 ) { cerr <<"Incorrect number of command line parameters." <(si.getWarmStart()) ; assert (basis); int nDelete=0; for (int i=numberRows;igetArtifStatus(i); if (status == CoinWarmStartBasis::basic) del[nDelete++] = i; } delete basis; if (nDelete) { si.deleteRows(nDelete,del); // should take zero iterations si.resolve(); cout << nDelete << " rows deleted as basic - resolve took " << si.getIterationCount() <<" iterations" <