0
4
0
... | ... |
@@ -41,58 +41,77 @@ |
41 | 41 |
FIND_LIBRARY(COIN_OSI_CLP_LIBRARY |
42 | 42 |
NAMES OsiClp libOsiClp |
43 | 43 |
HINTS ${COIN_ROOT_DIR}/lib/coin |
44 | 44 |
HINTS ${COIN_ROOT_DIR}/lib |
45 | 45 |
) |
46 | 46 |
FIND_LIBRARY(COIN_OSI_VOL_LIBRARY |
47 | 47 |
NAMES OsiVol libOsiVol |
48 | 48 |
HINTS ${COIN_ROOT_DIR}/lib/coin |
49 | 49 |
HINTS ${COIN_ROOT_DIR}/lib |
50 | 50 |
) |
51 | 51 |
FIND_LIBRARY(COIN_VOL_LIBRARY |
52 | 52 |
NAMES Vol libVol |
53 | 53 |
HINTS ${COIN_ROOT_DIR}/lib/coin |
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 |
60 | 71 |
COIN_CBC_LIBRARY |
61 | 72 |
COIN_CBC_SOLVER_LIBRARY |
62 | 73 |
COIN_CGL_LIBRARY |
63 | 74 |
COIN_CLP_LIBRARY |
64 | 75 |
COIN_COIN_UTILS_LIBRARY |
65 | 76 |
COIN_OSI_LIBRARY |
66 | 77 |
COIN_OSI_CBC_LIBRARY |
67 | 78 |
COIN_OSI_CLP_LIBRARY |
68 | 79 |
# COIN_OSI_VOL_LIBRARY |
69 | 80 |
# COIN_VOL_LIBRARY |
70 | 81 |
) |
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( |
|
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( |
80 | 97 |
COIN_INCLUDE_DIR |
81 | 98 |
COIN_CBC_LIBRARY |
82 | 99 |
COIN_CBC_SOLVER_LIBRARY |
83 | 100 |
COIN_CGL_LIBRARY |
84 | 101 |
COIN_CLP_LIBRARY |
85 | 102 |
COIN_COIN_UTILS_LIBRARY |
86 | 103 |
COIN_OSI_LIBRARY |
87 | 104 |
COIN_OSI_CBC_LIBRARY |
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) |
94 | 113 |
SET(LEMON_HAVE_LP TRUE) |
95 | 114 |
SET(LEMON_HAVE_MIP TRUE) |
96 | 115 |
SET(LEMON_HAVE_CLP TRUE) |
97 | 116 |
SET(LEMON_HAVE_CBC TRUE) |
98 | 117 |
ENDIF(COIN_FOUND) |
1 | 1 |
SET(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory") |
2 | 2 |
|
3 | 3 |
FIND_PATH(CPLEX_INCLUDE_DIR |
4 | 4 |
ilcplex/cplex.h |
5 |
PATHS "C:/ILOG/CPLEX91/include" |
|
6 |
PATHS "/opt/ilog/cplex91/include" |
|
5 |
PATHS "C:/ILOG/CPLEX/include" |
|
6 |
PATHS "/opt/ilog/cplex/include" |
|
7 | 7 |
HINTS ${CPLEX_ROOT_DIR}/include |
8 | 8 |
) |
9 | 9 |
FIND_LIBRARY(CPLEX_LIBRARY |
10 |
cplex91 |
|
11 |
PATHS "C:/ILOG/CPLEX91/lib/msvc7/stat_mda" |
|
12 |
|
|
10 |
cplex |
|
11 |
PATHS "C:/ILOG/CPLEX/lib/msvc7/stat_mda" |
|
12 |
PATHS "/opt/ilog/cplex/bin" |
|
13 | 13 |
HINTS ${CPLEX_ROOT_DIR}/bin |
14 |
HINTS ${CPLEX_ROOT_DIR}/lib |
|
14 | 15 |
) |
15 | 16 |
|
16 | 17 |
INCLUDE(FindPackageHandleStandardArgs) |
17 | 18 |
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_INCLUDE_DIR) |
18 | 19 |
|
19 | 20 |
FIND_PATH(CPLEX_BIN_DIR |
20 |
cplex91.dll |
|
21 |
PATHS "C:/ILOG/CPLEX91/bin/x86_win32" |
|
21 |
cplex.dll |
|
22 |
PATHS "C:/ILOG/CPLEX/bin/x86_win32" |
|
23 |
HINTS ${CPLEX_ROOT_DIR}/bin |
|
22 | 24 |
) |
23 | 25 |
|
24 | 26 |
IF(CPLEX_FOUND) |
25 | 27 |
SET(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR}) |
26 | 28 |
SET(CPLEX_LIBRARIES ${CPLEX_LIBRARY}) |
27 | 29 |
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
28 | 30 |
SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread") |
29 | 31 |
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
30 | 32 |
ENDIF(CPLEX_FOUND) |
31 | 33 |
|
32 | 34 |
MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR) |
33 | 35 |
|
34 | 36 |
IF(CPLEX_FOUND) |
35 | 37 |
SET(LEMON_HAVE_LP TRUE) |
36 | 38 |
SET(LEMON_HAVE_MIP TRUE) |
37 | 39 |
SET(LEMON_HAVE_CPLEX TRUE) |
... | ... |
@@ -12,38 +12,33 @@ |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
///\file |
20 | 20 |
///\brief Implementation of the CBC MIP solver interface. |
21 | 21 |
|
22 | 22 |
#include "cbc.h" |
23 | 23 |
|
24 | 24 |
#include <coin/CoinModel.hpp> |
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" |
37 | 32 |
#include "coin/CbcHeuristicGreedy.hpp" |
38 | 33 |
#include "coin/CbcHeuristicFPump.hpp" |
39 | 34 |
#include "coin/CbcHeuristicRINS.hpp" |
40 | 35 |
|
41 | 36 |
#include "coin/CglGomory.hpp" |
42 | 37 |
#include "coin/CglProbing.hpp" |
43 | 38 |
#include "coin/CglKnapsackCover.hpp" |
44 | 39 |
#include "coin/CglOddHole.hpp" |
45 | 40 |
#include "coin/CglClique.hpp" |
46 | 41 |
#include "coin/CglFlowCover.hpp" |
47 | 42 |
#include "coin/CglMixedIntegerRounding.hpp" |
48 | 43 |
|
49 | 44 |
#include "coin/CbcHeuristic.hpp" |
... | ... |
@@ -257,39 +252,33 @@ |
257 | 252 |
} |
258 | 253 |
} |
259 | 254 |
|
260 | 255 |
void CbcMip::_setObjCoeff(int i, Value obj_coef) { |
261 | 256 |
_prob->setColumnObjective(i, obj_coef); |
262 | 257 |
} |
263 | 258 |
|
264 | 259 |
CbcMip::Value CbcMip::_getObjCoeff(int i) const { |
265 | 260 |
return _prob->getColumnObjective(i); |
266 | 261 |
} |
267 | 262 |
|
268 | 263 |
CbcMip::SolveExitStatus CbcMip::_solve() { |
269 | 264 |
|
270 | 265 |
if (_osi_solver) { |
271 | 266 |
delete _osi_solver; |
272 | 267 |
} |
273 |
#ifdef COIN_HAS_CLP |
|
274 | 268 |
_osi_solver = new OsiClpSolverInterface(); |
275 |
#elif COIN_HAS_OSL |
|
276 |
_osi_solver = new OsiOslSolverInterface(); |
|
277 |
#else |
|
278 |
#error Cannot instantiate Osi solver |
|
279 |
#endif |
|
280 | 269 |
|
281 | 270 |
_osi_solver->loadFromCoinModel(*_prob); |
282 | 271 |
|
283 | 272 |
if (_cbc_model) { |
284 | 273 |
delete _cbc_model; |
285 | 274 |
} |
286 | 275 |
_cbc_model= new CbcModel(*_osi_solver); |
287 | 276 |
|
288 | 277 |
_osi_solver->messageHandler()->setLogLevel(_message_level); |
289 | 278 |
_cbc_model->setLogLevel(_message_level); |
290 | 279 |
|
291 | 280 |
_cbc_model->initialSolve(); |
292 | 281 |
_cbc_model->solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); |
293 | 282 |
|
294 | 283 |
if (!_cbc_model->isInitialSolveAbandoned() && |
295 | 284 |
_cbc_model->isInitialSolveProvenOptimal() && |
... | ... |
@@ -315,39 +304,37 @@ |
315 | 304 |
generator4.setMinimumViolation(0.005); |
316 | 305 |
generator4.setMinimumViolationPer(0.00002); |
317 | 306 |
generator4.setMaximumEntries(200); |
318 | 307 |
_cbc_model->addCutGenerator(&generator4, -1, "OddHole"); |
319 | 308 |
|
320 | 309 |
CglClique generator5; |
321 | 310 |
generator5.setStarCliqueReport(false); |
322 | 311 |
generator5.setRowCliqueReport(false); |
323 | 312 |
_cbc_model->addCutGenerator(&generator5, -1, "Clique"); |
324 | 313 |
|
325 | 314 |
CglMixedIntegerRounding mixedGen; |
326 | 315 |
_cbc_model->addCutGenerator(&mixedGen, -1, "MixedIntegerRounding"); |
327 | 316 |
|
328 | 317 |
CglFlowCover flowGen; |
329 | 318 |
_cbc_model->addCutGenerator(&flowGen, -1, "FlowCover"); |
330 | 319 |
|
331 |
#ifdef COIN_HAS_CLP |
|
332 | 320 |
OsiClpSolverInterface* osiclp = |
333 | 321 |
dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver()); |
334 | 322 |
if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) { |
335 | 323 |
osiclp->setupForRepeatedUse(2, 0); |
336 | 324 |
} |
337 |
#endif |
|
338 | 325 |
|
339 | 326 |
CbcRounding heuristic1(*_cbc_model); |
340 | 327 |
heuristic1.setWhen(3); |
341 | 328 |
_cbc_model->addHeuristic(&heuristic1); |
342 | 329 |
|
343 | 330 |
CbcHeuristicLocal heuristic2(*_cbc_model); |
344 | 331 |
heuristic2.setWhen(3); |
345 | 332 |
_cbc_model->addHeuristic(&heuristic2); |
346 | 333 |
|
347 | 334 |
CbcHeuristicGreedyCover heuristic3(*_cbc_model); |
348 | 335 |
heuristic3.setAlgorithm(11); |
349 | 336 |
heuristic3.setWhen(3); |
350 | 337 |
_cbc_model->addHeuristic(&heuristic3); |
351 | 338 |
|
352 | 339 |
CbcHeuristicFPump heuristic4(*_cbc_model); |
353 | 340 |
heuristic4.setWhen(3); |
... | ... |
@@ -76,33 +76,33 @@ |
76 | 76 |
ADD_DEPENDENCIES(check lp_test) |
77 | 77 |
|
78 | 78 |
IF(WIN32 AND LEMON_HAVE_GLPK) |
79 | 79 |
GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) |
80 | 80 |
GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
81 | 81 |
ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD |
82 | 82 |
COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} |
83 | 83 |
COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} |
84 | 84 |
COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} |
85 | 85 |
) |
86 | 86 |
ENDIF() |
87 | 87 |
|
88 | 88 |
IF(WIN32 AND LEMON_HAVE_CPLEX) |
89 | 89 |
GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) |
90 | 90 |
GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
91 | 91 |
ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD |
92 |
COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/ |
|
92 |
COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH} |
|
93 | 93 |
) |
94 | 94 |
ENDIF() |
95 | 95 |
ENDIF() |
96 | 96 |
|
97 | 97 |
IF(LEMON_HAVE_MIP) |
98 | 98 |
IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
99 | 99 |
ADD_EXECUTABLE(mip_test mip_test.cc) |
100 | 100 |
ELSE() |
101 | 101 |
ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc) |
102 | 102 |
ENDIF() |
103 | 103 |
|
104 | 104 |
SET(MIP_TEST_LIBS lemon) |
105 | 105 |
|
106 | 106 |
IF(LEMON_HAVE_GLPK) |
107 | 107 |
SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) |
108 | 108 |
ENDIF() |
... | ... |
@@ -118,33 +118,33 @@ |
118 | 118 |
ADD_DEPENDENCIES(check mip_test) |
119 | 119 |
|
120 | 120 |
IF(WIN32 AND LEMON_HAVE_GLPK) |
121 | 121 |
GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) |
122 | 122 |
GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
123 | 123 |
ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD |
124 | 124 |
COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} |
125 | 125 |
COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} |
126 | 126 |
COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} |
127 | 127 |
) |
128 | 128 |
ENDIF() |
129 | 129 |
|
130 | 130 |
IF(WIN32 AND LEMON_HAVE_CPLEX) |
131 | 131 |
GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) |
132 | 132 |
GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
133 | 133 |
ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD |
134 |
COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/ |
|
134 |
COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH} |
|
135 | 135 |
) |
136 | 136 |
ENDIF() |
137 | 137 |
ENDIF() |
138 | 138 |
|
139 | 139 |
FOREACH(TEST_NAME ${TESTS}) |
140 | 140 |
IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
141 | 141 |
ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) |
142 | 142 |
ELSE() |
143 | 143 |
ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc) |
144 | 144 |
ENDIF() |
145 | 145 |
TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) |
146 | 146 |
IF(TEST_WITH_VALGRIND) |
147 | 147 |
ADD_TEST(${TEST_NAME} |
148 | 148 |
valgrind --error-exitcode=1 ${VALGRIND_FLAGS} |
149 | 149 |
${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} ) |
150 | 150 |
ELSE() |
0 comments (0 inline)