Changes in / [1065:490d89913a17:1061:473c71baff72] in lemon-main
- Files:
-
- 1 added
- 1 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r1064 r1017 62 62 FIND_PACKAGE(Doxygen) 63 63 FIND_PACKAGE(Ghostscript) 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 64 FIND_PACKAGE(GLPK 4.33) 65 FIND_PACKAGE(CPLEX) 66 FIND_PACKAGE(COIN) 122 67 123 68 IF(DEFINED ENV{LEMON_CXX_WARNING}) -
INSTALL
r1065 r1040 135 135 136 136 137 -DLEMON_ENABLE_GLPK=NO138 -DLEMON_ENABLE_COIN=NO139 -DLEMON_ENABLE_ILOG=NO140 141 Enable optional third party libraries. They are all enabled by default.142 143 -DLEMON_DEFAULT_LP=GLPK144 145 Sets the default LP solver backend. The supported values are146 CPLEX, CLP and GLPK. By default, it is set to the first one which147 is enabled and succesfully discovered.148 149 -DLEMON_DEFAULT_MIP=GLPK150 151 Sets the default MIP solver backend. The supported values are152 CPLEX, CBC and GLPK. By default, it is set to the first one which153 is enabled and succesfully discovered.154 155 137 -DGLPK_ROOT_DIR=DIRECTORY 156 138 -DCOIN_ROOT_DIR=DIRECTORY 157 -D ILOG_ROOT_DIR=DIRECTORY139 -DCPLEX_ROOT_DIR=DIRECTORY 158 140 159 Root directory prefixes of optional third party libraries.141 Install root directory prefixes of optional third party libraries. 160 142 161 143 Makefile Variables -
cmake/FindCOIN.cmake
r1064 r973 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
r1064 r638 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
r1062 r981 37 37 IF(LEMON_HAVE_CPLEX) 38 38 SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) 39 INCLUDE_DIRECTORIES(${ ILOG_INCLUDE_DIRS})39 INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS}) 40 40 ENDIF() 41 41 -
lemon/cbc.h
r1064 r877 17 17 */ 18 18 19 // -*- C++ -*- 19 20 #ifndef LEMON_CBC_H 20 21 #define LEMON_CBC_H -
lemon/config.h.in
r1064 r981 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@11 9 #cmakedefine LEMON_USE_PTHREAD 1 12 10 #cmakedefine LEMON_USE_WIN32_THREADS 1 -
lemon/cplex.cc
r1063 r1016 492 492 _message_enabled ? CPX_ON : CPX_OFF); 493 493 } 494 495 void CplexBase::_write(std::string file, std::string format) const496 {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 505 494 506 495 // CplexLp members -
lemon/cplex.h
r1063 r746 151 151 bool _message_enabled; 152 152 153 void _write(std::string file, std::string format) const;154 155 153 public: 156 154 … … 173 171 const cpxlp* cplexLp() const { return _prob; } 174 172 175 #ifdef DOXYGEN176 /// Write the problem or the solution to a file in the given format177 178 /// This function writes the problem or the solution179 /// to a file in the given format.180 /// Trying to write in an unsupported format will trigger181 /// \ref UnsupportedFormatError.182 /// \param file The file path183 /// \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 #endif187 188 173 }; 189 174 -
lemon/glpk.cc
r1063 r989 581 581 break; 582 582 } 583 }584 585 void GlpkBase::_write(std::string file, std::string format) const586 {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);592 583 } 593 584 … … 1008 999 const char* GlpkMip::_solverName() const { return "GlpkMip"; } 1009 1000 1010 1011 1012 1001 } //END OF NAMESPACE LEMON -
lemon/glpk.h
r1063 r877 116 116 virtual void _messageLevel(MessageLevel level); 117 117 118 virtual void _write(std::string file, std::string format) const;119 120 118 private: 121 119 … … 147 145 int lpxCol(Col c) const { return cols(id(c)); } 148 146 149 #ifdef DOXYGEN150 /// Write the problem or the solution to a file in the given format151 152 /// This function writes the problem or the solution153 /// to a file in the given format.154 /// Trying to write in an unsupported format will trigger155 /// \ref UnsupportedFormatError.156 /// \param file The file path157 /// \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 #endif161 162 147 }; 163 148 -
lemon/lp.h
r1064 r877 60 60 ///\ingroup lp_group 61 61 /// 62 ///Currently, the possible values are \c GLPK , \c CPLEX or \c CBC62 ///Currently, the possible values are \c GLPK or \c CPLEX 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 , \c CplexMip , \c CbcMip69 ///Currently, it is either \c GlpkMip or \c CplexMip 70 70 typedef GlpkMip Mip; 71 71 #else 72 #if LEMON_DEFAULT_LP == GLPK 72 #ifdef LEMON_HAVE_GLPK 73 # define LEMON_DEFAULT_LP GLPK 73 74 typedef GlpkLp Lp; 74 #elif LEMON_DEFAULT_LP == CPLEX 75 # define LEMON_DEFAULT_MIP GLPK 76 typedef GlpkMip Mip; 77 #elif LEMON_HAVE_CPLEX 78 # define LEMON_DEFAULT_LP CPLEX 75 79 typedef CplexLp Lp; 76 #elif LEMON_DEFAULT_LP == SOPLEX 80 # define LEMON_DEFAULT_MIP CPLEX 81 typedef CplexMip Mip; 82 #elif LEMON_HAVE_SOPLEX 83 # define DEFAULT_LP SOPLEX 77 84 typedef SoplexLp Lp; 78 #elif LEMON_DEFAULT_LP == CLP 85 #elif LEMON_HAVE_CLP 86 # define DEFAULT_LP CLP 79 87 typedef ClpLp Lp; 80 #endif81 #if LEMON_DEFAULT_MIP == GLPK82 typedef GlpkLp Mip;83 #elif LEMON_DEFAULT_MIP == CPLEX84 typedef CplexMip Mip;85 #elif LEMON_DEFAULT_MIP == CBC86 typedef CbcMip Mip;87 88 #endif 88 89 #endif -
lemon/lp_base.h
r1063 r989 1008 1008 public: 1009 1009 1010 ///\e1011 class UnsupportedFormatError : public Exception1012 {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) const1034 {1035 throw UnsupportedFormatError(format);1036 }1037 1038 public:1039 1040 1010 /// Virtual destructor 1041 1011 virtual ~LpBase() {} … … 1586 1556 void min() { _setSense(MIN); } 1587 1557 1588 ///Clear the problem1558 ///Clears the problem 1589 1559 void clear() { _clear(); rows.clear(); cols.clear(); } 1590 1560 1591 /// Set the message level of the solver1561 /// Sets the message level of the solver 1592 1562 void messageLevel(MessageLevel level) { _messageLevel(level); } 1593 1594 /// Write the problem to a file in the given format1595 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 trigger1599 /// \ref UnsupportedFormatError. For the supported formats,1600 /// visit the documentation of the base class of the related backends1601 /// (\ref CplexBase, \ref GlpkBase etc.)1602 /// \param file The file path1603 /// \param format The output file format.1604 void write(std::string file, std::string format = "MPS") const1605 {1606 _write(file.c_str(),format.c_str());1607 }1608 1563 1609 1564 ///@} -
lemon/lp_skeleton.cc
r1063 r877 92 92 void SkeletonSolverBase::_messageLevel(MessageLevel) {} 93 93 94 void SkeletonSolverBase::_write(std::string, std::string) const {}95 96 94 LpSkeleton::SolveExitStatus LpSkeleton::_solve() { return SOLVED; } 97 95 -
lemon/lp_skeleton.h
r1063 r877 145 145 ///\e 146 146 virtual void _messageLevel(MessageLevel); 147 148 ///\e149 virtual void _write(std::string file, std::string format) const;150 151 147 }; 152 148 … … 227 223 ///\e 228 224 virtual const char* _solverName() const; 229 230 225 }; 231 226 -
test/CMakeLists.txt
r1065 r1060 70 70 ENDIF() 71 71 IF(LEMON_HAVE_CPLEX) 72 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ ILOG_LIBRARIES})72 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_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 ${ ILOG_CPLEX_DLL}${TARGET_PATH}96 COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/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} ${ ILOG_LIBRARIES})114 SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_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 ${ ILOG_CPLEX_DLL}${TARGET_PATH}138 COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH} 139 139 ) 140 140 ENDIF() -
test/lp_test.cc
r1064 r988 241 241 { 242 242 LP::DualExpr e,f,g; 243 LP::Row p1 = INVALID, p2 = INVALID; 243 LP::Row p1 = INVALID, p2 = INVALID, p3 = INVALID, 244 p4 = INVALID, p5 = INVALID; 244 245 245 246 e[p1]=2;
Note: See TracChangeset
for help on using the changeset viewer.