source: trunk/Bonmin/src/Apps/BonMin.cpp @ 1543

Last change on this file since 1543 was 1543, checked in by pbonami, 10 years ago

Fix to Makefile

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 2.3 KB
RevLine 
[464]1// (C) Copyright International Business Machines Corporation and Carnegie Mellon University 2006, 2007
[1]2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// Authors :
6// Andreas Waechter, International Business Machines Corporation
7// Pierre Bonami, Carnegie Mellon University,
8//
9// Date : 02/15/2006
10
11
12#if defined(_MSC_VER)
13// Turn off compiler warning about long names
14#  pragma warning(disable:4786)
15#endif
16#include <iomanip>
17#include <fstream>
18
19#include "CoinTime.hpp"
[481]20#include "BonAmplSetup.hpp"
[691]21#include "BonCbc.hpp"
[1476]22#include "BonVersions.hpp"
[1410]23#define CATCH_ERRORS
[53]24using namespace Bonmin;
[1]25int main (int argc, char *argv[])
26{
27  using namespace Ipopt;
[208]28  char * pbName = NULL;
[481]29 
[1476]30  std::cout<<"Bonmin "
31           <<BONMIN_VERSION; 
32  std::cout<<" using Cbc "
33         <<CBCVERSION; 
34  std::cout<<" and Ipopt "
35         <<IPOPT_VERSION<<std::endl; 
[248]36  if(argc > 1) {
37    pbName = new char[strlen(argv[1])+1];
38    strcpy(pbName, argv[1]);
[208]39  }
[1476]40#define CATCH_ERRORS
[1371]41#ifdef CATCH_ERRORS
[481]42  try
43#endif
44  {
[90]45
[1543]46    //FILE * fp = fopen("log","w");
[481]47    BonminAmplSetup bonmin;
[620]48    bonmin.initialize(argv);
[693]49    Bab bb;
[473]50
[481]51    bb(bonmin);//do branch and bound
[1]52
53  }
[1371]54#ifdef CATCH_ERRORS
[67]55  catch(TNLPSolver::UnsolvedError *E) {
[481]56    E->writeDiffFiles();
57    E->printError(std::cerr);
[1]58    //There has been a failure to solve a problem with Ipopt.
59    //And we will output file with information on what has been changed in the problem to make it fail.
60    //Now depending on what algorithm has been called (B-BB or other) the failed problem may be at different place.
61    //    const OsiSolverInterface &si1 = (algo > 0) ? nlpSolver : *model.solver();
62  }
[67]63  catch(OsiTMINLPInterface::SimpleError &E) {
[1]64    std::cerr<<E.className()<<"::"<<E.methodName()
[481]65    <<std::endl
66    <<E.message()<<std::endl;
[1]67  }
68  catch(CoinError &E) {
69    std::cerr<<E.className()<<"::"<<E.methodName()
[481]70    <<std::endl
71    <<E.message()<<std::endl;
[1]72  }
73  catch (Ipopt::OPTION_INVALID &E)
74  {
[481]75    std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
[1]76  }
[1099]77  catch (Ipopt::IpoptException &E)
78  {
79    std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
80  }
[1]81  catch(...) {
[208]82    std::cerr<<pbName<<" unrecognized exception"<<std::endl;
[1]83    std::cerr<<pbName<<"\t Finished \t exception"<<std::endl;
84    throw;
85  }
[481]86#endif
87 
[1]88  delete [] pbName;
89  return 0;
90}
91
Note: See TracBrowser for help on using the repository browser.