00001 /* $Id: OSCouenneSolver.h 2719 2009-06-13 07:48:56Z kmartin $ */ 00017 #ifndef COUENNESOLVER_H 00018 #define COUENNESOLVER_H 00019 00020 #include "OSConfig.h" 00021 #include "OSDefaultSolver.h" 00022 #include "OSBonminSolver.h" 00023 #include "OSIpoptSolver.h" 00024 #include "OSrLWriter.h" 00025 #include "OSInstance.h" 00026 #include "OSParameters.h" 00027 #include "OSiLReader.h" 00028 #include "OSExpressionTree.h" 00029 #include "OSnLNode.h" 00030 #include "OSDataStructures.h" 00031 #include "OSFileUtil.h" 00032 #include "OSErrorClass.h" 00033 #include "OSResult.h" 00034 #include "OSOption.h" 00035 00036 00037 //#include "BonIpoptSolver.hpp" 00038 00039 //Couenne stuff 00040 //#include "CouenneProblem.hpp" 00041 class CouenneProblem; 00042 class expression; 00043 #include "BonCbc.hpp" 00044 #include "BonCouenneSetup.hpp" 00045 00046 #ifdef HAVE_CTIME 00047 # include <ctime> 00048 #else 00049 # ifdef HAVE_TIME_H 00050 # include <time.h> 00051 # else 00052 # error "don't have header file for time" 00053 # endif 00054 #endif 00055 00056 00057 #ifdef HAVE_CMATH 00058 # include <cmath> 00059 #else 00060 # ifdef HAVE_MATH_H 00061 # include <math.h> 00062 # else 00063 # error "don't have header file for math" 00064 # endif 00065 #endif 00066 #include<vector> 00067 #include <map> 00068 00069 00070 00071 00072 00073 00087 using namespace Bonmin; 00088 class CouenneSolver : public DefaultSolver{ 00089 public: 00090 00092 CouenneSolver(); 00093 00095 ~CouenneSolver(); 00096 00099 virtual void solve() throw (ErrorClass) ; 00100 00105 virtual void buildSolverInstance() throw(ErrorClass); 00106 00111 virtual void setSolverOptions() throw(ErrorClass); 00112 00118 void dataEchoCheck(); 00119 00124 void writeResult(); 00125 00130 OSiLReader *m_osilreader; 00131 00136 OSoLReader *m_osolreader; 00137 00138 CouenneProblem *couenne; 00139 00140 //Ipopt::SmartPtr<TMINLP> tminlp; 00141 SmartPtr<BonminProblem> tminlp; 00142 00143 Ipopt::SmartPtr<TNLPSolver> app_ ; 00144 00145 //SmartPtr<Bonmin::IpoptSolver> app_ ; 00146 00147 // this is a Bonmin BonCbc object; 00148 Bab bb; 00149 00150 TMINLP::SolverReturn status; 00151 00152 expression *con_body; 00153 expression *obj_body; 00154 00155 00156 private: 00157 OSrLWriter *osrlwriter; 00158 00159 CouenneSetup couenneSetup; 00160 00161 std::string couenneErrorMsg; 00162 00163 expression* createCouenneExpression(OSnLNode* node); 00164 }; 00165 00166 00167 #endif /*COUENNESOLVER_H*/