[Lemon-commits] Alpar Juttner: Make CBC interface compatible wit...
Lemon HG
hg at lemon.cs.elte.hu
Wed Jan 11 15:26:00 CET 2012
details: http://lemon.cs.elte.hu/hg/lemon/rev/ee581a0ecfbf
changeset: 1120:ee581a0ecfbf
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Fri Jan 06 16:27:06 2012 +0100
description:
Make CBC interface compatible with latest CBC releases
CBC now uses the CLP backend unconditionally
diffstat:
cmake/FindCOIN.cmake | 25 ++++++++++++++++++++++---
lemon/cbc.cc | 13 -------------
2 files changed, 22 insertions(+), 16 deletions(-)
diffs (93 lines):
diff --git a/cmake/FindCOIN.cmake b/cmake/FindCOIN.cmake
--- a/cmake/FindCOIN.cmake
+++ b/cmake/FindCOIN.cmake
@@ -54,6 +54,17 @@
HINTS ${COIN_ROOT_DIR}/lib
)
+FIND_LIBRARY(COIN_ZLIB_LIBRARY
+ NAMES z libz
+ HINTS ${COIN_ROOT_DIR}/lib/coin
+ HINTS ${COIN_ROOT_DIR}/lib
+)
+FIND_LIBRARY(COIN_BZ2_LIBRARY
+ NAMES bz2 libbz2
+ HINTS ${COIN_ROOT_DIR}/lib/coin
+ HINTS ${COIN_ROOT_DIR}/lib
+)
+
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
COIN_INCLUDE_DIR
@@ -71,9 +82,15 @@
IF(COIN_FOUND)
SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
- SET(COIN_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY}")
- SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
- SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES})
+ SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY}")
+ IF(COIN_ZLIB_LIBRARY)
+ SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
+ ENDIF(COIN_ZLIB_LIBRARY)
+ IF(COIN_BZ2_LIBRARY)
+ SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}")
+ ENDIF(COIN_BZ2_LIBRARY)
+ SET(COIN_CBC_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY};${COIN_CLP_LIBRARIES}")
+ SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
ENDIF(COIN_FOUND)
MARK_AS_ADVANCED(
@@ -88,6 +105,8 @@
COIN_OSI_CLP_LIBRARY
COIN_OSI_VOL_LIBRARY
COIN_VOL_LIBRARY
+ COIN_ZLIB_LIBRARY
+ COIN_BZ2_LIBRARY
)
IF(COIN_FOUND)
diff --git a/lemon/cbc.cc b/lemon/cbc.cc
--- a/lemon/cbc.cc
+++ b/lemon/cbc.cc
@@ -25,12 +25,7 @@
#include <coin/CbcModel.hpp>
#include <coin/OsiSolverInterface.hpp>
-#ifdef COIN_HAS_CLP
#include "coin/OsiClpSolverInterface.hpp"
-#endif
-#ifdef COIN_HAS_OSL
-#include "coin/OsiOslSolverInterface.hpp"
-#endif
#include "coin/CbcCutGenerator.hpp"
#include "coin/CbcHeuristicLocal.hpp"
@@ -258,13 +253,7 @@
if (_osi_solver) {
delete _osi_solver;
}
-#ifdef COIN_HAS_CLP
_osi_solver = new OsiClpSolverInterface();
-#elif COIN_HAS_OSL
- _osi_solver = new OsiOslSolverInterface();
-#else
-#error Cannot instantiate Osi solver
-#endif
_osi_solver->loadFromCoinModel(*_prob);
@@ -316,13 +305,11 @@
CglFlowCover flowGen;
_cbc_model->addCutGenerator(&flowGen, -1, "FlowCover");
-#ifdef COIN_HAS_CLP
OsiClpSolverInterface* osiclp =
dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver());
if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) {
osiclp->setupForRepeatedUse(2, 0);
}
-#endif
CbcRounding heuristic1(*_cbc_model);
heuristic1.setWhen(3);
More information about the Lemon-commits
mailing list