Changes in / [1061:473c71baff72:1065:490d89913a17] in lemon-main
- Files:
-
- 1 added
- 1 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r1017 r1064 62 62 FIND_PACKAGE(Doxygen) 63 63 FIND_PACKAGE(Ghostscript) 64 FIND_PACKAGE(GLPK 4.33) 65 FIND_PACKAGE(CPLEX) 66 FIND_PACKAGE(COIN) 64 65 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.") 66 SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.") 67 SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.") 68 69 IF(LEMON_ENABLE_GLPK) 70 FIND_PACKAGE(GLPK 4.33) 71 ENDIF(LEMON_ENABLE_GLPK) 72 IF(LEMON_ENABLE_ILOG) 73 FIND_PACKAGE(ILOG) 74 ENDIF(LEMON_ENABLE_ILOG) 75 IF(LEMON_ENABLE_COIN) 76 FIND_PACKAGE(COIN) 77 ENDIF(LEMON_ENABLE_COIN) 78 79 IF(GLPK_FOUND) 80 SET(LEMON_HAVE_LP TRUE) 81 SET(LEMON_HAVE_MIP TRUE) 82 SET(LEMON_HAVE_GLPK TRUE) 83 ENDIF(GLPK_FOUND) 84 IF(ILOG_FOUND) 85 SET(LEMON_HAVE_LP TRUE) 86 SET(LEMON_HAVE_MIP TRUE) 87 SET(LEMON_HAVE_ILOG TRUE) 88 ENDIF(ILOG_FOUND) 89 IF(COIN_FOUND) 90 SET(LEMON_HAVE_LP TRUE) 91 SET(LEMON_HAVE_MIP TRUE) 92 SET(LEMON_HAVE_CLP TRUE) 93 SET(LEMON_HAVE_CBC TRUE) 94 ENDIF(COIN_FOUND) 95 96 IF(ILOG_FOUND) 97 SET(DEFAULT_LP "CPLEX") 98 SET(DEFAULT_MIP "CPLEX") 99 ELSEIF(COIN_FOUND) 100 SET(DEFAULT_LP "CLP") 101 SET(DEFAULT_MIP "CBC") 102 ELSEIF(GLPK_FOUND) 103 SET(DEFAULT_LP "GLPK") 104 SET(DEFAULT_MIP "GLPK") 105 ENDIF() 106 107 IF(NOT LEMON_DEFAULT_LP OR 108 (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR 109 (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR 110 (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK"))) 111 SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING 112 "Default LP solver backend (GLPK, CPLEX or CLP)" FORCE) 113 ENDIF() 114 IF(NOT LEMON_DEFAULT_MIP OR 115 (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR 116 (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR 117 (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK"))) 118 SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING 119 "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE) 120 ENDIF() 121 67 122 68 123 IF(DEFINED ENV{LEMON_CXX_WARNING}) -
INSTALL
r1040 r1065 135 135 136 136 137 -DLEMON_ENABLE_GLPK=NO 138 -DLEMON_ENABLE_COIN=NO 139 -DLEMON_ENABLE_ILOG=NO 140 141 Enable optional third party libraries. They are all enabled by default. 142 143 -DLEMON_DEFAULT_LP=GLPK 144 145 Sets the default LP solver backend. The supported values are 146 CPLEX, CLP and GLPK. By default, it is set to the first one which 147 is enabled and succesfully discovered. 148 149 -DLEMON_DEFAULT_MIP=GLPK 150 151 Sets the default MIP solver backend. The supported values are 152 CPLEX, CBC and GLPK. By default, it is set to the first one which 153 is enabled and succesfully discovered. 154 137 155 -DGLPK_ROOT_DIR=DIRECTORY 138 156 -DCOIN_ROOT_DIR=DIRECTORY 139 -D CPLEX_ROOT_DIR=DIRECTORY157 -DILOG_ROOT_DIR=DIRECTORY 140 158 141 Install root directory prefixes of optional third party libraries.159 Root directory prefixes of optional third party libraries. 142 160 143 161 Makefile Variables -
cmake/FindCOIN.cmake
r973 r1064 109 109 COIN_BZ2_LIBRARY 110 110 ) 111 112 IF(COIN_FOUND)113 SET(LEMON_HAVE_LP TRUE)114 SET(LEMON_HAVE_MIP TRUE)115 SET(LEMON_HAVE_CLP TRUE)116 SET(LEMON_HAVE_CBC TRUE)117 ENDIF(COIN_FOUND) -
cmake/FindGLPK.cmake
r638 r1064 54 54 55 55 MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR) 56 57 IF(GLPK_FOUND)58 SET(LEMON_HAVE_LP TRUE)59 SET(LEMON_HAVE_MIP TRUE)60 SET(LEMON_HAVE_GLPK TRUE)61 ENDIF(GLPK_FOUND) -
lemon/CMakeLists.txt
r981 r1062 37 37 IF(LEMON_HAVE_CPLEX) 38 38 SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) 39 INCLUDE_DIRECTORIES(${ CPLEX_INCLUDE_DIRS})39 INCLUDE_DIRECTORIES(${ILOG_INCLUDE_DIRS}) 40 40 ENDIF() 41 41 -
lemon/cbc.h
r877 r1064 17 17 */ 18 18 19 // -*- C++ -*-20 19 #ifndef LEMON_CBC_H 21 20 #define LEMON_CBC_H -
lemon/config.h.in
r981 r1064 7 7 #cmakedefine LEMON_HAVE_CLP 1 8 8 #cmakedefine LEMON_HAVE_CBC 1 9 #cmakedefine LEMON_DEFAULT_LP @LEMON_DEFAULT_LP@ 10 #cmakedefine LEMON_DEFAULT_MIP @LEMON_DEFAULT_MIP@ 9 11 #cmakedefine LEMON_USE_PTHREAD 1 10 12 #cmakedefine LEMON_USE_WIN32_THREADS 1 -
lemon/cplex.cc
r1016 r1063 492 492 _message_enabled ? CPX_ON : CPX_OFF); 493 493 } 494 495 void CplexBase::_write(std::string file, std::string format) const 496 { 497 if(format == "MPS" || format == "LP") 498 CPXwriteprob(cplexEnv(), cplexLp(), file.c_str(), format.c_str()); 499 else if(format == "SOL") 500 CPXsolwrite(cplexEnv(), cplexLp(), file.c_str()); 501 else throw UnsupportedFormatError(format); 502 } 503 504 494 505 495 506 // CplexLp members -
lemon/cplex.h
r746 r1063 151 151 bool _message_enabled; 152 152 153 void _write(std::string file, std::string format) const; 154 153 155 public: 154 156 … … 171 173 const cpxlp* cplexLp() const { return _prob; } 172 174 175 #ifdef DOXYGEN 176 /// Write the problem or the solution to a file in the given format 177 178 /// This function writes the problem or the solution 179 /// to a file in the given format. 180 /// Trying to write in an unsupported format will trigger 181 /// \ref UnsupportedFormatError. 182 /// \param file The file path 183 /// \param format The output file format. 184 /// Supportted formats are "MPS", "LP" and "SOL". 185 void write(std::string file, std::string format = "MPS") const {} 186 #endif 187 173 188 }; 174 189 -
lemon/glpk.cc
r989 r1063 581 581 break; 582 582 } 583 } 584 585 void GlpkBase::_write(std::string file, std::string format) const 586 { 587 if(format == "MPS") 588 glp_write_mps(lp, GLP_MPS_FILE, 0, file.c_str()); 589 else if(format == "LP") 590 glp_write_lp(lp, 0, file.c_str()); 591 else throw UnsupportedFormatError(format); 583 592 } 584 593 … … 999 1008 const char* GlpkMip::_solverName() const { return "GlpkMip"; } 1000 1009 1010 1011 1001 1012 } //END OF NAMESPACE LEMON -
lemon/glpk.h
r877 r1063 116 116 virtual void _messageLevel(MessageLevel level); 117 117 118 virtual void _write(std::string file, std::string format) const; 119 118 120 private: 119 121 … … 145 147 int lpxCol(Col c) const { return cols(id(c)); } 146 148 149 #ifdef DOXYGEN 150 /// Write the problem or the solution to a file in the given format 151 152 /// This function writes the problem or the solution 153 /// to a file in the given format. 154 /// Trying to write in an unsupported format will trigger 155 /// \ref UnsupportedFormatError. 156 /// \param file The file path 157 /// \param format The output file format. 158 /// Supportted formats are "MPS" and "LP". 159 void write(std::string file, std::string format = "MPS") const {} 160 #endif 161 147 162 }; 148 163 -
lemon/lp.h
r877 r1064 60 60 ///\ingroup lp_group 61 61 /// 62 ///Currently, the possible values are \c GLPK or \c CPLEX62 ///Currently, the possible values are \c GLPK, \c CPLEX or \c CBC 63 63 #define LEMON_DEFAULT_MIP SOLVER 64 64 ///The default MIP solver. … … 67 67 ///\ingroup lp_group 68 68 /// 69 ///Currently, it is either \c GlpkMip or \c CplexMip69 ///Currently, it is either \c GlpkMip, \c CplexMip , \c CbcMip 70 70 typedef GlpkMip Mip; 71 71 #else 72 #ifdef LEMON_HAVE_GLPK 73 # define LEMON_DEFAULT_LP GLPK 72 #if LEMON_DEFAULT_LP == GLPK 74 73 typedef GlpkLp Lp; 75 # define LEMON_DEFAULT_MIP GLPK 76 typedef GlpkMip Mip; 77 #elif LEMON_HAVE_CPLEX 78 # define LEMON_DEFAULT_LP CPLEX 74 #elif LEMON_DEFAULT_LP == CPLEX 79 75 typedef CplexLp Lp; 80 # define LEMON_DEFAULT_MIP CPLEX 76 #elif LEMON_DEFAULT_LP == SOPLEX 77 typedef SoplexLp Lp; 78 #elif LEMON_DEFAULT_LP == CLP 79 typedef ClpLp Lp; 80 #endif 81 #if LEMON_DEFAULT_MIP == GLPK 82 typedef GlpkLp Mip; 83 #elif LEMON_DEFAULT_MIP == CPLEX 81 84 typedef CplexMip Mip; 82 #elif LEMON_HAVE_SOPLEX 83 # define DEFAULT_LP SOPLEX 84 typedef SoplexLp Lp; 85 #elif LEMON_HAVE_CLP 86 # define DEFAULT_LP CLP 87 typedef ClpLp Lp; 85 #elif LEMON_DEFAULT_MIP == CBC 86 typedef CbcMip Mip; 88 87 #endif 89 88 #endif -
lemon/lp_base.h
r989 r1063 1008 1008 public: 1009 1009 1010 ///\e 1011 class UnsupportedFormatError : public Exception 1012 { 1013 std::string _format; 1014 mutable std::string _what; 1015 public: 1016 explicit UnsupportedFormatError(std::string format) throw() 1017 : _format(format) { } 1018 virtual ~UnsupportedFormatError() throw() {} 1019 virtual const char* what() const throw() { 1020 try { 1021 _what.clear(); 1022 std::ostringstream oss; 1023 oss << "lemon::UnsupportedFormatError: " << _format; 1024 _what = oss.str(); 1025 } 1026 catch (...) {} 1027 if (!_what.empty()) return _what.c_str(); 1028 else return "lemon::UnsupportedFormatError"; 1029 } 1030 }; 1031 1032 protected: 1033 virtual void _write(std::string, std::string format) const 1034 { 1035 throw UnsupportedFormatError(format); 1036 } 1037 1038 public: 1039 1010 1040 /// Virtual destructor 1011 1041 virtual ~LpBase() {} … … 1556 1586 void min() { _setSense(MIN); } 1557 1587 1558 ///Clear sthe problem1588 ///Clear the problem 1559 1589 void clear() { _clear(); rows.clear(); cols.clear(); } 1560 1590 1561 /// Set sthe message level of the solver1591 /// Set the message level of the solver 1562 1592 void messageLevel(MessageLevel level) { _messageLevel(level); } 1593 1594 /// Write the problem to a file in the given format 1595 1596 /// This function writes the problem to a file in the given format. 1597 /// Different solver backends may support different formats. 1598 /// Trying to write in an unsupported format will trigger 1599 /// \ref UnsupportedFormatError. For the supported formats, 1600 /// visit the documentation of the base class of the related backends 1601 /// (\ref CplexBase, \ref GlpkBase etc.) 1602 /// \param file The file path 1603 /// \param format The output file format. 1604 void write(std::string file, std::string format = "MPS") const 1605 { 1606 _write(file.c_str(),format.c_str()); 1607 } 1563 1608 1564 1609 ///@} -
lemon/lp_skeleton.cc
r877 r1063 92 92 void SkeletonSolverBase::_messageLevel(MessageLevel) {} 93 93 94 void SkeletonSolverBase::_write(std::string, std::string) const {} 95 94 96 LpSkeleton::SolveExitStatus LpSkeleton::_solve() { return SOLVED; } 95 97 -
lemon/lp_skeleton.h
r877 r1063 145 145 ///\e 146 146 virtual void _messageLevel(MessageLevel); 147 148 ///\e 149 virtual void _write(std::string file, std::string format) const; 150 147 151 }; 148 152 … … 223 227 ///\e 224 228 virtual const char* _solverName() const; 229 225 230 }; 226 231 -
test/CMakeLists.txt
r1060 r1065 70 70 ENDIF() 71 71 IF(LEMON_HAVE_CPLEX) 72 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ CPLEX_LIBRARIES})72 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES}) 73 73 ENDIF() 74 74 IF(LEMON_HAVE_CLP) … … 94 94 GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) 95 95 ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD 96 COMMAND ${CMAKE_COMMAND} -E copy ${ CPLEX_BIN_DIR}/cplex.dll${TARGET_PATH}96 COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH} 97 97 ) 98 98 ENDIF() … … 112 112 ENDIF() 113 113 IF(LEMON_HAVE_CPLEX) 114 SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ CPLEX_LIBRARIES})114 SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES}) 115 115 ENDIF() 116 116 IF(LEMON_HAVE_CBC) … … 136 136 GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) 137 137 ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD 138 COMMAND ${CMAKE_COMMAND} -E copy ${ CPLEX_BIN_DIR}/cplex.dll${TARGET_PATH}138 COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH} 139 139 ) 140 140 ENDIF() -
test/lp_test.cc
r988 r1064 241 241 { 242 242 LP::DualExpr e,f,g; 243 LP::Row p1 = INVALID, p2 = INVALID, p3 = INVALID, 244 p4 = INVALID, p5 = INVALID; 243 LP::Row p1 = INVALID, p2 = INVALID; 245 244 246 245 e[p1]=2;
Note: See TracChangeset
for help on using the changeset viewer.