gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Make CBC interface compatible with latest CBC releases CBC now uses the CLP backend unconditionally
0 2 0
default
2 files changed with 22 insertions and 16 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -54,6 +54,17 @@
54 54
  HINTS ${COIN_ROOT_DIR}/lib
55 55
)
56 56

	
57
FIND_LIBRARY(COIN_ZLIB_LIBRARY
58
  NAMES z libz
59
  HINTS ${COIN_ROOT_DIR}/lib/coin
60
  HINTS ${COIN_ROOT_DIR}/lib
61
)
62
FIND_LIBRARY(COIN_BZ2_LIBRARY
63
  NAMES bz2 libbz2
64
  HINTS ${COIN_ROOT_DIR}/lib/coin
65
  HINTS ${COIN_ROOT_DIR}/lib
66
)
67

	
57 68
INCLUDE(FindPackageHandleStandardArgs)
58 69
FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
59 70
  COIN_INCLUDE_DIR
... ...
@@ -71,9 +82,15 @@
71 82

	
72 83
IF(COIN_FOUND)
73 84
  SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
74
  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}")
75
  SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
76
  SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES})
85
  SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY}")
86
  IF(COIN_ZLIB_LIBRARY)
87
    SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
88
  ENDIF(COIN_ZLIB_LIBRARY)
89
   IF(COIN_BZ2_LIBRARY)
90
    SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}")
91
  ENDIF(COIN_BZ2_LIBRARY)
92
  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}")
93
  SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
77 94
ENDIF(COIN_FOUND)
78 95

	
79 96
MARK_AS_ADVANCED(
... ...
@@ -88,6 +105,8 @@
88 105
  COIN_OSI_CLP_LIBRARY
89 106
  COIN_OSI_VOL_LIBRARY
90 107
  COIN_VOL_LIBRARY
108
  COIN_ZLIB_LIBRARY
109
  COIN_BZ2_LIBRARY
91 110
)
92 111

	
93 112
IF(COIN_FOUND)
Ignore white space 6 line context
... ...
@@ -25,12 +25,7 @@
25 25
#include <coin/CbcModel.hpp>
26 26
#include <coin/OsiSolverInterface.hpp>
27 27

	
28
#ifdef COIN_HAS_CLP
29 28
#include "coin/OsiClpSolverInterface.hpp"
30
#endif
31
#ifdef COIN_HAS_OSL
32
#include "coin/OsiOslSolverInterface.hpp"
33
#endif
34 29

	
35 30
#include "coin/CbcCutGenerator.hpp"
36 31
#include "coin/CbcHeuristicLocal.hpp"
... ...
@@ -258,13 +253,7 @@
258 253
    if (_osi_solver) {
259 254
      delete _osi_solver;
260 255
    }
261
#ifdef COIN_HAS_CLP
262 256
    _osi_solver = new OsiClpSolverInterface();
263
#elif COIN_HAS_OSL
264
    _osi_solver = new OsiOslSolverInterface();
265
#else
266
#error Cannot instantiate Osi solver
267
#endif
268 257

	
269 258
    _osi_solver->loadFromCoinModel(*_prob);
270 259

	
... ...
@@ -316,13 +305,11 @@
316 305
      CglFlowCover flowGen;
317 306
      _cbc_model->addCutGenerator(&flowGen, -1, "FlowCover");
318 307

	
319
#ifdef COIN_HAS_CLP
320 308
      OsiClpSolverInterface* osiclp =
321 309
        dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver());
322 310
      if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) {
323 311
        osiclp->setupForRepeatedUse(2, 0);
324 312
      }
325
#endif
326 313

	
327 314
      CbcRounding heuristic1(*_cbc_model);
328 315
      heuristic1.setWhen(3);
0 comments (0 inline)