equal
deleted
inserted
replaced
23 |
23 |
24 #include <coin/CoinModel.hpp> |
24 #include <coin/CoinModel.hpp> |
25 #include <coin/CbcModel.hpp> |
25 #include <coin/CbcModel.hpp> |
26 #include <coin/OsiSolverInterface.hpp> |
26 #include <coin/OsiSolverInterface.hpp> |
27 |
27 |
28 #ifdef COIN_HAS_CLP |
|
29 #include "coin/OsiClpSolverInterface.hpp" |
28 #include "coin/OsiClpSolverInterface.hpp" |
30 #endif |
|
31 #ifdef COIN_HAS_OSL |
|
32 #include "coin/OsiOslSolverInterface.hpp" |
|
33 #endif |
|
34 |
29 |
35 #include "coin/CbcCutGenerator.hpp" |
30 #include "coin/CbcCutGenerator.hpp" |
36 #include "coin/CbcHeuristicLocal.hpp" |
31 #include "coin/CbcHeuristicLocal.hpp" |
37 #include "coin/CbcHeuristicGreedy.hpp" |
32 #include "coin/CbcHeuristicGreedy.hpp" |
38 #include "coin/CbcHeuristicFPump.hpp" |
33 #include "coin/CbcHeuristicFPump.hpp" |
256 CbcMip::SolveExitStatus CbcMip::_solve() { |
251 CbcMip::SolveExitStatus CbcMip::_solve() { |
257 |
252 |
258 if (_osi_solver) { |
253 if (_osi_solver) { |
259 delete _osi_solver; |
254 delete _osi_solver; |
260 } |
255 } |
261 #ifdef COIN_HAS_CLP |
|
262 _osi_solver = new OsiClpSolverInterface(); |
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 _osi_solver->loadFromCoinModel(*_prob); |
258 _osi_solver->loadFromCoinModel(*_prob); |
270 |
259 |
271 if (_cbc_model) { |
260 if (_cbc_model) { |
272 delete _cbc_model; |
261 delete _cbc_model; |
314 _cbc_model->addCutGenerator(&mixedGen, -1, "MixedIntegerRounding"); |
303 _cbc_model->addCutGenerator(&mixedGen, -1, "MixedIntegerRounding"); |
315 |
304 |
316 CglFlowCover flowGen; |
305 CglFlowCover flowGen; |
317 _cbc_model->addCutGenerator(&flowGen, -1, "FlowCover"); |
306 _cbc_model->addCutGenerator(&flowGen, -1, "FlowCover"); |
318 |
307 |
319 #ifdef COIN_HAS_CLP |
|
320 OsiClpSolverInterface* osiclp = |
308 OsiClpSolverInterface* osiclp = |
321 dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver()); |
309 dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver()); |
322 if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) { |
310 if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) { |
323 osiclp->setupForRepeatedUse(2, 0); |
311 osiclp->setupForRepeatedUse(2, 0); |
324 } |
312 } |
325 #endif |
|
326 |
313 |
327 CbcRounding heuristic1(*_cbc_model); |
314 CbcRounding heuristic1(*_cbc_model); |
328 heuristic1.setWhen(3); |
315 heuristic1.setWhen(3); |
329 _cbc_model->addHeuristic(&heuristic1); |
316 _cbc_model->addHeuristic(&heuristic1); |
330 |
317 |