Make CBC interface compatible with latest CBC releases
authorAlpar Juttner <alpar@cs.elte.hu>
Fri, 06 Jan 2012 16:27:06 +0100
changeset 973ee581a0ecfbf
parent 972 1818cc848005
child 974 b1744d7bdb47
child 975 b873350e6258
Make CBC interface compatible with latest CBC releases

CBC now uses the CLP backend unconditionally
cmake/FindCOIN.cmake
lemon/cbc.cc
     1.1 --- a/cmake/FindCOIN.cmake	Sat Dec 24 01:15:59 2011 +0100
     1.2 +++ b/cmake/FindCOIN.cmake	Fri Jan 06 16:27:06 2012 +0100
     1.3 @@ -54,6 +54,17 @@
     1.4    HINTS ${COIN_ROOT_DIR}/lib
     1.5  )
     1.6  
     1.7 +FIND_LIBRARY(COIN_ZLIB_LIBRARY
     1.8 +  NAMES z libz
     1.9 +  HINTS ${COIN_ROOT_DIR}/lib/coin
    1.10 +  HINTS ${COIN_ROOT_DIR}/lib
    1.11 +)
    1.12 +FIND_LIBRARY(COIN_BZ2_LIBRARY
    1.13 +  NAMES bz2 libbz2
    1.14 +  HINTS ${COIN_ROOT_DIR}/lib/coin
    1.15 +  HINTS ${COIN_ROOT_DIR}/lib
    1.16 +)
    1.17 +
    1.18  INCLUDE(FindPackageHandleStandardArgs)
    1.19  FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
    1.20    COIN_INCLUDE_DIR
    1.21 @@ -71,9 +82,15 @@
    1.22  
    1.23  IF(COIN_FOUND)
    1.24    SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
    1.25 -  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}")
    1.26 -  SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
    1.27 -  SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES})
    1.28 +  SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY}")
    1.29 +  IF(COIN_ZLIB_LIBRARY)
    1.30 +    SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
    1.31 +  ENDIF(COIN_ZLIB_LIBRARY)
    1.32 +   IF(COIN_BZ2_LIBRARY)
    1.33 +    SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}")
    1.34 +  ENDIF(COIN_BZ2_LIBRARY)
    1.35 +  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}")
    1.36 +  SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
    1.37  ENDIF(COIN_FOUND)
    1.38  
    1.39  MARK_AS_ADVANCED(
    1.40 @@ -88,6 +105,8 @@
    1.41    COIN_OSI_CLP_LIBRARY
    1.42    COIN_OSI_VOL_LIBRARY
    1.43    COIN_VOL_LIBRARY
    1.44 +  COIN_ZLIB_LIBRARY
    1.45 +  COIN_BZ2_LIBRARY
    1.46  )
    1.47  
    1.48  IF(COIN_FOUND)
     2.1 --- a/lemon/cbc.cc	Sat Dec 24 01:15:59 2011 +0100
     2.2 +++ b/lemon/cbc.cc	Fri Jan 06 16:27:06 2012 +0100
     2.3 @@ -25,12 +25,7 @@
     2.4  #include <coin/CbcModel.hpp>
     2.5  #include <coin/OsiSolverInterface.hpp>
     2.6  
     2.7 -#ifdef COIN_HAS_CLP
     2.8  #include "coin/OsiClpSolverInterface.hpp"
     2.9 -#endif
    2.10 -#ifdef COIN_HAS_OSL
    2.11 -#include "coin/OsiOslSolverInterface.hpp"
    2.12 -#endif
    2.13  
    2.14  #include "coin/CbcCutGenerator.hpp"
    2.15  #include "coin/CbcHeuristicLocal.hpp"
    2.16 @@ -258,13 +253,7 @@
    2.17      if (_osi_solver) {
    2.18        delete _osi_solver;
    2.19      }
    2.20 -#ifdef COIN_HAS_CLP
    2.21      _osi_solver = new OsiClpSolverInterface();
    2.22 -#elif COIN_HAS_OSL
    2.23 -    _osi_solver = new OsiOslSolverInterface();
    2.24 -#else
    2.25 -#error Cannot instantiate Osi solver
    2.26 -#endif
    2.27  
    2.28      _osi_solver->loadFromCoinModel(*_prob);
    2.29  
    2.30 @@ -316,13 +305,11 @@
    2.31        CglFlowCover flowGen;
    2.32        _cbc_model->addCutGenerator(&flowGen, -1, "FlowCover");
    2.33  
    2.34 -#ifdef COIN_HAS_CLP
    2.35        OsiClpSolverInterface* osiclp =
    2.36          dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver());
    2.37        if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) {
    2.38          osiclp->setupForRepeatedUse(2, 0);
    2.39        }
    2.40 -#endif
    2.41  
    2.42        CbcRounding heuristic1(*_cbc_model);
    2.43        heuristic1.setWhen(3);