0
16
0
23
20
4
25
20
4
2
20
30
4
26
68
6
48
... | ... |
@@ -55,12 +55,15 @@ |
55 | 55 |
_prob->setProblemName("LEMON"); |
56 | 56 |
_osi_solver = 0; |
57 | 57 |
_cbc_model = 0; |
58 |
messageLevel(MESSAGE_NOTHING); |
|
58 | 59 |
} |
59 | 60 |
|
60 | 61 |
CbcMip::CbcMip(const CbcMip& other) { |
61 | 62 |
_prob = new CoinModel(*other._prob); |
63 |
_prob->setProblemName("LEMON"); |
|
62 | 64 |
_osi_solver = 0; |
63 | 65 |
_cbc_model = 0; |
66 |
messageLevel(MESSAGE_NOTHING); |
|
64 | 67 |
} |
65 | 68 |
|
66 | 69 |
CbcMip::~CbcMip() { |
... | ... |
@@ -270,24 +273,8 @@ |
270 | 273 |
} |
271 | 274 |
_cbc_model= new CbcModel(*_osi_solver); |
272 | 275 |
|
273 |
switch (_message_level) { |
|
274 |
case MESSAGE_NO_OUTPUT: |
|
275 |
_osi_solver->messageHandler()->setLogLevel(0); |
|
276 |
_cbc_model->setLogLevel(0); |
|
277 |
break; |
|
278 |
case MESSAGE_ERROR_MESSAGE: |
|
279 |
_osi_solver->messageHandler()->setLogLevel(1); |
|
280 |
_cbc_model->setLogLevel(1); |
|
281 |
break; |
|
282 |
case MESSAGE_NORMAL_OUTPUT: |
|
283 |
_osi_solver->messageHandler()->setLogLevel(2); |
|
284 |
_cbc_model->setLogLevel(2); |
|
285 |
break; |
|
286 |
case MESSAGE_FULL_OUTPUT: |
|
287 |
_osi_solver->messageHandler()->setLogLevel(3); |
|
288 |
_cbc_model->setLogLevel(3); |
|
289 |
break; |
|
290 |
} |
|
276 |
_osi_solver->messageHandler()->setLogLevel(_message_level); |
|
277 |
_cbc_model->setLogLevel(_message_level); |
|
291 | 278 |
|
292 | 279 |
_cbc_model->initialSolve(); |
293 | 280 |
_cbc_model->solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); |
... | ... |
@@ -453,8 +440,24 @@ |
453 | 440 |
cols.clear(); |
454 | 441 |
} |
455 | 442 |
|
456 |
void CbcMip::messageLevel(MessageLevel m) { |
|
457 |
_message_level = m; |
|
443 |
void CbcMip::_messageLevel(MessageLevel level) { |
|
444 |
switch (level) { |
|
445 |
case MESSAGE_NOTHING: |
|
446 |
_message_level = 0; |
|
447 |
break; |
|
448 |
case MESSAGE_ERROR: |
|
449 |
_message_level = 1; |
|
450 |
break; |
|
451 |
case MESSAGE_WARNING: |
|
452 |
_message_level = 1; |
|
453 |
break; |
|
454 |
case MESSAGE_NORMAL: |
|
455 |
_message_level = 2; |
|
456 |
break; |
|
457 |
case MESSAGE_VERBOSE: |
|
458 |
_message_level = 3; |
|
459 |
break; |
|
460 |
} |
|
458 | 461 |
} |
459 | 462 |
|
460 | 463 |
} //END OF NAMESPACE LEMON |
... | ... |
@@ -115,33 +115,12 @@ |
115 | 115 |
|
116 | 116 |
virtual void _clear(); |
117 | 117 |
|
118 |
|
|
118 |
virtual void _messageLevel(MessageLevel level); |
|
119 |
void _applyMessageLevel(); |
|
119 | 120 |
|
120 |
///Enum for \c messageLevel() parameter |
|
121 |
enum MessageLevel { |
|
122 |
/// no output (default value) |
|
123 |
MESSAGE_NO_OUTPUT = 0, |
|
124 |
/// error messages only |
|
125 |
MESSAGE_ERROR_MESSAGE = 1, |
|
126 |
/// normal output |
|
127 |
MESSAGE_NORMAL_OUTPUT = 2, |
|
128 |
/// full output (includes informational messages) |
|
129 |
MESSAGE_FULL_OUTPUT = 3 |
|
130 |
|
|
121 |
int _message_level; |
|
131 | 122 |
|
132 |
private: |
|
133 |
|
|
134 |
MessageLevel _message_level; |
|
135 |
|
|
136 |
public: |
|
137 |
|
|
138 |
///Set the verbosity of the messages |
|
139 |
|
|
140 |
///Set the verbosity of the messages |
|
141 |
/// |
|
142 |
///\param m is the level of the messages output by the solver routines. |
|
143 |
void messageLevel(MessageLevel m); |
|
144 |
|
|
123 |
|
|
145 | 124 |
|
146 | 125 |
}; |
147 | 126 |
... | ... |
@@ -24,7 +24,7 @@ |
24 | 24 |
ClpLp::ClpLp() { |
25 | 25 |
_prob = new ClpSimplex(); |
26 | 26 |
_init_temporals(); |
27 |
messageLevel( |
|
27 |
messageLevel(MESSAGE_NOTHING); |
|
28 | 28 |
} |
29 | 29 |
|
30 | 30 |
ClpLp::ClpLp(const ClpLp& other) { |
... | ... |
@@ -32,7 +32,7 @@ |
32 | 32 |
rows = other.rows; |
33 | 33 |
cols = other.cols; |
34 | 34 |
_init_temporals(); |
35 |
messageLevel( |
|
35 |
messageLevel(MESSAGE_NOTHING); |
|
36 | 36 |
} |
37 | 37 |
|
38 | 38 |
ClpLp::~ClpLp() { |
... | ... |
@@ -430,8 +430,24 @@ |
430 | 430 |
_clear_temporals(); |
431 | 431 |
} |
432 | 432 |
|
433 |
void ClpLp::messageLevel(MessageLevel m) { |
|
434 |
_prob->setLogLevel(static_cast<int>(m)); |
|
433 |
void ClpLp::_messageLevel(MessageLevel level) { |
|
434 |
switch (level) { |
|
435 |
case MESSAGE_NOTHING: |
|
436 |
_prob->setLogLevel(0); |
|
437 |
break; |
|
438 |
case MESSAGE_ERROR: |
|
439 |
_prob->setLogLevel(1); |
|
440 |
break; |
|
441 |
case MESSAGE_WARNING: |
|
442 |
_prob->setLogLevel(2); |
|
443 |
break; |
|
444 |
case MESSAGE_NORMAL: |
|
445 |
_prob->setLogLevel(3); |
|
446 |
break; |
|
447 |
case MESSAGE_VERBOSE: |
|
448 |
_prob->setLogLevel(4); |
|
449 |
break; |
|
450 |
} |
|
435 | 451 |
} |
436 | 452 |
|
437 | 453 |
} //END OF NAMESPACE LEMON |
... | ... |
@@ -136,6 +136,8 @@ |
136 | 136 |
|
137 | 137 |
virtual void _clear(); |
138 | 138 |
|
139 |
virtual void _messageLevel(MessageLevel); |
|
140 |
|
|
139 | 141 |
public: |
140 | 142 |
|
141 | 143 |
///Solves LP with primal simplex method. |
... | ... |
@@ -153,26 +155,6 @@ |
153 | 155 |
///Returns the variable identifier understood by CLP. |
154 | 156 |
int clpCol(Col c) const { return cols(id(c)); } |
155 | 157 |
|
156 |
///Enum for \c messageLevel() parameter |
|
157 |
enum MessageLevel { |
|
158 |
/// no output (default value) |
|
159 |
MESSAGE_NO_OUTPUT = 0, |
|
160 |
/// print final solution |
|
161 |
MESSAGE_FINAL_SOLUTION = 1, |
|
162 |
/// print factorization |
|
163 |
MESSAGE_FACTORIZATION = 2, |
|
164 |
/// normal output |
|
165 |
MESSAGE_NORMAL_OUTPUT = 3, |
|
166 |
/// verbose output |
|
167 |
MESSAGE_VERBOSE_OUTPUT = 4 |
|
168 |
}; |
|
169 |
///Set the verbosity of the messages |
|
170 |
|
|
171 |
///Set the verbosity of the messages |
|
172 |
/// |
|
173 |
///\param m is the level of the messages output by the solver routines. |
|
174 |
void messageLevel(MessageLevel m); |
|
175 |
|
|
176 | 158 |
}; |
177 | 159 |
|
178 | 160 |
} //END OF NAMESPACE LEMON |
... | ... |
@@ -72,12 +72,14 @@ |
72 | 72 |
CplexBase::CplexBase() : LpBase() { |
73 | 73 |
int status; |
74 | 74 |
_prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem"); |
75 |
messageLevel(MESSAGE_NOTHING); |
|
75 | 76 |
} |
76 | 77 |
|
77 | 78 |
CplexBase::CplexBase(const CplexEnv& env) |
78 | 79 |
: LpBase(), _env(env) { |
79 | 80 |
int status; |
80 | 81 |
_prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem"); |
82 |
messageLevel(MESSAGE_NOTHING); |
|
81 | 83 |
} |
82 | 84 |
|
83 | 85 |
CplexBase::CplexBase(const CplexBase& cplex) |
... | ... |
@@ -86,6 +88,7 @@ |
86 | 88 |
_prob = CPXcloneprob(cplexEnv(), cplex._prob, &status); |
87 | 89 |
rows = cplex.rows; |
88 | 90 |
cols = cplex.cols; |
91 |
messageLevel(MESSAGE_NOTHING); |
|
89 | 92 |
} |
90 | 93 |
|
91 | 94 |
CplexBase::~CplexBase() { |
... | ... |
@@ -438,6 +441,25 @@ |
438 | 441 |
cols.clear(); |
439 | 442 |
} |
440 | 443 |
|
444 |
void CplexBase::_messageLevel(MessageLevel level) { |
|
445 |
switch (level) { |
|
446 |
case MESSAGE_NOTHING: |
|
447 |
_message_enabled = false; |
|
448 |
break; |
|
449 |
case MESSAGE_ERROR: |
|
450 |
case MESSAGE_WARNING: |
|
451 |
case MESSAGE_NORMAL: |
|
452 |
case MESSAGE_VERBOSE: |
|
453 |
_message_enabled = true; |
|
454 |
break; |
|
455 |
} |
|
456 |
} |
|
457 |
|
|
458 |
void CplexBase::_applyMessageLevel() { |
|
459 |
CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND, |
|
460 |
_message_enabled ? CPX_ON : CPX_OFF); |
|
461 |
} |
|
462 |
|
|
441 | 463 |
// CplexLp members |
442 | 464 |
|
443 | 465 |
CplexLp::CplexLp() |
... | ... |
@@ -507,21 +529,25 @@ |
507 | 529 |
|
508 | 530 |
CplexLp::SolveExitStatus CplexLp::_solve() { |
509 | 531 |
_clear_temporals(); |
532 |
_applyMessageLevel(); |
|
510 | 533 |
return convertStatus(CPXlpopt(cplexEnv(), _prob)); |
511 | 534 |
} |
512 | 535 |
|
513 | 536 |
CplexLp::SolveExitStatus CplexLp::solvePrimal() { |
514 | 537 |
_clear_temporals(); |
538 |
_applyMessageLevel(); |
|
515 | 539 |
return convertStatus(CPXprimopt(cplexEnv(), _prob)); |
516 | 540 |
} |
517 | 541 |
|
518 | 542 |
CplexLp::SolveExitStatus CplexLp::solveDual() { |
519 | 543 |
_clear_temporals(); |
544 |
_applyMessageLevel(); |
|
520 | 545 |
return convertStatus(CPXdualopt(cplexEnv(), _prob)); |
521 | 546 |
} |
522 | 547 |
|
523 | 548 |
CplexLp::SolveExitStatus CplexLp::solveBarrier() { |
524 | 549 |
_clear_temporals(); |
550 |
_applyMessageLevel(); |
|
525 | 551 |
return convertStatus(CPXbaropt(cplexEnv(), _prob)); |
526 | 552 |
} |
527 | 553 |
|
... | ... |
@@ -600,7 +626,7 @@ |
600 | 626 |
return _dual_ray[i]; |
601 | 627 |
} |
602 | 628 |
|
603 |
// |
|
629 |
// Cplex 7.0 status values |
|
604 | 630 |
// This table lists the statuses, returned by the CPXgetstat() |
605 | 631 |
// routine, for solutions to LP problems or mixed integer problems. If |
606 | 632 |
// no solution exists, the return value is zero. |
... | ... |
@@ -647,7 +673,7 @@ |
647 | 673 |
// 20 CPX_PIVOT |
648 | 674 |
// User pivot used |
649 | 675 |
// |
650 |
// |
|
676 |
// Pending return values |
|
651 | 677 |
// ??case CPX_ABORT_DUAL_INFEAS |
652 | 678 |
// ??case CPX_ABORT_CROSSOVER |
653 | 679 |
// ??case CPX_INForUNBD |
... | ... |
@@ -718,7 +744,6 @@ |
718 | 744 |
#else |
719 | 745 |
statusSwitch(cplexEnv(),stat); |
720 | 746 |
//CPXgetstat(cplexEnv(), _prob); |
721 |
//printf("A primal status: %d, CPX_OPTIMAL=%d \n",stat,CPX_OPTIMAL); |
|
722 | 747 |
switch (stat) { |
723 | 748 |
case 0: |
724 | 749 |
return UNDEFINED; //Undefined |
... | ... |
@@ -751,7 +776,7 @@ |
751 | 776 |
#endif |
752 | 777 |
} |
753 | 778 |
|
754 |
//9.0 |
|
779 |
// Cplex 9.0 status values |
|
755 | 780 |
// CPX_STAT_ABORT_DUAL_OBJ_LIM |
756 | 781 |
// CPX_STAT_ABORT_IT_LIM |
757 | 782 |
// CPX_STAT_ABORT_OBJ_LIM |
... | ... |
@@ -864,6 +889,7 @@ |
864 | 889 |
|
865 | 890 |
CplexMip::SolveExitStatus CplexMip::_solve() { |
866 | 891 |
int status; |
892 |
_applyMessageLevel(); |
|
867 | 893 |
status = CPXmipopt (cplexEnv(), _prob); |
868 | 894 |
if (status==0) |
869 | 895 |
return SOLVED; |
... | ... |
@@ -144,14 +144,29 @@ |
144 | 144 |
|
145 | 145 |
virtual void _clear(); |
146 | 146 |
|
147 |
virtual void _messageLevel(MessageLevel level); |
|
148 |
void _applyMessageLevel(); |
|
149 |
|
|
150 |
bool _message_enabled; |
|
151 |
|
|
147 | 152 |
public: |
148 | 153 |
|
149 | 154 |
/// Returns the used \c CplexEnv instance |
150 | 155 |
const CplexEnv& env() const { return _env; } |
156 |
|
|
157 |
/// \brief Returns the const cpxenv pointer |
|
151 | 158 |
/// |
159 |
/// \note The cpxenv might be destructed with the solver. |
|
152 | 160 |
const cpxenv* cplexEnv() const { return _env.cplexEnv(); } |
153 | 161 |
|
162 |
/// \brief Returns the const cpxenv pointer |
|
163 |
/// |
|
164 |
/// \note The cpxenv might be destructed with the solver. |
|
165 |
cpxenv* cplexEnv() { return _env.cplexEnv(); } |
|
166 |
|
|
167 |
/// Returns the cplex problem object |
|
154 | 168 |
cpxlp* cplexLp() { return _prob; } |
169 |
/// Returns the cplex problem object |
|
155 | 170 |
const cpxlp* cplexLp() const { return _prob; } |
156 | 171 |
|
157 | 172 |
}; |
... | ... |
@@ -31,6 +31,7 @@ |
31 | 31 |
GlpkBase::GlpkBase() : LpBase() { |
32 | 32 |
lp = glp_create_prob(); |
33 | 33 |
glp_create_index(lp); |
34 |
messageLevel(MESSAGE_NOTHING); |
|
34 | 35 |
} |
35 | 36 |
|
36 | 37 |
GlpkBase::GlpkBase(const GlpkBase &other) : LpBase() { |
... | ... |
@@ -39,6 +40,7 @@ |
39 | 40 |
glp_create_index(lp); |
40 | 41 |
rows = other.rows; |
41 | 42 |
cols = other.cols; |
43 |
messageLevel(MESSAGE_NOTHING); |
|
42 | 44 |
} |
43 | 45 |
|
44 | 46 |
GlpkBase::~GlpkBase() { |
... | ... |
@@ -526,19 +528,37 @@ |
526 | 528 |
glp_free_env(); |
527 | 529 |
} |
528 | 530 |
|
531 |
void GlpkBase::_messageLevel(MessageLevel level) { |
|
532 |
switch (level) { |
|
533 |
case MESSAGE_NOTHING: |
|
534 |
_message_level = GLP_MSG_OFF; |
|
535 |
break; |
|
536 |
case MESSAGE_ERROR: |
|
537 |
_message_level = GLP_MSG_ERR; |
|
538 |
break; |
|
539 |
case MESSAGE_WARNING: |
|
540 |
_message_level = GLP_MSG_ERR; |
|
541 |
break; |
|
542 |
case MESSAGE_NORMAL: |
|
543 |
_message_level = GLP_MSG_ON; |
|
544 |
break; |
|
545 |
case MESSAGE_VERBOSE: |
|
546 |
_message_level = GLP_MSG_ALL; |
|
547 |
break; |
|
548 |
} |
|
549 |
} |
|
550 |
|
|
529 | 551 |
GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper; |
530 | 552 |
|
531 | 553 |
// GlpkLp members |
532 | 554 |
|
533 | 555 |
GlpkLp::GlpkLp() |
534 | 556 |
: LpBase(), LpSolver(), GlpkBase() { |
535 |
messageLevel(MESSAGE_NO_OUTPUT); |
|
536 | 557 |
presolver(false); |
537 | 558 |
} |
538 | 559 |
|
539 | 560 |
GlpkLp::GlpkLp(const GlpkLp& other) |
540 | 561 |
: LpBase(other), LpSolver(other), GlpkBase(other) { |
541 |
messageLevel(MESSAGE_NO_OUTPUT); |
|
542 | 562 |
presolver(false); |
543 | 563 |
} |
544 | 564 |
|
... | ... |
@@ -562,20 +582,7 @@ |
562 | 582 |
glp_smcp smcp; |
563 | 583 |
glp_init_smcp(&smcp); |
564 | 584 |
|
565 |
switch (_message_level) { |
|
566 |
case MESSAGE_NO_OUTPUT: |
|
567 |
smcp.msg_lev = GLP_MSG_OFF; |
|
568 |
break; |
|
569 |
case MESSAGE_ERROR_MESSAGE: |
|
570 |
smcp.msg_lev = GLP_MSG_ERR; |
|
571 |
break; |
|
572 |
case MESSAGE_NORMAL_OUTPUT: |
|
573 |
smcp.msg_lev = GLP_MSG_ON; |
|
574 |
break; |
|
575 |
case MESSAGE_FULL_OUTPUT: |
|
576 |
smcp.msg_lev = GLP_MSG_ALL; |
|
577 |
break; |
|
578 |
} |
|
585 |
smcp.msg_lev = _message_level; |
|
579 | 586 |
smcp.presolve = _presolve; |
580 | 587 |
|
581 | 588 |
// If the basis is not valid we get an error return value. |
... | ... |
@@ -604,20 +611,7 @@ |
604 | 611 |
glp_smcp smcp; |
605 | 612 |
glp_init_smcp(&smcp); |
606 | 613 |
|
607 |
switch (_message_level) { |
|
608 |
case MESSAGE_NO_OUTPUT: |
|
609 |
smcp.msg_lev = GLP_MSG_OFF; |
|
610 |
break; |
|
611 |
case MESSAGE_ERROR_MESSAGE: |
|
612 |
smcp.msg_lev = GLP_MSG_ERR; |
|
613 |
break; |
|
614 |
case MESSAGE_NORMAL_OUTPUT: |
|
615 |
smcp.msg_lev = GLP_MSG_ON; |
|
616 |
break; |
|
617 |
case MESSAGE_FULL_OUTPUT: |
|
618 |
smcp.msg_lev = GLP_MSG_ALL; |
|
619 |
break; |
|
620 |
} |
|
614 |
smcp.msg_lev = _message_level; |
|
621 | 615 |
smcp.meth = GLP_DUAL; |
622 | 616 |
smcp.presolve = _presolve; |
623 | 617 |
|
... | ... |
@@ -858,20 +852,14 @@ |
858 | 852 |
_presolve = presolve; |
859 | 853 |
} |
860 | 854 |
|
861 |
void GlpkLp::messageLevel(MessageLevel m) { |
|
862 |
_message_level = m; |
|
863 |
} |
|
864 |
|
|
865 | 855 |
// GlpkMip members |
866 | 856 |
|
867 | 857 |
GlpkMip::GlpkMip() |
868 | 858 |
: LpBase(), MipSolver(), GlpkBase() { |
869 |
messageLevel(MESSAGE_NO_OUTPUT); |
|
870 | 859 |
} |
871 | 860 |
|
872 | 861 |
GlpkMip::GlpkMip(const GlpkMip& other) |
873 | 862 |
: LpBase(), MipSolver(), GlpkBase(other) { |
874 |
messageLevel(MESSAGE_NO_OUTPUT); |
|
875 | 863 |
} |
876 | 864 |
|
877 | 865 |
void GlpkMip::_setColType(int i, GlpkMip::ColTypes col_type) { |
... | ... |
@@ -900,20 +888,7 @@ |
900 | 888 |
glp_smcp smcp; |
901 | 889 |
glp_init_smcp(&smcp); |
902 | 890 |
|
903 |
switch (_message_level) { |
|
904 |
case MESSAGE_NO_OUTPUT: |
|
905 |
smcp.msg_lev = GLP_MSG_OFF; |
|
906 |
break; |
|
907 |
case MESSAGE_ERROR_MESSAGE: |
|
908 |
smcp.msg_lev = GLP_MSG_ERR; |
|
909 |
break; |
|
910 |
case MESSAGE_NORMAL_OUTPUT: |
|
911 |
smcp.msg_lev = GLP_MSG_ON; |
|
912 |
break; |
|
913 |
case MESSAGE_FULL_OUTPUT: |
|
914 |
smcp.msg_lev = GLP_MSG_ALL; |
|
915 |
break; |
|
916 |
} |
|
891 |
smcp.msg_lev = _message_level; |
|
917 | 892 |
smcp.meth = GLP_DUAL; |
918 | 893 |
|
919 | 894 |
// If the basis is not valid we get an error return value. |
... | ... |
@@ -938,20 +913,7 @@ |
938 | 913 |
glp_iocp iocp; |
939 | 914 |
glp_init_iocp(&iocp); |
940 | 915 |
|
941 |
switch (_message_level) { |
|
942 |
case MESSAGE_NO_OUTPUT: |
|
943 |
iocp.msg_lev = GLP_MSG_OFF; |
|
944 |
break; |
|
945 |
case MESSAGE_ERROR_MESSAGE: |
|
946 |
iocp.msg_lev = GLP_MSG_ERR; |
|
947 |
break; |
|
948 |
case MESSAGE_NORMAL_OUTPUT: |
|
949 |
iocp.msg_lev = GLP_MSG_ON; |
|
950 |
break; |
|
951 |
case MESSAGE_FULL_OUTPUT: |
|
952 |
iocp.msg_lev = GLP_MSG_ALL; |
|
953 |
break; |
|
954 |
} |
|
916 |
iocp.msg_lev = _message_level; |
|
955 | 917 |
|
956 | 918 |
if (glp_intopt(lp, &iocp) != 0) return UNSOLVED; |
957 | 919 |
return SOLVED; |
... | ... |
@@ -1002,8 +964,4 @@ |
1002 | 964 |
|
1003 | 965 |
const char* GlpkMip::_solverName() const { return "GlpkMip"; } |
1004 | 966 |
|
1005 |
void GlpkMip::messageLevel(MessageLevel m) { |
|
1006 |
_message_level = m; |
|
1007 |
} |
|
1008 |
|
|
1009 | 967 |
} //END OF NAMESPACE LEMON |
... | ... |
@@ -100,6 +100,8 @@ |
100 | 100 |
|
101 | 101 |
virtual void _clear(); |
102 | 102 |
|
103 |
virtual void _messageLevel(MessageLevel level); |
|
104 |
|
|
103 | 105 |
private: |
104 | 106 |
|
105 | 107 |
static void freeEnv(); |
... | ... |
@@ -111,6 +113,10 @@ |
111 | 113 |
}; |
112 | 114 |
|
113 | 115 |
static FreeEnvHelper freeEnvHelper; |
116 |
|
|
117 |
protected: |
|
118 |
|
|
119 |
int _message_level; |
|
114 | 120 |
|
115 | 121 |
public: |
116 | 122 |
|
... | ... |
@@ -191,30 +197,6 @@ |
191 | 197 |
///The presolver is off by default. |
192 | 198 |
void presolver(bool presolve); |
193 | 199 |
|
194 |
///Enum for \c messageLevel() parameter |
|
195 |
enum MessageLevel { |
|
196 |
/// no output (default value) |
|
197 |
MESSAGE_NO_OUTPUT = 0, |
|
198 |
/// error messages only |
|
199 |
MESSAGE_ERROR_MESSAGE = 1, |
|
200 |
/// normal output |
|
201 |
MESSAGE_NORMAL_OUTPUT = 2, |
|
202 |
/// full output (includes informational messages) |
|
203 |
MESSAGE_FULL_OUTPUT = 3 |
|
204 |
}; |
|
205 |
|
|
206 |
private: |
|
207 |
|
|
208 |
MessageLevel _message_level; |
|
209 |
|
|
210 |
public: |
|
211 |
|
|
212 |
///Set the verbosity of the messages |
|
213 |
|
|
214 |
///Set the verbosity of the messages |
|
215 |
/// |
|
216 |
///\param m is the level of the messages output by the solver routines. |
|
217 |
void messageLevel(MessageLevel m); |
|
218 | 200 |
}; |
219 | 201 |
|
220 | 202 |
/// \brief Interface for the GLPK MIP solver |
... | ... |
@@ -244,30 +226,6 @@ |
244 | 226 |
virtual Value _getSol(int i) const; |
245 | 227 |
virtual Value _getSolValue() const; |
246 | 228 |
|
247 |
///Enum for \c messageLevel() parameter |
|
248 |
enum MessageLevel { |
|
249 |
/// no output (default value) |
|
250 |
MESSAGE_NO_OUTPUT = 0, |
|
251 |
/// error messages only |
|
252 |
MESSAGE_ERROR_MESSAGE = 1, |
|
253 |
/// normal output |
|
254 |
MESSAGE_NORMAL_OUTPUT = 2, |
|
255 |
/// full output (includes informational messages) |
|
256 |
MESSAGE_FULL_OUTPUT = 3 |
|
257 |
}; |
|
258 |
|
|
259 |
private: |
|
260 |
|
|
261 |
MessageLevel _message_level; |
|
262 |
|
|
263 |
public: |
|
264 |
|
|
265 |
///Set the verbosity of the messages |
|
266 |
|
|
267 |
///Set the verbosity of the messages |
|
268 |
/// |
|
269 |
///\param m is the level of the messages output by the solver routines. |
|
270 |
void messageLevel(MessageLevel m); |
|
271 | 229 |
}; |
272 | 230 |
|
273 | 231 |
... | ... |
@@ -69,6 +69,21 @@ |
69 | 69 |
MAX |
70 | 70 |
}; |
71 | 71 |
|
72 |
///Enum for \c messageLevel() parameter |
|
73 |
enum MessageLevel { |
|
74 |
/// no output (default value) |
|
75 |
MESSAGE_NOTHING, |
|
76 |
/// error messages only |
|
77 |
MESSAGE_ERROR, |
|
78 |
/// warnings |
|
79 |
MESSAGE_WARNING, |
|
80 |
/// normal output |
|
81 |
MESSAGE_NORMAL, |
|
82 |
/// verbose output |
|
83 |
MESSAGE_VERBOSE |
|
84 |
}; |
|
85 |
|
|
86 |
|
|
72 | 87 |
///The floating point type used by the solver |
73 | 88 |
typedef double Value; |
74 | 89 |
///The infinity constant |
... | ... |
@@ -973,6 +988,8 @@ |
973 | 988 |
|
974 | 989 |
virtual const char* _solverName() const = 0; |
975 | 990 |
|
991 |
virtual void _messageLevel(MessageLevel level) = 0; |
|
992 |
|
|
976 | 993 |
//Own protected stuff |
977 | 994 |
|
978 | 995 |
//Constant component of the objective function |
... | ... |
@@ -1527,6 +1544,9 @@ |
1527 | 1544 |
///Clears the problem |
1528 | 1545 |
void clear() { _clear(); } |
1529 | 1546 |
|
1547 |
/// Sets the message level of the solver |
|
1548 |
void messageLevel(MessageLevel level) { _messageLevel(level); } |
|
1549 |
|
|
1530 | 1550 |
///@} |
1531 | 1551 |
|
1532 | 1552 |
}; |
... | ... |
@@ -20,6 +20,7 @@ |
20 | 20 |
#include <lemon/soplex.h> |
21 | 21 |
|
22 | 22 |
#include <soplex.h> |
23 |
#include <spxout.h> |
|
23 | 24 |
|
24 | 25 |
|
25 | 26 |
///\file |
... | ... |
@@ -28,6 +29,7 @@ |
28 | 29 |
|
29 | 30 |
SoplexLp::SoplexLp() { |
30 | 31 |
soplex = new soplex::SoPlex; |
32 |
messageLevel(MESSAGE_NOTHING); |
|
31 | 33 |
} |
32 | 34 |
|
33 | 35 |
SoplexLp::~SoplexLp() { |
... | ... |
@@ -47,6 +49,7 @@ |
47 | 49 |
_row_names = lp._row_names; |
48 | 50 |
_row_names_ref = lp._row_names_ref; |
49 | 51 |
|
52 |
messageLevel(MESSAGE_NOTHING); |
|
50 | 53 |
} |
51 | 54 |
|
52 | 55 |
void SoplexLp::_clear_temporals() { |
... | ... |
@@ -271,6 +274,8 @@ |
271 | 274 |
SoplexLp::SolveExitStatus SoplexLp::_solve() { |
272 | 275 |
|
273 | 276 |
_clear_temporals(); |
277 |
|
|
278 |
_applyMessageLevel(); |
|
274 | 279 |
|
275 | 280 |
soplex::SPxSolver::Status status = soplex->solve(); |
276 | 281 |
|
... | ... |
@@ -419,5 +424,29 @@ |
419 | 424 |
_clear_temporals(); |
420 | 425 |
} |
421 | 426 |
|
427 |
void SoplexLp::_messageLevel(MessageLevel level) { |
|
428 |
switch (level) { |
|
429 |
case MESSAGE_NOTHING: |
|
430 |
_message_level = -1; |
|
431 |
break; |
|
432 |
case MESSAGE_ERROR: |
|
433 |
_message_level = soplex::SPxOut::ERROR; |
|
434 |
break; |
|
435 |
case MESSAGE_WARNING: |
|
436 |
_message_level = soplex::SPxOut::WARNING; |
|
437 |
break; |
|
438 |
case MESSAGE_NORMAL: |
|
439 |
_message_level = soplex::SPxOut::INFO2; |
|
440 |
break; |
|
441 |
case MESSAGE_VERBOSE: |
|
442 |
_message_level = soplex::SPxOut::DEBUG; |
|
443 |
break; |
|
444 |
} |
|
445 |
} |
|
446 |
|
|
447 |
void SoplexLp::_applyMessageLevel() { |
|
448 |
soplex::Param::setVerbose(_message_level); |
|
449 |
} |
|
450 |
|
|
422 | 451 |
} //namespace lemon |
423 | 452 |
... | ... |
@@ -395,12 +395,7 @@ |
395 | 395 |
aTest(lp_cplex2); |
396 | 396 |
cloneTest<CplexLp>(); |
397 | 397 |
} catch (CplexEnv::LicenseError& error) { |
398 |
#ifdef LEMON_FORCE_CPLEX_CHECK |
|
399 | 398 |
check(false, error.what()); |
400 |
#else |
|
401 |
std::cerr << error.what() << std::endl; |
|
402 |
std::cerr << "Cplex license check failed, lp check skipped" << std::endl; |
|
403 |
#endif |
|
404 | 399 |
} |
405 | 400 |
#endif |
406 | 401 |
... | ... |
@@ -143,12 +143,7 @@ |
143 | 143 |
aTest(mip2); |
144 | 144 |
cloneTest<CplexMip>(); |
145 | 145 |
} catch (CplexEnv::LicenseError& error) { |
146 |
#ifdef LEMON_FORCE_CPLEX_CHECK |
|
147 | 146 |
check(false, error.what()); |
148 |
#else |
|
149 |
std::cerr << error.what() << std::endl; |
|
150 |
std::cerr << "Cplex license check failed, lp check skipped" << std::endl; |
|
151 |
#endif |
|
152 | 147 |
} |
153 | 148 |
#endif |
154 | 149 |
... | ... |
@@ -89,6 +89,10 @@ |
89 | 89 |
-e "s/\<\([Ff]\)orkWriteMap\>/\1orkMap/g"\ |
90 | 90 |
-e "s/\<StoreBoolMap\>/LoggerBoolMap/g"\ |
91 | 91 |
-e "s/\<storeBoolMap\>/loggerBoolMap/g"\ |
92 |
-e "s/\<InvertableMap\>/CrossRefMap/g"\ |
|
93 |
-e "s/\<invertableMap\>/crossRefMap/g"\ |
|
94 |
-e "s/\<DescriptorMap\>/RangeIdMap/g"\ |
|
95 |
-e "s/\<descriptorMap\>/rangeIdMap/g"\ |
|
92 | 96 |
-e "s/\<BoundingBox\>/Box/g"\ |
93 | 97 |
-e "s/\<readNauty\>/readNautyGraph/g"\ |
94 | 98 |
-e "s/\<RevDigraphAdaptor\>/ReverseDigraph/g"\ |
0 comments (0 inline)