/home/coin/SVN-release/OS-2.0.0/Bonmin/src/Apps/BonMin.cpp

Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation and Carnegie Mellon University 2006, 2007
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Andreas Waechter, International Business Machines Corporation
00007 // Pierre Bonami, Carnegie Mellon University,
00008 //
00009 // Date : 02/15/2006
00010 
00011 
00012 #if defined(_MSC_VER)
00013 // Turn off compiler warning about long names
00014 #  pragma warning(disable:4786)
00015 #endif
00016 #include <iomanip>
00017 #include <fstream>
00018 
00019 #include "CoinTime.hpp"
00020 #include "BonAmplSetup.hpp"
00021 #include "BonCbc.hpp"
00022 
00023 using namespace Bonmin;
00024 int main (int argc, char *argv[])
00025 {
00026   using namespace Ipopt;
00027   char * pbName = NULL;
00028   
00029   if(argc > 1) {
00030     pbName = new char[strlen(argv[1])+1];
00031     strcpy(pbName, argv[1]);
00032   }
00033   
00034 #if 1
00035   try
00036 #endif 
00037   {
00038 
00039     BonminAmplSetup bonmin;
00040     bonmin.initialize(argv);
00041     Bab bb;
00042 
00043     bb(bonmin);//do branch and bound
00044 
00045   }
00046 #if 1
00047   catch(TNLPSolver::UnsolvedError *E) {
00048     E->writeDiffFiles();
00049     E->printError(std::cerr);
00050     //There has been a failure to solve a problem with Ipopt.
00051     //And we will output file with information on what has been changed in the problem to make it fail.
00052     //Now depending on what algorithm has been called (B-BB or other) the failed problem may be at different place.
00053     //    const OsiSolverInterface &si1 = (algo > 0) ? nlpSolver : *model.solver();
00054   }
00055   catch(OsiTMINLPInterface::SimpleError &E) {
00056     std::cerr<<E.className()<<"::"<<E.methodName()
00057     <<std::endl
00058     <<E.message()<<std::endl;
00059   }
00060   catch(CoinError &E) {
00061     std::cerr<<E.className()<<"::"<<E.methodName()
00062     <<std::endl
00063     <<E.message()<<std::endl;
00064   }
00065   catch (Ipopt::OPTION_INVALID &E)
00066   {
00067     std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
00068   }
00069   catch (Ipopt::IpoptException &E)
00070   {
00071     std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
00072   }
00073   catch(...) {
00074     std::cerr<<pbName<<" unrecognized exception"<<std::endl;
00075     std::cerr<<pbName<<"\t Finished \t exception"<<std::endl;
00076     throw;
00077   }
00078 #endif
00079   
00080   delete [] pbName;
00081   return 0;
00082 }
00083 

Generated on Mon Aug 3 03:02:18 2009 by  doxygen 1.4.7