Ignore:
Timestamp:
Aug 3, 2007 12:07:00 PM (13 years ago)
Author:
forrest
Message:

message handling and sos to CbcSolver?

File:
1 edited

Legend:

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

    r719 r720  
    45274527    OsiBranchingObject * bobj = node->modifiableBranchingObject();
    45284528    CbcBranchingObject * cbcobj = dynamic_cast<CbcBranchingObject *> (bobj);
    4529     if (cbcobj) {
     4529    if (cbcobj&&cbcobj->object()) {
    45304530      CbcObject * object = cbcobj->object();
    45314531      CbcObjectUpdateData update = object->createUpdateInformation(solver_,node,cbcobj);
     
    68556855    OsiClpSolverInterface * clpSolver
    68566856      = dynamic_cast<OsiClpSolverInterface *> (solver_);
    6857     if (clpSolver&&clpSolver->numberSOS()) {
     6857    if (clpSolver&&(clpSolver->numberSOS()||clpSolver->numberObjects())) {
    68586858      // deal with sos
    68596859      const CoinSet * setInfo = clpSolver->setInfo();
    68606860      int numberSOS = clpSolver->numberSOS();
    6861       nObjects=0;
    6862       delete [] oldObject;
    6863       oldObject = new OsiObject * [numberSOS];
    6864       for (int i=0;i<numberSOS;i++) {
    6865         int type = setInfo[i].setType();
    6866         int n=setInfo[i].numberEntries();
    6867         const int * which = setInfo[i].which();
    6868         const double * weights = setInfo[i].weights();
    6869         oldObject[nObjects++] = new CbcSOS(this,n,which,weights,i,type);
     6861      if (numberSOS) {
     6862        nObjects=0;
     6863        delete [] oldObject;
     6864        oldObject = new OsiObject * [numberSOS];
     6865        for (int i=0;i<numberSOS;i++) {
     6866          int type = setInfo[i].setType();
     6867          int n=setInfo[i].numberEntries();
     6868          const int * which = setInfo[i].which();
     6869          const double * weights = setInfo[i].weights();
     6870          oldObject[nObjects++] = new CbcSOS(this,n,which,weights,i,type);
     6871        }
     6872      } else {
     6873        // objects - only works with SOS at present
     6874        int numberObjects = clpSolver->numberObjects();
     6875        nObjects=0;
     6876        delete [] oldObject;
     6877        oldObject = new OsiObject * [numberObjects];
     6878        OsiObject ** osiObjects = clpSolver->objects();
     6879        for (int i=0;i<numberObjects;i++) {
     6880          OsiSOS * obj =
     6881            dynamic_cast <OsiSOS *>(osiObjects[i]) ;
     6882          if (obj) {
     6883            int type = obj->setType();
     6884            int n=obj->numberMembers();
     6885            const int * which = obj->members();
     6886            const double * weights = obj->weights();
     6887            oldObject[nObjects++] = new CbcSOS(this,n,which,weights,i,type);
     6888          }
     6889        }
    68706890      }
    68716891    }
Note: See TracChangeset for help on using the changeset viewer.