My Project
OSLindoSolver.h
Go to the documentation of this file.
1/* $Id$ */
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
50{
51
52public:
53
56
59
62 virtual void solve() ;
63
68 virtual void buildSolverInstance();
69
74 virtual void setSolverOptions();
75
76 // Lindo specific methods
77
82 bool optimize();
83
89 bool processVariables();
90
96 bool processConstraints();
97
103 bool generateLindoModel();
104
111 bool addSlackVars();
112
118
124
130
136 void dataEchoCheck();
137
138
139
140private:
141
143 pLSenv pEnv_;
144
146 pLSmodel pModel_;
147
150
154
157
162
167
171 double* m_mdVarLB;
172
176 double* m_mdVarUB;
177
181 double* m_mdConLB;
182
186 double* m_mdConUB;
187
192
196 std::string* m_msVarName;
197
201 std::string* m_msConName;
202
211 double m_mdObjConstant; // change to array later
212
215
216 double cpuTime;
217
218protected:
223 void lindoAPIErrorCheck( std::string errormsg);
224
225};
226
227
228
229#endif
The Default Solver Class.
the LindoSolver class solves problems using Lindo.
std::string * m_msVarName
m_msVarName holds an array of variable std::string names.
bool generateLindoModel()
create the LINDO environment and read the problem into the internal LINDO data structures
void dataEchoCheck()
use this for debugging, print out the instance that the solver thinks it has and compare this with th...
double m_mdObjConstant
m_mdObjConstant holds an array of objective function constants.
int m_iLindoErrorCode
m_iErrorCode is a variable for LINDO error codes
LindoSolver()
the LindoSolver class constructor
bool processConstraints()
read the OSiL instance constraints and put these into the LINDO API constraints
bool addSlackVars()
LINDO does not handle constraints with upper and lower bounds this method is part of kludge where we ...
char * m_mcRowType
m_mcRowType - E for equality, L for less than, G for greater than – used if we do not store rows usin...
double * m_mdRhsValue
m_mdRhsValue is used to the store the constraint rhs if we do not use row upper and lower bounds
bool processVariables()
read the OSiL instance variables and put these into the LINDO API variables
pLSmodel pModel_
declare an instance of the LINDO model object
OSiLReader * m_osilreader
m_osilreader is an OSiLReader object used to create an osinstance from an osil string if needed
virtual void buildSolverInstance()
buildSolverInstance is a virtual function – the actual solvers will implement their own buildSolverIn...
pLSenv pEnv_
declare an instance of the LINDO environment object
OSrLWriter * osrlwriter
osrlwriter object used to write osrl from an OSResult object
~LindoSolver()
the LindoSolver class destructor
char * m_mcVarType
m_vcVarType holds an array of variable types (character), e.g.
bool processNonlinearExpressions()
read the nonlinear terms in the model
double * m_mdConUB
m_mdRhs holds an array of the constraint upper bounds.
std::string * m_msConName
m_msConName holds an array of constraint std::string names.
char ** m_mmcVarName
m_mmcVarName holds an array of char arrays.
void lindoAPIErrorCheck(std::string errormsg)
Lindo's generalized error Reporting function.
virtual void setSolverOptions()
The implementation of the virtual functions.
bool processQuadraticTerms()
read the quadratic terms in the model
bool optimize()
invoke the Lindo API solver
virtual void solve()
solve results in an instance being read into the Lindo data structures and optimized
int m_iNumberNewSlacks
m_iNumberNewSlacks is the number of slack variables to add
int * m_miSlackIdx
because LINDO API does not take row ranges we need some extra stuff m_miSlackIdx indexes the rows tha...
double * m_mdVarLB
m_mdLb holds an array of variable lower bounds.
double * m_mdConLB
m_mdLhs holds an array of the constraint lower bounds.
double * m_mdVarUB
m_mdUb holds an array of variable upper bounds.
Used to read an OSiL string.
Definition OSiLReader.h:38
Take an OSResult object and write a string that validates against OSrL.
Definition OSrLWriter.h:31