My Project
OSrLParserData.cpp
Go to the documentation of this file.
1
15#define PARSERDATA_DEBUG
16
17#include "OSrLParserData.h"
18
20 if(numberOfSolutions > 0){
21#ifdef PARSERDATA_DEBUG
22 std::cout << "delete objectiveIdx" << std::endl;
23#endif
24 if(objectiveIdx != NULL) delete[] objectiveIdx;
25 objectiveIdx = NULL;
26 for(int i = 0; i < numberOfSolutions; i++){
27#ifdef PARSERDATA_DEBUG
28 std::cout << "delete primalSolution" << std::endl;
29#endif
30 if(primalSolution[ i] != NULL) delete[] primalSolution[ i];
31 primalSolution[ i] = NULL;
32 // now delete other var
33 for(int k = 0; k < numberOfOtherVariableResults; k++){
34 // the following delete gets rid of otherVarText in otherVarStruct
35#ifdef PARSERDATA_DEBUG
36 std::cout << "delete otherVarText" << std::endl;
37#endif
38 if( (otherVarVec[ k] != NULL) && (otherVarVec[ k]->otherVarText != NULL) )
39 delete[] otherVarVec[ k]->otherVarText;
40 if( (otherVarVec[ k] != NULL) && (otherVarVec[ k]->otherVarIndex != NULL) )
41 delete[] otherVarVec[ k]->otherVarIndex;
42
43 // the following should delete each of otherVarStruct created
44 // each element of otherVarVec is a pointer to an otherVarStruct
45#ifdef PARSERDATA_DEBUG
46 std::cout << "delete otherVarVec" << std::endl;
47#endif
48 if( otherVarVec[ k] != NULL) delete otherVarVec[ k];
49 }
50#ifdef PARSERDATA_DEBUG
51 std::cout << "clear otherVarVec" << std::endl;
52#endif
53 otherVarVec.clear();
54#ifdef PARSERDATA_DEBUG
55 std::cout << "delete dualSolution" << std::endl;
56#endif
57 if( (dualSolution != NULL) && (numberOfConstraints > 0) ) {
58 if(dualSolution[ i] != NULL) delete[] dualSolution[ i];
59 dualSolution[ i] = NULL;
60 }
61#ifdef PARSERDATA_DEBUG
62 std::cout << "delete objectiveValues" << std::endl;
63#endif
64 if( (objectiveValues != NULL) && (objectiveValues[i] != NULL) ) delete[] objectiveValues[i];
65 objectiveValues[i] = NULL;
66 }
67 }
68#ifdef PARSERDATA_DEBUG
69 std::cout << "delete primalSolution" << std::endl;
70#endif
71 if(primalSolution != NULL) delete[] primalSolution;
72 primalSolution = NULL;
73#ifdef PARSERDATA_DEBUG
74 std::cout << "delete dualSolution" << std::endl;
75#endif
76 if(dualSolution != NULL) delete[] dualSolution;
77 dualSolution = NULL;
78#ifdef PARSERDATA_DEBUG
79 std::cout << "delete objectiveValues" << std::endl;
80#endif
81 if(objectiveValues != NULL) delete[] objectiveValues;
82 objectiveValues = NULL;
83#ifdef PARSERDATA_DEBUG
84 std::cout << "success" << std::endl;
85#endif
86
87
88 }//~OSrLParserData
89
90
92 statusType(""),
93 statusDescription(""),
94 timeValue(0.0),
95 timeType("elapsedTime"),
96 timeCategory("total"),
97 timeUnit("second"),
98 timeDescription(""),
99 numberOfTimes(0),
100 tmpOtherValue(""),
101 tmpOtherName(""),
102 tmpOtherDescription(""),
103
104 numberOfSolutions(0),
105 numberOfVariables(0),
106 numberOfConstraints(0),
107 numberOfObjectives(0),
108 kounter( 0),
109 iOther(0),
110 ivar(0),
111 tempVal(0.0),
112 outStr(""),
113 numberOfOtherVariableResults( 0),
114 solutionIdx( 0),
115 statusTypePresent( false),
116 generalStatusTypePresent( false),
117 otherNamePresent( false),
118 objectiveIdx( NULL),
119 objectiveValues( NULL),
120 primalSolution( NULL),
121 dualSolution( NULL),
122 otherVarStruct( NULL),
123 errorText(NULL)
124 {
125
126 }//OSrLParserData
127
unsigned int numberOfSolutions
number of result solutions
int numberOfOtherVariableResults
the number of types of variable results other than the value of the variable
double ** primalSolution
for each solution we have a pointer to each primal solution
int * objectiveIdx
pointer to the array of objective function indexes in each solution
OSrLParserData()
the OSrLParserData class constructor
int numberOfConstraints
total number of constraints in the model instance
double ** dualSolution
for each solution we have a pointer to each dual solution
std::vector< OtherVariableResultStruct * > otherVarVec
store a vector of pointers to otherVarVec structures
double ** objectiveValues
for each solution we have a pointer to the value of each objective function