00001 00016 #ifndef LINDOSOLVER_H 00017 #define LINDOSOLVER_H 00018 00019 #include "OSDefaultSolver.h" 00020 #include "OSInstance.h" 00021 #include "lindo.h" 00022 #include "OSrLWriter.h" 00023 #include "OSiLWriter.h" 00024 #include "OSiLReader.h" 00025 #include "OSConfig.h" 00026 #include <string> 00027 00028 #ifdef HAVE_CTIME 00029 # include <ctime> 00030 #else 00031 # ifdef HAVE_TIME_H 00032 # include <time.h> 00033 # else 00034 # error "don't have header file for time" 00035 # endif 00036 #endif 00037 00050 class LindoSolver : public DefaultSolver{ 00051 00052 public: 00053 00055 LindoSolver(); 00056 00058 ~LindoSolver(); 00059 00062 virtual void solve() ; 00063 00068 virtual void buildSolverInstance() throw(ErrorClass); 00069 00070 00071 // Lindo specific methods 00072 00077 bool optimize(); 00078 00084 bool processVariables(); 00085 00091 bool processConstraints(); 00092 00098 bool generateLindoModel(); 00099 00106 bool addSlackVars(); 00107 00112 bool processQuadraticTerms(); 00113 00118 bool processNonlinearExpressions(); 00119 00124 OSiLReader *m_osilreader; 00125 00131 void dataEchoCheck(); 00132 00133 00134 00135 private: 00136 00138 pLSenv pEnv_; 00139 00141 pLSmodel pModel_; 00142 00144 int m_iLindoErrorCode; 00145 00148 int *m_miSlackIdx; 00149 00151 int m_iNumberNewSlacks; 00152 00156 double *m_mdRhsValue; 00157 00161 char *m_mcRowType; 00162 00166 double* m_mdVarLB; 00167 00171 double* m_mdVarUB; 00172 00176 double* m_mdConLB; 00177 00181 double* m_mdConUB; 00182 00186 char** m_mmcVarName; 00187 00191 std::string* m_msVarName; 00192 00196 std::string* m_msConName; 00197 00202 char* m_mcVarType; 00206 double m_mdObjConstant; // change to array later 00207 00209 OSrLWriter *osrlwriter; 00210 00211 protected: 00216 void lindoAPIErrorCheck( std::string errormsg); 00217 00218 }; 00219 00220 00221 00222 #endif