Ignore:
Timestamp:
Jul 15, 2007 5:28:33 PM (12 years ago)
Author:
forrest
Message:

add threaded to trunk

File:
1 edited

Legend:

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

    r640 r687  
    178178      // probably faster to use a basis to get integer solutions
    179179      model.setSpecialOptions(2);
     180#ifdef CBC_THREAD
     181      if (model_->getNumberThreads()>0&&(model_->getThreadMode()&1)!=0) {
     182        // See if at root node
     183        bool atRoot = model_->getNodeCount()==0;
     184        int passNumber = model_->getCurrentPassNumber();
     185        if (atRoot&&passNumber==1)
     186          model.setNumberThreads(model_->getNumberThreads());
     187      }
     188#endif
    180189      model.branchAndBound();
    181190      if (logLevel>1)
     
    302311      (when()%10==2&&(model_->phase()!=2&&model_->phase()!=3)))
    303312    return 0; // switched off
    304 
    305313  OsiSolverInterface * solver = model_->solver();
    306314  const double * lower = solver->getColLower();
     
    315323
    316324  int numberRows = matrix_.getNumRows();
    317 
     325  assert (numberRows<=solver->getNumRows());
    318326  int numberIntegers = model_->numberIntegers();
    319327  const int * integerVariable = model_->integerVariable();
     
    322330  double newSolutionValue = direction*solver->getObjValue();
    323331  int returnCode = 0;
    324 
    325332  // Column copy
    326333  const double * element = matrix_.getElements();
     
    893900      }
    894901    }
     902    // Just in case of some stupidity
     903    double objOffset=0.0;
     904    solver->getDblParam(OsiObjOffset,objOffset);
     905    newSolutionValue = -objOffset;
     906    for ( i=0 ; i<numberColumns ; i++ )
     907      newSolutionValue += objective[i]*newSolution[i];
     908    newSolutionValue *= direction;
     909    //printf("new solution value %g %g\n",newSolutionValue,solutionValue);
    895910    if (newSolutionValue<solutionValue) {
    896911      // paranoid check
Note: See TracChangeset for help on using the changeset viewer.