0
4
0
| ... | ... |
@@ -523,12 +523,14 @@ |
| 523 | 523 |
} |
| 524 | 524 |
|
| 525 | 525 |
void GlpkBase::freeEnv() {
|
| 526 | 526 |
glp_free_env(); |
| 527 | 527 |
} |
| 528 | 528 |
|
| 529 |
GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper; |
|
| 530 |
|
|
| 529 | 531 |
// GlpkLp members |
| 530 | 532 |
|
| 531 | 533 |
GlpkLp::GlpkLp() |
| 532 | 534 |
: LpBase(), GlpkBase(), LpSolver() {
|
| 533 | 535 |
messageLevel(MESSAGE_NO_OUTPUT); |
| 534 | 536 |
} |
| ... | ... |
@@ -97,22 +97,26 @@ |
| 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 |
/// \brief Deallocates the globally allocated memory of GLPK. |
|
| 106 |
|
|
| 107 |
/// Deallocates the globally allocated memory of GLPK. \note |
|
| 108 |
/// Usually, it do not have to be called, because the GLPK use |
|
| 109 |
/// only a small amount of global memory, and it is deallocated |
|
| 110 |
/// automatically at the end of program. |
|
| 111 |
static void freeEnv(); |
|
| 112 |
|
|
| 113 | 117 |
///Pointer to the underlying GLPK data structure. |
| 114 | 118 |
LPX *lpx() {return lp;}
|
| 115 | 119 |
///Const pointer to the underlying GLPK data structure. |
| 116 | 120 |
const LPX *lpx() const {return lp;}
|
| 117 | 121 |
|
| 118 | 122 |
///Returns the constraint identifier understood by GLPK. |
| ... | ... |
@@ -363,13 +363,12 @@ |
| 363 | 363 |
#ifdef HAVE_GLPK |
| 364 | 364 |
{
|
| 365 | 365 |
GlpkLp lp_glpk1,lp_glpk2; |
| 366 | 366 |
lpTest(lp_glpk1); |
| 367 | 367 |
aTest(lp_glpk2); |
| 368 | 368 |
} |
| 369 |
GlpkLp::freeEnv(); |
|
| 370 | 369 |
#endif |
| 371 | 370 |
|
| 372 | 371 |
#ifdef HAVE_CPLEX |
| 373 | 372 |
try {
|
| 374 | 373 |
CplexLp lp_cplex1,lp_cplex2; |
| 375 | 374 |
lpTest(lp_cplex1); |
0 comments (0 inline)