00001 00016 #ifndef LINDOSOLVER_H 00017 #define LINDOSOLVER_H 00018 00019 #include "DefaultSolver.h" 00020 #include "OSInstance.h" 00021 #include "lindo.h" 00022 #include "OSrLWriter.h" 00023 #include "OSConfig.h" 00024 #include <string> 00025 00026 #ifdef HAVE_CTIME 00027 # include <ctime> 00028 #else 00029 # ifdef HAVE_TIME_H 00030 # include <time.h> 00031 # else 00032 # error "don't have header file for time" 00033 # endif 00034 #endif 00035 00048 class LindoSolver : public DefaultSolver{ 00049 00050 public: 00051 00053 LindoSolver(); 00054 00056 ~LindoSolver(); 00057 00060 virtual void solve() ; 00061 00062 // Lindo specific methods 00063 00068 bool optimize(); 00069 00075 bool processVariables(); 00076 00082 bool processConstraints(); 00083 00089 bool generateLindoModel(); 00090 00097 bool addSlackVars(); 00098 00103 bool processQuadraticTerms(); 00104 00109 bool processNonlinearExpressions(); 00110 00116 void dataEchoCheck(); 00117 00118 00119 00120 private: 00121 00123 pLSenv pEnv_; 00124 00126 pLSmodel pModel_; 00127 00129 int m_iLindoErrorCode; 00130 00133 int *m_miSlackIdx; 00134 00136 int m_iNumberNewSlacks; 00137 00141 double *m_mdRhsValue; 00142 00146 char *m_mcRowType; 00147 00151 double* m_mdVarLB; 00152 00156 double* m_mdVarUB; 00157 00161 double* m_mdConLB; 00162 00166 double* m_mdConUB; 00167 00171 char** m_mmcVarName; 00172 00176 std::string* m_msVarName; 00177 00181 std::string* m_msConName; 00182 00187 char* m_mcVarType; 00191 double m_mdObjConstant; // change to array later 00192 00194 OSrLWriter *osrlwriter; 00195 00196 protected: 00201 void lindoAPIErrorCheck( std::string errormsg); 00202 00203 }; 00204 00205 00206 00207 #endif