00001 /* $Id: OSLindoSolver.h 2698 2009-06-09 04:14:07Z kmartin $ */ 00017 #ifndef LINDOSOLVER_H 00018 #define LINDOSOLVER_H 00019 00020 #include "OSDefaultSolver.h" 00021 #include "OSInstance.h" 00022 #include "lindo.h" 00023 #include "OSrLWriter.h" 00024 #include "OSiLWriter.h" 00025 #include "OSiLReader.h" 00026 #include "OSConfig.h" 00027 #include <string> 00028 00029 #ifdef HAVE_CTIME 00030 # include <ctime> 00031 #else 00032 # ifdef HAVE_TIME_H 00033 # include <time.h> 00034 # else 00035 # error "don't have header file for time" 00036 # endif 00037 #endif 00038 00051 class LindoSolver : public DefaultSolver{ 00052 00053 public: 00054 00056 LindoSolver(); 00057 00059 ~LindoSolver(); 00060 00063 virtual void solve() ; 00064 00069 virtual void buildSolverInstance() throw(ErrorClass); 00070 00075 virtual void setSolverOptions() throw(ErrorClass); 00076 00077 // Lindo specific methods 00078 00083 bool optimize(); 00084 00090 bool processVariables(); 00091 00097 bool processConstraints(); 00098 00104 bool generateLindoModel(); 00105 00112 bool addSlackVars(); 00113 00118 bool processQuadraticTerms(); 00119 00124 bool processNonlinearExpressions(); 00125 00130 OSiLReader *m_osilreader; 00131 00137 void dataEchoCheck(); 00138 00139 00140 00141 private: 00142 00144 pLSenv pEnv_; 00145 00147 pLSmodel pModel_; 00148 00150 int m_iLindoErrorCode; 00151 00154 int *m_miSlackIdx; 00155 00157 int m_iNumberNewSlacks; 00158 00162 double *m_mdRhsValue; 00163 00167 char *m_mcRowType; 00168 00172 double* m_mdVarLB; 00173 00177 double* m_mdVarUB; 00178 00182 double* m_mdConLB; 00183 00187 double* m_mdConUB; 00188 00192 char** m_mmcVarName; 00193 00197 std::string* m_msVarName; 00198 00202 std::string* m_msConName; 00203 00208 char* m_mcVarType; 00212 double m_mdObjConstant; // change to array later 00213 00215 OSrLWriter *osrlwriter; 00216 00217 double cpuTime; 00218 00219 protected: 00224 void lindoAPIErrorCheck( std::string errormsg); 00225 00226 }; 00227 00228 00229 00230 #endif