00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #if defined(_MSC_VER)
00013
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 #include "BonVersions.hpp"
00023 #define CATCH_ERRORS
00024 using namespace Bonmin;
00025 int main (int argc, char *argv[])
00026 {
00027 using namespace Ipopt;
00028 char * pbName = NULL;
00029
00030 std::cout<<"Bonmin "
00031 <<BONMIN_VERSION;
00032 std::cout<<" using Cbc "
00033 <<CBCVERSION;
00034 std::cout<<" and Ipopt "
00035 <<IPOPT_VERSION<<std::endl;
00036 if(argc > 1) {
00037 pbName = new char[strlen(argv[1])+1];
00038 strcpy(pbName, argv[1]);
00039 }
00040 #define CATCH_ERRORS
00041 #ifdef CATCH_ERRORS
00042 try
00043 #endif
00044 {
00045
00046
00047 BonminAmplSetup bonmin;
00048 bonmin.initialize(argv);
00049 Bab bb;
00050
00051 bb(bonmin);
00052
00053 }
00054 #ifdef CATCH_ERRORS
00055 catch(TNLPSolver::UnsolvedError *E) {
00056 E->writeDiffFiles();
00057 E->printError(std::cerr);
00058
00059
00060
00061
00062 }
00063 catch(OsiTMINLPInterface::SimpleError &E) {
00064 std::cerr<<E.className()<<"::"<<E.methodName()
00065 <<std::endl
00066 <<E.message()<<std::endl;
00067 }
00068 catch(CoinError &E) {
00069 std::cerr<<E.className()<<"::"<<E.methodName()
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