/home/coin/SVN-release/OS-2.4.0/Bonmin/experimental/Separable/Sepa.cpp

Go to the documentation of this file.
00001 // (C) Copyright CNRS and others 2010
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, Université de la Méditérannée
00007 // Hassan Hijazi, Orange Labs
00008 //
00009 // Date : 05/22/2010
00010 
00011 #include <iomanip>
00012 #include <fstream>
00013 
00014 #include "CoinPragma.hpp"
00015 #include "BonminConfig.h"
00016 #include "IpoptConfig.h"
00017 #include "CbcConfig.h"
00018 #include "CoinTime.hpp"
00019 #include "SepaSetup.hpp"
00020 #include "BonCbc.hpp"
00021 
00022 #define CATCH_ERRORS
00023 using namespace Bonmin;
00024 int main (int argc, char *argv[])
00025 {
00026   using namespace Ipopt;
00027   char * pbName = NULL;
00028   
00029   std::cout<<"Bonmin "
00030            <<BONMIN_VERSION; 
00031   std::cout<<" using Cbc "
00032          <<CBC_VERSION; 
00033   std::cout<<" and Ipopt "
00034          <<IPOPT_VERSION<<std::endl; 
00035   if(argc > 1) {
00036     pbName = new char[strlen(argv[1])+1];
00037     strcpy(pbName, argv[1]);
00038   }
00039 #define CATCH_ERRORS 
00040 #ifdef CATCH_ERRORS
00041   try
00042 #endif 
00043   {
00044 
00045     //FILE * fp = fopen("log","w");
00046     SepaSetup bonmin;
00047     bonmin.initialize(argv);
00048     Bab bb;
00049 
00050     bb(bonmin);//do branch and bound
00051 
00052   }
00053 #ifdef CATCH_ERRORS
00054   catch(TNLPSolver::UnsolvedError *E) {
00055     E->writeDiffFiles();
00056     E->printError(std::cerr);
00057     //There has been a failure to solve a problem with Ipopt.
00058     //And we will output file with information on what has been changed in the problem to make it fail.
00059     //Now depending on what algorithm has been called (B-BB or other) the failed problem may be at different place.
00060     //    const OsiSolverInterface &si1 = (algo > 0) ? nlpSolver : *model.solver();
00061   }
00062   catch(OsiTMINLPInterface::SimpleError &E) {
00063     std::cerr<<E.className()<<"::"<<E.methodName()
00064     <<std::endl
00065     <<E.message()<<std::endl;
00066   }
00067   catch(CoinError &E) {
00068     std::cerr<<E.className()<<"::"<<E.methodName()
00069     <<std::endl
00070     <<E.message()<<std::endl;
00071   }
00072   catch (Ipopt::OPTION_INVALID &E)
00073   {
00074     std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
00075   }
00076   catch (Ipopt::IpoptException &E)
00077   {
00078     std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
00079   }
00080   catch(...) {
00081     std::cerr<<pbName<<" unrecognized exception"<<std::endl;
00082     std::cerr<<pbName<<"\t Finished \t exception"<<std::endl;
00083     throw;
00084   }
00085 #endif
00086   
00087   delete [] pbName;
00088   return 0;
00089 }
00090 

Generated on Thu Sep 22 03:05:53 2011 by  doxygen 1.4.7