[Cbc] SOS crash in CbcHeuristicDive

Miles Lubin miles.lubin at gmail.com
Sun Feb 1 14:59:05 EST 2015


Hi,

Cbc 2.9.0 is failing some of JuMP's unit tests. We've tracked the
issue down to https://projects.coin-or.org/Cbc/changeset/2093, more
specifically lines:

  for (int i = 0; i < numberIntegers; i++) {
    OsiObject * object = model_->modifiableObject(i);
    const CbcSimpleInteger * thisOne = dynamic_cast <const
CbcSimpleInteger *> (object);
    assert (thisOne);

in CbcHeuristicDive.cpp. If SOS constraints are added to the model
before all integers are set, then this leads to an assertion failure.
Was this an intended change?

Here's a small test case using the C wrapper:

int main() {
    /* Max z
     * s.t. z = 1*x1 + 2*x2 + 3*x3
     *      x binary, SOS1
     */
    Cbc_Model *model = Cbc_newModel();
    CoinBigIndex start[] = {0,1,2,3,4};
    int rowindex[] = {0,0,0,0};
    double value[] = {1,2,3,-1};
    double rowlb[] = {0};
    double rowub[] = {0};
    double collb[] = {0,0,0,0};
    double colub[] = {1,1,1,10};
    double obj[] = {0,0,0,1};
    int sosrowstart[] = {0,3};
    int soscolindex[] = {0,1,2};

    Cbc_loadProblem(model, 4, 1, start, rowindex, value, collb, colub,
obj, rowlb, rowub);
    Cbc_addSOS(model,1,sosrowstart,soscolindex,value,1);

    Cbc_setInteger(model, 0);
    Cbc_setInteger(model, 1);
    Cbc_setInteger(model, 2);
    Cbc_setObjSense(model, -1);

    Cbc_solve(model);
}

Best,
Miles


More information about the Cbc mailing list