Ignore:
Timestamp:
Jan 14, 2009 4:14:09 PM (11 years ago)
Author:
forrest
Message:

out compiler warnings and stability improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpNode.cpp

    r1287 r1321  
    183183  sequence_=-1;
    184184  double integerTolerance = stuff->integerTolerance_;
    185   double mostAway=integerTolerance;
     185  double mostAway=0.0;
    186186  sumInfeasibilities_ = 0.0;
    187187  numberInfeasibilities_ = 0;
     
    251251    if (integerType[iColumn]) {
    252252      double value = solution[iColumn];
    253       value = CoinMax(value,(double) lower[iColumn]);
    254       value = CoinMin(value,(double) upper[iColumn]);
     253      value = CoinMax(value,static_cast<double> (lower[iColumn]));
     254      value = CoinMin(value,static_cast<double> (upper[iColumn]));
    255255      double nearest = floor(value+0.5);
    256256      if (fabs(value-nearest)>integerTolerance) {
     
    295295            0.9*CoinMin(upValue,downValue) + integerTolerance;
    296296#elif PSEUDO==3
    297         double upValue = (ceil(value)-value)*(upPseudo[iInteger]/(1.0+numberUp[iInteger]+numberUpInfeasible[iInteger]));
    298         double downValue = (value-floor(value))*(downPseudo[iInteger]/(1.0+numberDown[iInteger]+numberDownInfeasible[iInteger]));
     297        // Extra 100% for infeasible branches
     298        double upValue = (ceil(value)-value)*(upPseudo[iInteger]/
     299                                              (1.0+numberUp[iInteger]));
     300        if (numberUp[iInteger]) {
     301          double ratio = 1.0+static_cast<double>(numberUpInfeasible[iInteger])/
     302            static_cast<double>(numberUp[iInteger]);
     303          upValue *= ratio;
     304        }
     305        double downValue = (value-floor(value))*(downPseudo[iInteger]/
     306                                                 (1.0+numberDown[iInteger]));
     307        if (numberDown[iInteger]) {
     308          double ratio = 1.0+static_cast<double>(numberDownInfeasible[iInteger])/
     309            static_cast<double>(numberDown[iInteger]);
     310          downValue *= ratio;
     311        }
    299312        double infeasibility;
    300313        if (depth>1000)
     
    307320        double infeasibility = fabs(value-nearest);
    308321#endif
     322        assert (infeasibility>0.0);
    309323        if (infeasibility>mostAway) {
    310324          mostAway=infeasibility;
     
    373387    for (iColumn=0;iColumn<numberColumns;iColumn++) {
    374388      if (integerType[iColumn]) {
    375         lower_[iInteger]=(int) lower[iColumn];
    376         upper_[iInteger]=(int) upper[iColumn];
     389        lower_[iInteger]=static_cast<int> (lower[iColumn]);
     390        upper_[iInteger]=static_cast<int> (upper[iColumn]);
    377391        iInteger++;
    378392      }
     
    509523      if (integerType[iColumn]) {
    510524        iInteger++;
    511         if (lower_[iInteger]!=(int) lower[iColumn])
     525        if (lower_[iInteger]!=static_cast<int> (lower[iColumn]))
    512526          model->setColumnLower(iColumn,lower_[iInteger]);
    513         if (upper_[iInteger]!=(int) upper[iColumn])
     527        if (upper_[iInteger]!=static_cast<int> (upper[iColumn]))
    514528          model->setColumnUpper(iColumn,upper_[iInteger]);
    515529      }
     
    772786  for (int i=0;i<number;i++) {
    773787    int n;
    774     n = numberDown_[i]+numberDownInfeasible_[i];
     788    n = numberDown_[i];
    775789    if (n)
    776790      downPseudo_[i] *= n;
    777     n = numberUp_[i]+numberUpInfeasible_[i];
     791    n = numberUp_[i];
    778792    if (n)
    779793      upPseudo_[i] *= n;
     
    784798ClpNodeStuff::update(int way,int sequence,double change,bool feasible)
    785799{
     800  assert (numberDown_[sequence]>=numberDownInfeasible_[sequence]);
     801  assert (numberUp_[sequence]>=numberUpInfeasible_[sequence]);
    786802  if (way<0) {
    787     if (feasible)
    788       numberDown_[sequence]++;
    789     else
     803    numberDown_[sequence]++;
     804    if (!feasible)
    790805      numberDownInfeasible_[sequence]++;
    791806    downPseudo_[sequence] += CoinMax(change,1.0e-12);
    792807  } else {
    793     if (feasible)
    794       numberUp_[sequence]++;
    795     else
     808    numberUp_[sequence]++;
     809    if (!feasible)
    796810      numberUpInfeasible_[sequence]++;
    797811    upPseudo_[sequence] += CoinMax(change,1.0e-12);
Note: See TracChangeset for help on using the changeset viewer.