Debian Codegraph @

Bonmin/experimental/Separable/Sepa.cpp

raw
1 // (C) Copyright CNRS and others 2010
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors :
6 // Pierre Bonami, Université de la Méditérannée
7 // Hassan Hijazi, Orange Labs
8 //
9 // Date : 05/22/2010
10
11 #include <iomanip>
12 #include <fstream>
13
14 #include "CoinPragma.hpp"
15 #include "BonminConfig.h"
16 #include "IpoptConfig.h"
17 #include "CbcConfig.h"
18 #include "CoinTime.hpp"
19 #include "SepaSetup.hpp"
20 #include "BonCbc.hpp"
21
22 #define CATCH_ERRORS
23 int main (int argc, char *argv[])
24 {
25 using namespace Ipopt;
26 char * pbName = NULL;
27
28 std::cout<<"Bonmin "
29 <<BONMIN_VERSION;
30 std::cout<<" using Cbc "
31 <<CBC_VERSION;
32 std::cout<<" and Ipopt "
33 <<IPOPT_VERSION<<std::endl;
34 if(argc > 1) {
35 pbName = new char[strlen(argv[1])+1];
36 strcpy(pbName, argv[1]);
37 }
38 #define CATCH_ERRORS
39 #ifdef CATCH_ERRORS
40 try
41 #endif
42 {
43
44 //FILE * fp = fopen("log","w");
45 Sepa::SepaSetup bonmin;
46 bonmin.initialize(argv);
47 Bonmin::Bab bb;
48
49 bb(bonmin);//do branch and bound
50
51 }
52 #ifdef CATCH_ERRORS
53 catch(Bonmin::TNLPSolver::UnsolvedError *E) {
54 E->writeDiffFiles();
55 E->printError(std::cerr);
56 //There has been a failure to solve a problem with Ipopt.
57 //And we will output file with information on what has been changed in the problem to make it fail.
58 //Now depending on what algorithm has been called (B-BB or other) the failed problem may be at different place.
59 // const OsiSolverInterface &si1 = (algo > 0) ? nlpSolver : *model.solver();
60 }
61 catch(Bonmin::OsiTMINLPInterface::SimpleError &E) {
62 std::cerr<<E.className()<<"::"<<E.methodName()
63 <<std::endl
64 <<E.message()<<std::endl;
65 }
66 catch(CoinError &E) {
67 std::cerr<<E.className()<<"::"<<E.methodName()
68 <<std::endl
69 <<E.message()<<std::endl;
70 }
71 catch (Ipopt::OPTION_INVALID &E)
72 {
73 std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
74 }
75 catch (Ipopt::IpoptException &E)
76 {
77 std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
78 }
79 catch(...) {
80 std::cerr<<pbName<<" unrecognized exception"<<std::endl;
81 std::cerr<<pbName<<"\t Finished \t exception"<<std::endl;
82 throw;
83 }
84 #endif
85
86 delete [] pbName;
87 return 0;
88 }
89