OS  2.10.2
OSLindoSolver.h
Go to the documentation of this file.
1 /* $Id: OSLindoSolver.h 5284 2017-12-08 13:52:50Z stefan $ */
15 #ifndef LINDOSOLVER_H
16 #define LINDOSOLVER_H
17 
18 #include "OSDefaultSolver.h"
19 #include "OSInstance.h"
20 #include "lindo.h"
21 #include "OSrLWriter.h"
22 #include "OSiLWriter.h"
23 #include "OSiLReader.h"
24 #include "OSConfig.h"
25 #include <string>
26 
27 #ifdef HAVE_CTIME
28 # include <ctime>
29 #else
30 # ifdef HAVE_TIME_H
31 # include <time.h>
32 # else
33 # error "don't have header file for time"
34 # endif
35 #endif
36 
49 class LindoSolver : public DefaultSolver
50 {
51 
52 public:
53 
56 
59 
62  virtual void solve() ;
63 
68  virtual void buildSolverInstance() throw(ErrorClass);
69 
74  virtual void setSolverOptions() throw(ErrorClass);
75 
76  // Lindo specific methods
77 
82  bool optimize();
83 
90 
97 
104 
111  bool addSlackVars();
112 
118 
124 
130 
137 
138 
139 
140 private:
141 
143  pLSenv pEnv_;
144 
146  pLSmodel pModel_;
147 
149  int m_iLindoErrorCode;
150 
153  int *m_miSlackIdx;
154 
156  int m_iNumberNewSlacks;
157 
161  double *m_mdRhsValue;
162 
166  char *m_mcRowType;
167 
171  double* m_mdVarLB;
172 
176  double* m_mdVarUB;
177 
181  double* m_mdConLB;
182 
186  double* m_mdConUB;
187 
191  char** m_mmcVarName;
192 
196  std::string* m_msVarName;
197 
201  std::string* m_msConName;
202 
207  char* m_mcVarType;
211  double m_mdObjConstant; // change to array later
212 
214  OSrLWriter *osrlwriter;
215 
216  double cpuTime;
217 
218 protected:
223  void lindoAPIErrorCheck( std::string errormsg);
224 
225 };
226 
227 
228 
229 #endif
OSConfig.h
LindoSolver::processVariables
bool processVariables()
read the OSiL instance variables and put these into the LINDO API variables
OSiLReader
Used to read an OSiL string.
Definition: OSiLReader.h:38
LindoSolver::generateLindoModel
bool generateLindoModel()
create the LINDO environment and read the problem into the internal LINDO data structures
LindoSolver::processNonlinearExpressions
bool processNonlinearExpressions()
read the nonlinear terms in the model
OSrLWriter.h
OSrLWriter
Take an OSResult object and write a string that validates against OSrL.
Definition: OSrLWriter.h:31
LindoSolver
the LindoSolver class solves problems using Lindo.
Definition: OSLindoSolver.h:50
LindoSolver::buildSolverInstance
virtual void buildSolverInstance()
buildSolverInstance is a virtual function – the actual solvers will implement their own buildSolverIn...
OSInstance.h
This file defines the OSInstance class along with its supporting classes.
LindoSolver::processConstraints
bool processConstraints()
read the OSiL instance constraints and put these into the LINDO API constraints
LindoSolver::lindoAPIErrorCheck
void lindoAPIErrorCheck(std::string errormsg)
Lindo's generalized error Reporting function.
LindoSolver::LindoSolver
LindoSolver()
the LindoSolver class constructor
OSiLWriter.h
LindoSolver::solve
virtual void solve()
solve results in an instance being read into the Lindo data structures and optimized
OSiLReader.h
LindoSolver::addSlackVars
bool addSlackVars()
LINDO does not handle constraints with upper and lower bounds this method is part of kludge where we ...
OSDefaultSolver.h
LindoSolver::~LindoSolver
~LindoSolver()
the LindoSolver class destructor
LindoSolver::setSolverOptions
virtual void setSolverOptions()
The implementation of the virtual functions.
LindoSolver::dataEchoCheck
void dataEchoCheck()
use this for debugging, print out the instance that the solver thinks it has and compare this with th...
ErrorClass
used for throwing exceptions.
Definition: OSErrorClass.h:32
LindoSolver::processQuadraticTerms
bool processQuadraticTerms()
read the quadratic terms in the model
LindoSolver::optimize
bool optimize()
invoke the Lindo API solver
DefaultSolver
The Default Solver Class.
Definition: OSDefaultSolver.h:36
LindoSolver::m_osilreader
OSiLReader * m_osilreader
m_osilreader is an OSiLReader object used to create an osinstance from an osil string if needed
Definition: OSLindoSolver.h:129