00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <iomanip>
00013 #include <fstream>
00014
00015 #include "CoinPragma.hpp"
00016 #include "BonminConfig.h"
00017 #include "IpoptConfig.h"
00018 #include "CbcConfig.h"
00019 #include "CoinTime.hpp"
00020 #include "BonAmplSetup.hpp"
00021 #include "BonCbc.hpp"
00022
00023 #ifndef NDEBUG
00024 #define CATCH_ERRORS
00025 #endif
00026
00027 using namespace Bonmin;
00028 int main (int argc, char *argv[])
00029 {
00030 using namespace Ipopt;
00031 char * pbName = NULL;
00032
00033 std::cout<<"Bonmin "
00034 <<BONMIN_VERSION;
00035 std::cout<<" using Cbc "
00036 <<CBC_VERSION;
00037 std::cout<<" and Ipopt "
00038 <<IPOPT_VERSION<<std::endl;
00039 if(argc > 1) {
00040 pbName = new char[strlen(argv[1])+1];
00041 strcpy(pbName, argv[1]);
00042 }
00043 #define CATCH_ERRORS
00044 #ifdef CATCH_ERRORS
00045 try
00046 #endif
00047 {
00048
00049
00050 BonminAmplSetup bonmin;
00051 bonmin.initialize(argv);
00052
00053 {
00054 Bab bb;
00055
00056 bb(bonmin);
00057 }
00058 }
00059 #ifdef CATCH_ERRORS
00060 catch(TNLPSolver::UnsolvedError *E) {
00061 E->writeDiffFiles();
00062 E->printError(std::cerr);
00063
00064
00065
00066
00067 }
00068 catch(OsiTMINLPInterface::SimpleError &E) {
00069 std::cerr<<E.className()<<"::"<<E.methodName()
00070 <<std::endl
00071 <<E.message()<<std::endl;
00072 }
00073 catch(CoinError &E) {
00074 std::cerr<<E.className()<<"::"<<E.methodName()
00075 <<std::endl
00076 <<E.message()<<std::endl;
00077 }
00078 catch (Ipopt::OPTION_INVALID &E)
00079 {
00080 std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
00081 }
00082 catch (Ipopt::IpoptException &E)
00083 {
00084 std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
00085 }
00086 catch(...) {
00087 std::cerr<<pbName<<" unrecognized exception"<<std::endl;
00088 std::cerr<<pbName<<"\t Finished \t exception"<<std::endl;
00089 throw;
00090 }
00091 #endif
00092
00093 delete [] pbName;
00094 return 0;
00095 }
00096