Ignore:
Timestamp:
Mar 10, 2014 5:58:20 PM (5 years ago)
Author:
mlubin
Message:

More C interface work. Move C interface to libCbcSolver so that we can use CbcMain0 and CbcMain1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/Cbc_C_Interface.cpp

    r1898 r2016  
    232232    model->solver_->OsiClpSolverInterface::setHintParam(OsiDoReducePrint, true, OsiHintTry);
    233233    model->model_     = new CbcModel(solver1);
     234    CbcMain0(*model->model_);
    234235    model->handler_   = NULL;
    235236    model->information_ = NULL;
     
    310311    fflush(stdout);
    311312
    312     if (1) {
    313         solver->loadProblem(numcols, numrows, start, index, value,
    314                             collb, colub, obj, rowlb, rowub);
    315     } else {
    316         solver->loadProblem(0, 0, NULL, NULL, NULL,
    317                             NULL, NULL, NULL, NULL, NULL);
    318     }
     313    solver->loadProblem(numcols, numrows, start, index, value,
     314                        collb, colub, obj, rowlb, rowub);
    319315    if (VERBOSE > 1) printf("%s Finished solver->loadProblem()\n", prefix);
    320316    fflush(stdout);
     
    14791475
    14801476    if (VERBOSE > 0) printf("%s return %i\n", prefix, result);
     1477    return result;
     1478}
     1479COINLIBAPI int COINLINKAGE
     1480Cbc_solve(Cbc_Model * model)
     1481{
     1482    const char prefix[] = "Cbc_C_Interface::Cbc_solve(): ";
     1483    int result = 0;
     1484    const char *argv[] = {"Cbc_C_Interface","-solve", "-quit"};
     1485    try {
     1486       
     1487        CbcMain1(3, argv, *model->model_);
     1488    } catch (CoinError e) {
     1489        printf("%s ERROR: %s::%s, %s\n", prefix,
     1490               e.className().c_str(), e.methodName().c_str(), e.message().c_str());
     1491    }
     1492    result = model->model_->status();
     1493
    14811494    return result;
    14821495}
Note: See TracChangeset for help on using the changeset viewer.