Changeset 262


Ignore:
Timestamp:
Feb 21, 2006 10:36:59 AM (14 years ago)
Author:
forrest
Message:

for strong stats

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/CbcMessage.cpp

    r208 r262  
    4949  {CBC_HEURISTIC_SOLUTION,30,1,"solution of %g found by %s"},
    5050  {CBC_CUTS_STATS,31,1,"%d added rows had average density of %g"},
     51  {CBC_STRONG_STATS,32,1,"Strong branching done %d times (%d iterations), fathomed %d nodes and fixed %d variables"},
    5152  {CBC_DUMMY_END,999999,0,""}
    5253};
  • trunk/CbcModel.cpp

    r259 r262  
    389389*/
    390390  dblParam_[CbcStartSeconds] = CoinCpuTime();
     391  strongInfo_[0]=0;
     392  strongInfo_[1]=0;
     393  strongInfo_[2]=0;
     394  numberStrongIterations_ = 0;
    391395  // original solver (only set if pre-processing)
    392396  OsiSolverInterface * originalSolver=NULL;
     
    14581462      << CoinMessageEol ;
    14591463  }
     1464  if (numberStrongIterations_)
     1465    handler_->message(CBC_STRONG_STATS,messages_)
     1466      << strongInfo_[0] << numberStrongIterations_ << strongInfo_[2]
     1467      << strongInfo_[1] << CoinMessageEol ;
    14601468  if (statistics_) {
    14611469    // report in some way
     
    16971705*/
    16981706  dblParam_[CbcStartSeconds] = CoinCpuTime();
     1707  strongInfo_[0]=0;
     1708  strongInfo_[1]=0;
     1709  strongInfo_[2]=0;
     1710  numberStrongIterations_ = 0;
    16991711  // original solver (only set if pre-processing)
    17001712  OsiSolverInterface * originalSolver=NULL;
     
    23622374      << CoinMessageEol ;
    23632375  }
     2376  if (numberStrongIterations_)
     2377    handler_->message(CBC_STRONG_STATS,messages_)
     2378      << strongInfo_[0] << numberStrongIterations_ << strongInfo_[2]
     2379      << strongInfo_[1] << CoinMessageEol ;
    23642380  if (statistics_) {
    23652381    // report in some way
     
    34253441  dblParam_[CbcCurrentMinimizationObjectiveValue] = 1.0e100;
    34263442  dblParam_[CbcStartSeconds] = 0.0;
     3443  strongInfo_[0]=0;
     3444  strongInfo_[1]=0;
     3445  strongInfo_[2]=0;
    34273446  nodeCompare_=new CbcCompareDefault();;
    34283447  problemFeasibility_=new CbcFeasibilityBase();
     
    35423561  dblParam_[CbcCurrentMinimizationObjectiveValue] = 1.0e100;
    35433562  dblParam_[CbcStartSeconds] = 0.0;
     3563  strongInfo_[0]=0;
     3564  strongInfo_[1]=0;
     3565  strongInfo_[2]=0;
    35443566
    35453567  nodeCompare_=new CbcCompareDefault();;
     
    37323754  dblParam_[CbcCurrentMinimizationObjectiveValue] = rhs.dblParam_[CbcCurrentMinimizationObjectiveValue];
    37333755  dblParam_[CbcStartSeconds] = dblParam_[CbcStartSeconds]; // will be overwritten hopefully
     3756  strongInfo_[0]=rhs.strongInfo_[0];
     3757  strongInfo_[1]=rhs.strongInfo_[1];
     3758  strongInfo_[2]=rhs.strongInfo_[2];
    37343759  if (rhs.emptyWarmStart_) emptyWarmStart_ = rhs.emptyWarmStart_->clone() ;
    37353760  if (defaultHandler_) {
     
    40194044    searchStrategy_ = rhs.searchStrategy_;
    40204045    numberStrongIterations_ = rhs.numberStrongIterations_;
     4046    strongInfo_[0]=rhs.strongInfo_[0];
     4047    strongInfo_[1]=rhs.strongInfo_[1];
     4048    strongInfo_[2]=rhs.strongInfo_[2];
    40214049    lastHeuristic_ = NULL;
    40224050    numberCutGenerators_ = rhs.numberCutGenerators_;
     
    84468474  }
    84478475}
     8476// Increment strong info
     8477void
     8478CbcModel::incrementStrongInfo(int numberTimes, int numberIterations,
     8479                           int numberFixed, bool ifInfeasible)
     8480{
     8481  strongInfo_[0] += numberTimes;
     8482  numberStrongIterations_ += numberIterations;
     8483  strongInfo_[1] += numberFixed;
     8484  if (ifInfeasible)
     8485    strongInfo_[2] ++;
     8486}
  • trunk/CbcNode.cpp

    r259 r262  
    16811681      delete ws;
    16821682      int numberNodes = model->getNodeCount();
    1683       // update number of strong iterations
    1684       model->setNumberStrongIterations(model->numberStrongIterations()+numberStrongIterations);
     1683      // update number of strong iterations etc
     1684      model->incrementStrongInfo(numberStrongDone,numberStrongIterations,
     1685                                 anyAction==-2 ? 0:numberStrongInfeasible,anyAction==-2);
    16851686     
    16861687      /*
     
    30063007         numberStrongDone,numberStrongIterations,xPen,xMark,
    30073008           numberToFix,anyAction,numberNotTrusted,px[0],px[1],px[2]>0 ? "y" : "n",px[3]);
    3008   // update number of strong iterations
    3009   model->setNumberStrongIterations(model->numberStrongIterations()+numberStrongIterations);
     3009  // update number of strong iterations etc
     3010  model->incrementStrongInfo(numberStrongDone,numberStrongIterations,
     3011                             anyAction==-2 ? 0:numberToFix,anyAction==-2);
    30103012  if (!newWay) {
    30113013  if (((model->searchStrategy()+1)%1000)==0) {
  • trunk/include/CbcMessage.hpp

    r208 r262  
    5454  CBC_HEURISTIC_SOLUTION,
    5555  CBC_CUTS_STATS,
     56  CBC_STRONG_STATS,
    5657  CBC_DUMMY_END
    5758};
  • trunk/include/CbcModel.hpp

    r259 r262  
    14301430  inline int numberStrongIterations() const
    14311431  { return numberStrongIterations_;};
     1432  /// Increment strong info
     1433  void incrementStrongInfo(int numberTimes, int numberIterations,
     1434                           int numberFixed, bool ifInfeasible);
    14321435  //@}
    14331436
     
    17571760  /// Number of iterations in strong branching
    17581761  int numberStrongIterations_;
     1762  /** 0 - number times strong branching done, 1 - number fixed, 2 - number infeasible */
     1763  int strongInfo_[3];
    17591764  /// Whether to force a resolve after takeOffCuts
    17601765  bool resolveAfterTakeOffCuts_;
Note: See TracChangeset for help on using the changeset viewer.