Changeset 1822 for trunk/Cbc


Ignore:
Timestamp:
Nov 29, 2012 1:42:40 PM (7 years ago)
Author:
forrest
Message:

more output for proximity search

Location:
trunk/Cbc/src
Files:
3 edited

Legend:

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

    r1813 r1822  
    118118        numCouldRun_(0),
    119119        numberSolutionsFound_(0),
     120        numberNodesDone_(0),
    120121        inputSolution_(NULL)
    121122{
     
    145146        numCouldRun_(0),
    146147        numberSolutionsFound_(0),
     148        numberNodesDone_(0),
    147149        inputSolution_(NULL)
    148150{}
     
    172174    runNodes_ = rhs.runNodes_;
    173175    numberSolutionsFound_ = rhs.numberSolutionsFound_;
     176    numberNodesDone_ = rhs.numberNodesDone_;
    174177    if (rhs.inputSolution_) {
    175178        int numberColumns = model_->getNumCols();
     
    12111214                    solverD->setHintParam(OsiDoDualInResolve, takeHint, strength);
    12121215#endif
     1216                    numberNodesDone_ = model.getNodeCount();
    12131217#ifdef COIN_DEVELOP
    12141218                    printf("sub branch %d nodes, %d iterations - max %d\n",
  • trunk/Cbc/src/CbcHeuristic.hpp

    r1802 r1822  
    386386    int numberSolutionsFound_;
    387387
     388    /// How many nodes the heuristic did this go
     389    mutable int numberNodesDone_;
     390
    388391    // Input solution - so can be used as seed
    389392    double * inputSolution_;
  • trunk/Cbc/src/CbcHeuristicLocal.cpp

    r1816 r1822  
    11171117  delete [] obj;
    11181118  //newSolver->writeMps("xxxx");
    1119   char proxPrint[200];
    1120   sprintf(proxPrint,"Running proximity search for %d nodes",numberNodes_);
    1121   model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
    1122     << proxPrint
    1123     << CoinMessageEol;
    11241119  int maxSolutions = model_->getMaximumSolutions();
    11251120  model_->setMaximumSolutions(1);
     
    11651160    returnCode &= ~2;
    11661161  }
     1162  char proxPrint[200];
    11671163  if ((returnCode&1) != 0) {
    11681164    // redo objective
    11691165    const double * obj = model_->continuousSolver()->getObjCoefficients();
    11701166    solutionValue = - offset;
     1167    int sumIncrease=0.0;
     1168    int sumDecrease=0.0;
     1169    int numberIncrease=0;
     1170    int numberDecrease=0;
    11711171    for (int i=0;i<numberColumns;i++) {
    11721172      solutionValue += obj[i]*betterSolution[i];
    1173     }
     1173      if (model_->isInteger(i)) {
     1174        int change=static_cast<int>(floor(solutionIn[i]-betterSolution[i]+0.5));
     1175        if (change>0) {
     1176          numberIncrease++;
     1177          sumIncrease+=change;
     1178        } else if (change<0) {
     1179          numberDecrease++;
     1180          sumDecrease-=change;
     1181        }
     1182      }
     1183    }
     1184    sprintf(proxPrint,"Proximity search ran %d nodes (out of %d) - in new solution %d increased (%d), %d decreased (%d)",
     1185            numberNodesDone_,numberNodes_,
     1186            numberIncrease,sumIncrease,numberDecrease,sumDecrease);
     1187  } else {
     1188    sprintf(proxPrint,"Proximity search ran %d nodes - no new solution",
     1189            numberNodesDone_);
    11741190  }
     1191  model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1192    << proxPrint
     1193    << CoinMessageEol;
    11751194 
    11761195  delete newSolver;
Note: See TracChangeset for help on using the changeset viewer.