[Cbc] CbcModel::takeOffCuts() for globalCuts_

Kibaek Kim kibaek.k at gmail.com
Thu Nov 20 12:24:59 EST 2014


Hello,

I am testing my global cut generator for outer approximation of piece-wise linear convex function. My implementation uses OsiBabSolver::solverType_ = 3 and manually sets up mipBound_ and bestObjectiveValue_, while generating global cuts.

Here is my issue. After running many iterations, Cbc complains the following:
  Assertion failed: (clpMatrix->getNumRows()==modelPtr_->getNumRows()), function freeCachedResults, file ../../../../Clp/src/OsiClp/OsiClpSolverInterface.cpp, line 4491.
and backtrace reports
  * frame #0: 0x00007fff9a5c8866 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff9948035c libsystem_pthread.dylib`pthread_kill + 92
    frame #2: 0x00007fff947fbb1a libsystem_c.dylib`abort + 125
    frame #3: 0x00007fff947c59bf libsystem_c.dylib`__assert_rtn + 321
    frame #4: 0x00000001003e3187 MyTest`OsiClpSolverInterface::freeCachedResults(this=0x000000010afb1320) const + 623 at OsiClpSolverInterface.cpp:4491
    frame #5: 0x00000001003dcd27 MyTest`OsiClpSolverInterface::deleteRows(this=0x000000010afb1320, num=1, rowIndices=0x000000010afc8380) + 729 at OsiClpSolverInterface.cpp:3491
    frame #6: 0x00000001000b50af MyTest`CbcModel::takeOffCuts(this=0x000000010172d000, newCuts=0x00007fff5fbfd120, allowResolve=true, saveCuts=0x0000000000000000, numberNewCuts=0, addedCuts=0x0000000000000000) + 2029 at CbcModel.cpp:9792
    frame #7: 0x00000001000b080f MyTest`CbcModel::solveWithCuts(this=0x000000010172d000, cuts=0x00007fff5fbfd120, numberTries=0, node=0x000000010b31a6c0) + 16359 at CbcModel.cpp:8563
    frame #8: 0x00000001000c9765 MyTest`CbcModel::doOneNode(this=0x000000010172d000, baseModel=0x000000010172d000, node=0x00007fff5fbfd880, newNode=0x00007fff5fbfd938) + 2745 at CbcModel.cpp:14944
    frame #9: 0x000000010009b8d8 MyTest`CbcModel::branchAndBound(this=0x000000010172d000, doStatistics=0) + 49158 at CbcModel.cpp:4500

The issue is because OsiClpSolverInterface::deleteRows() tries deleting rows that are out of range. This results in that the row counter of clpMatrix is reduced whereas the model row counter is not. The reason that solverCutIndices in CbcModel::takeOffCuts() contained out-of-range indices is that CbcMode::globalCuts_ were counted in solverCutIndices (in CbcModel::takeOffCuts), but the global cuts were not applied to solver_ yet.

Then, my question is
1. Should I have added the global cuts manually to solver_ before getting into takeOffCuts()?
2. or should this be handled in OsiClpSolverInterface side?

Thanks all for your helps in advance,

Best,

Kibaek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20141120/d9b219b6/attachment.html>


More information about the Cbc mailing list