00001 /* $Id: OSLindoSolver.h 4292 2011-09-21 05:47:18Z kmartin $ */ 00015 #ifndef LINDOSOLVER_H 00016 #define LINDOSOLVER_H 00017 00018 #include "OSDefaultSolver.h" 00019 #include "OSInstance.h" 00020 #include "lindo.h" 00021 #include "OSrLWriter.h" 00022 #include "OSiLWriter.h" 00023 #include "OSiLReader.h" 00024 #include "OSConfig.h" 00025 #include <string> 00026 00027 #ifdef HAVE_CTIME 00028 # include <ctime> 00029 #else 00030 # ifdef HAVE_TIME_H 00031 # include <time.h> 00032 # else 00033 # error "don't have header file for time" 00034 # endif 00035 #endif 00036 00049 class LindoSolver : public DefaultSolver 00050 { 00051 00052 public: 00053 00055 LindoSolver(); 00056 00058 ~LindoSolver(); 00059 00062 virtual void solve() ; 00063 00068 virtual void buildSolverInstance() throw(ErrorClass); 00069 00074 virtual void setSolverOptions() throw(ErrorClass); 00075 00076 // Lindo specific methods 00077 00082 bool optimize(); 00083 00089 bool processVariables(); 00090 00096 bool processConstraints(); 00097 00103 bool generateLindoModel(); 00104 00111 bool addSlackVars(); 00112 00117 bool processQuadraticTerms(); 00118 00123 bool processNonlinearExpressions(); 00124 00129 OSiLReader *m_osilreader; 00130 00136 void dataEchoCheck(); 00137 00138 00139 00140 private: 00141 00143 pLSenv pEnv_; 00144 00146 pLSmodel pModel_; 00147 00149 int m_iLindoErrorCode; 00150 00153 int *m_miSlackIdx; 00154 00156 int m_iNumberNewSlacks; 00157 00161 double *m_mdRhsValue; 00162 00166 char *m_mcRowType; 00167 00171 double* m_mdVarLB; 00172 00176 double* m_mdVarUB; 00177 00181 double* m_mdConLB; 00182 00186 double* m_mdConUB; 00187 00191 char** m_mmcVarName; 00192 00196 std::string* m_msVarName; 00197 00201 std::string* m_msConName; 00202 00207 char* m_mcVarType; 00211 double m_mdObjConstant; // change to array later 00212 00214 OSrLWriter *osrlwriter; 00215 00216 double cpuTime; 00217 00218 protected: 00223 void lindoAPIErrorCheck( std::string errormsg); 00224 00225 }; 00226 00227 00228 00229 #endif