... | ... |
@@ -519,12 +519,18 @@ |
519 | 519 |
void GlpkBase::_clear() { |
520 | 520 |
glp_erase_prob(lp); |
521 | 521 |
rows.clear(); |
522 | 522 |
cols.clear(); |
523 | 523 |
} |
524 | 524 |
|
525 |
void GlpkBase::freeEnv() { |
|
526 |
glp_free_env(); |
|
527 |
} |
|
528 |
|
|
529 |
GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper; |
|
530 |
|
|
525 | 531 |
// GlpkLp members |
526 | 532 |
|
527 | 533 |
GlpkLp::GlpkLp() |
528 | 534 |
: LpBase(), GlpkBase(), LpSolver() { |
529 | 535 |
messageLevel(MESSAGE_NO_OUTPUT); |
530 | 536 |
} |
... | ... |
@@ -97,12 +97,24 @@ |
97 | 97 |
|
98 | 98 |
virtual void _setSense(Sense); |
99 | 99 |
virtual Sense _getSense() const; |
100 | 100 |
|
101 | 101 |
virtual void _clear(); |
102 | 102 |
|
103 |
private: |
|
104 |
|
|
105 |
static void freeEnv(); |
|
106 |
|
|
107 |
struct FreeEnvHelper { |
|
108 |
~FreeEnvHelper() { |
|
109 |
freeEnv(); |
|
110 |
} |
|
111 |
}; |
|
112 |
|
|
113 |
static FreeEnvHelper freeEnvHelper; |
|
114 |
|
|
103 | 115 |
public: |
104 | 116 |
|
105 | 117 |
///Pointer to the underlying GLPK data structure. |
106 | 118 |
LPX *lpx() {return lp;} |
107 | 119 |
///Const pointer to the underlying GLPK data structure. |
108 | 120 |
const LPX *lpx() const {return lp;} |
0 comments (0 inline)