Changes in / [572:be6646ac5d89:573:37216ca5b9c6] in lemon-main
- Files:
-
- 3 added
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
INSTALL
r564 r568 151 151 152 152 Disable SoPlex support. 153 154 --with-coin[=PREFIX] 155 156 Enable support for COIN-OR solvers (CLP and CBC). You should 157 specify the prefix too. (by default, COIN-OR tools install 158 themselves to the source code directory). This command enables the 159 solvers that are actually found. 160 161 --with-coin-includedir=DIR 162 163 The directory where the COIN-OR header files are located. This is 164 only useful when the COIN-OR headers and libraries are not under 165 the same prefix (which is unlikely). 166 167 --with-coin-libdir=DIR 168 169 The directory where the COIN-OR libraries are located. This is only 170 useful when the COIN-OR headers and libraries are not under the 171 same prefix (which is unlikely). 172 173 --without-coin 174 175 Disable COIN-OR support. -
Makefile.am
r564 r567 12 12 m4/lx_check_glpk.m4 \ 13 13 m4/lx_check_soplex.m4 \ 14 m4/lx_check_clp.m4 \ 15 m4/lx_check_cbc.m4 \ 14 16 CMakeLists.txt \ 15 17 cmake/FindGhostscript.cmake \ -
configure.ac
r564 r568 60 60 LX_CHECK_CPLEX 61 61 LX_CHECK_SOPLEX 62 LX_CHECK_C LP62 LX_CHECK_COIN 63 63 64 64 AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"]) … … 120 120 echo SOPLEX support................ : $lx_soplex_found 121 121 echo CLP support................... : $lx_clp_found 122 echo CBC support................... : $lx_cbc_found 122 123 echo 123 124 echo Build additional tools........ : $enable_tools -
lemon/Makefile.am
r550 r567 13 13 lemon/lp_base.cc \ 14 14 lemon/lp_skeleton.cc \ 15 15 lemon/random.cc \ 16 16 lemon/bits/windows.cc 17 17 … … 22 22 $(CPLEX_CFLAGS) \ 23 23 $(SOPLEX_CXXFLAGS) \ 24 $(CLP_CXXFLAGS) 24 $(CLP_CXXFLAGS) \ 25 $(CBC_CXXFLAGS) 25 26 26 27 lemon_libemon_la_LDFLAGS = \ … … 28 29 $(CPLEX_LIBS) \ 29 30 $(SOPLEX_LIBS) \ 30 $(CLP_LIBS) 31 $(CLP_LIBS) \ 32 $(CBC_LIBS) 31 33 32 34 if HAVE_GLPK … … 44 46 if HAVE_CLP 45 47 lemon_libemon_la_SOURCES += lemon/clp.cc 48 endif 49 50 if HAVE_CBC 51 lemon_libemon_la_SOURCES += lemon/cbc.cc 46 52 endif 47 53 -
lemon/config.h.in
r517 r567 19 19 /* Define to 1 if you have CLP */ 20 20 #undef HAVE_CLP 21 22 /* Define to 1 if you have CBC */ 23 #undef HAVE_CBC -
lemon/glpk.cc
r551 r566 534 534 : LpBase(), LpSolver(), GlpkBase() { 535 535 messageLevel(MESSAGE_NO_OUTPUT); 536 presolver(false); 536 537 } 537 538 … … 539 540 : LpBase(other), LpSolver(other), GlpkBase(other) { 540 541 messageLevel(MESSAGE_NO_OUTPUT); 542 presolver(false); 541 543 } 542 544 … … 575 577 break; 576 578 } 577 578 if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; 579 smcp.presolve = _presolve; 580 581 // If the basis is not valid we get an error return value. 582 // In this case we can try to create a new basis. 583 switch (glp_simplex(lp, &smcp)) { 584 case 0: 585 break; 586 case GLP_EBADB: 587 case GLP_ESING: 588 case GLP_ECOND: 589 glp_term_out(false); 590 glp_adv_basis(lp, 0); 591 glp_term_out(true); 592 if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; 593 break; 594 default: 595 return UNSOLVED; 596 } 597 579 598 return SOLVED; 580 599 } … … 601 620 } 602 621 smcp.meth = GLP_DUAL; 603 604 if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; 622 smcp.presolve = _presolve; 623 624 // If the basis is not valid we get an error return value. 625 // In this case we can try to create a new basis. 626 switch (glp_simplex(lp, &smcp)) { 627 case 0: 628 break; 629 case GLP_EBADB: 630 case GLP_ESING: 631 case GLP_ECOND: 632 glp_term_out(false); 633 glp_adv_basis(lp, 0); 634 glp_term_out(true); 635 if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; 636 break; 637 default: 638 return UNSOLVED; 639 } 605 640 return SOLVED; 606 641 } … … 820 855 } 821 856 822 void GlpkLp::presolver(bool b) {823 lpx_set_int_parm(lp, LPX_K_PRESOL, b ? 1 : 0);857 void GlpkLp::presolver(bool presolve) { 858 _presolve = presolve; 824 859 } 825 860 … … 882 917 smcp.meth = GLP_DUAL; 883 918 884 if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; 919 // If the basis is not valid we get an error return value. 920 // In this case we can try to create a new basis. 921 switch (glp_simplex(lp, &smcp)) { 922 case 0: 923 break; 924 case GLP_EBADB: 925 case GLP_ESING: 926 case GLP_ECOND: 927 glp_term_out(false); 928 glp_adv_basis(lp, 0); 929 glp_term_out(true); 930 if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; 931 break; 932 default: 933 return UNSOLVED; 934 } 935 885 936 if (glp_get_status(lp) != GLP_OPT) return SOLVED; 886 937 -
lemon/glpk.h
r542 r565 179 179 SolveExitStatus solveDual(); 180 180 181 private: 182 183 bool _presolve; 184 185 public: 186 181 187 ///Turns on or off the presolver 182 188 … … 184 190 /// 185 191 ///The presolver is off by default. 186 void presolver(bool b);192 void presolver(bool presolve); 187 193 188 194 ///Enum for \c messageLevel() parameter -
test/mip_test.cc
r551 r567 19 19 #include "test_tools.h" 20 20 21 22 21 #ifdef HAVE_CONFIG_H 23 22 #include <lemon/config.h> … … 30 29 #ifdef HAVE_GLPK 31 30 #include <lemon/glpk.h> 31 #endif 32 33 #ifdef HAVE_CBC 34 #include <lemon/cbc.h> 32 35 #endif 33 36 … … 58 61 void aTest(MipSolver& mip) 59 62 { 60 //The following example is very simple63 //The following example is very simple 61 64 62 65 63 66 typedef MipSolver::Row Row; 64 67 typedef MipSolver::Col Col; 65 66 68 67 69 … … 75 77 mip.max(); 76 78 77 78 79 //Unconstrained optimization 79 80 mip.solve(); … … 81 82 82 83 //Constraints 83 mip.addRow(2 *x1+x2 <=2);84 mip.addRow(x1-2*x2 <=0);84 mip.addRow(2 * x1 + x2 <= 2); 85 Row y2 = mip.addRow(x1 - 2 * x2 <= 0); 85 86 86 87 //Nonnegativity of the variable x1 87 88 mip.colLowerBound(x1, 0); 89 88 90 89 91 //Maximization of x1 … … 91 93 double expected_opt=4.0/5.0; 92 94 solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt); 95 93 96 94 97 //Restrict x2 to integer … … 103 106 solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt); 104 107 105 108 //Erase a variable 109 mip.erase(x2); 110 mip.rowUpperBound(y2, 8); 111 expected_opt=1; 112 solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt); 106 113 107 114 } 115 108 116 109 117 template<class MIP> … … 145 153 #endif 146 154 155 #ifdef HAVE_CBC 156 { 157 CbcMip mip1; 158 aTest(mip1); 159 cloneTest<CbcMip>(); 160 } 161 #endif 162 147 163 return 0; 148 164 -
tools/dimacs-solver.cc
r561 r569 116 116 DimacsDescriptor &desc) 117 117 { 118 std::stringstream iss( ap["infcap"]);118 std::stringstream iss(static_cast<std::string>(ap["infcap"])); 119 119 Value infty; 120 120 iss >> infty; -
tools/lgf-gen.cc
r524 r570 33 33 #include <algorithm> 34 34 #include <set> 35 #include <ctime> 35 36 #include <lemon/list_graph.h> 36 37 #include <lemon/random.h>
Note: See TracChangeset
for help on using the changeset viewer.