Changeset 1121


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

compiler warnings, deterministic parallel and stability

Location:
trunk/Cbc/src
Files:
33 edited

Legend:

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

    r1088 r1121  
    530530    // probably best to use pseudo duals
    531531    double value = lastNonZero-firstNonZero+1;
    532     value *= 0.5/((double) numberMembers_);
     532    value *= 0.5/static_cast<double> (numberMembers_);
    533533    // adjust??
    534534    return value;
     
    724724      if (numberTimesDown_)
    725725        downCost *= downDynamicPseudoRatio_/
    726           ((double) numberTimesDown_);
     726          static_cast<double> (numberTimesDown_);
    727727      if (numberTimesUp_)
    728728        upCost *= upDynamicPseudoRatio_/
    729           ((double) numberTimesUp_);
     729          static_cast<double> (numberTimesUp_);
    730730#define WEIGHT_AFTER 0.7
    731731#define WEIGHT_BEFORE 0.1
     
    749749    } else {
    750750      double value = lastNonZero-firstNonZero+1;
    751       value *= 0.5/((double) numberMembers_);
     751      value *= 0.5/static_cast<double> (numberMembers_);
    752752      return value;
    753753    }
     
    30863086          if (numberNext<numberUnsatisfied) {
    30873087            int numberUp = numberUnsatisfied - numberInfeasibilitiesUp[i];
    3088             double perUnsatisfied = changeUp[i]/(double) numberUp;
     3088            double perUnsatisfied = changeUp[i]/static_cast<double> (numberUp);
    30893089            double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied;
    30903090            if (estimatedObjective<cutoff)
     
    30943094          if (numberNext<numberUnsatisfied) {
    30953095            int numberDown = numberUnsatisfied - numberInfeasibilitiesDown[i];
    3096             double perUnsatisfied = changeDown[i]/(double) numberDown;
     3096            double perUnsatisfied = changeDown[i]/static_cast<double> (numberDown);
    30973097            double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied;
    30983098            if (estimatedObjective<cutoff)
     
    32113211        if (numberNext<numberUnsatisfied) {
    32123212          int numberUp = numberUnsatisfied - numberInfeasibilitiesUp[i];
    3213           double perUnsatisfied = changeUp[i]/(double) numberUp;
     3213          double perUnsatisfied = changeUp[i]/static_cast<double> (numberUp);
    32143214          double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied;
    32153215          if (estimatedObjective<bestEstimate) {
     
    32223222        if (numberNext<numberUnsatisfied) {
    32233223          int numberDown = numberUnsatisfied - numberInfeasibilitiesDown[i];
    3224           double perUnsatisfied = changeDown[i]/(double) numberDown;
     3224          double perUnsatisfied = changeDown[i]/static_cast<double> (numberDown);
    32253225          double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied;
    32263226          if (estimatedObjective<bestEstimate) {
     
    33513351        }
    33523352        if (good)
    3353           rhs_[i]=(int) value;
     3353          rhs_[i]=static_cast<int> (value);
    33543354      }
    33553355    }
     
    34423442            numberUnsatisfied++;
    34433443        } else {
    3444           rhsValue -= (int)(value*floor(solValue+0.5));
     3444          rhsValue -= static_cast<int>(value*floor(solValue+0.5));
    34453445        }
    34463446      }
     
    46364636#endif
    46374637      for (int i=0;i<numberIntegers;i++) {
     4638#ifndef NDEBUG
    46384639        CbcSimpleIntegerDynamicPseudoCost * obj =
    46394640          dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(objects[i]) ;
    46404641        assert (obj&&obj->columnNumber()==integerVariable[i]);
     4642#else
     4643        CbcSimpleIntegerDynamicPseudoCost * obj =
     4644          static_cast <CbcSimpleIntegerDynamicPseudoCost *>(objects[i]) ;
     4645#endif
    46414646        if (info->numberUp_[i]>0) {
    46424647          if (info->downPseudo_[i]>largest)
  • trunk/Cbc/src/CbcBranchActual.hpp

    r1087 r1121  
    3535
    3636  // Destructor
    37   ~CbcClique ();
     37  virtual ~CbcClique ();
    3838 
    3939  using CbcObject::infeasibility ;
     
    124124
    125125  // Destructor
    126   ~CbcSOS ();
     126  virtual ~CbcSOS ();
    127127 
    128128  using CbcObject::infeasibility ;
     
    256256
    257257  // Destructor
    258   ~CbcSimpleInteger ();
     258  virtual ~CbcSimpleInteger ();
    259259  /// Construct an OsiSimpleInteger object
    260260  OsiSimpleInteger * osiObject() const;
     
    381381
    382382  /// Destructor
    383   ~CbcNWay ();
     383  virtual ~CbcNWay ();
    384384
    385385  /// Set up a consequence for a single member
     
    591591
    592592  // Destructor
    593   ~CbcSimpleIntegerPseudoCost ();
     593  virtual ~CbcSimpleIntegerPseudoCost ();
    594594 
    595595  using CbcObject::infeasibility ;
  • trunk/Cbc/src/CbcBranchBase.cpp

    r1100 r1121  
    2323    model_(NULL),
    2424   id_(-1),
    25 #ifdef CBC_DETERMINISTIC_THREAD
    2625   position_(-1),
    27 #endif
    2826   preferredWay_(0)
    2927{
     
    3533    model_(model),
    3634    id_(-1),
    37 #ifdef CBC_DETERMINISTIC_THREAD
    3835    position_(-1),
    39 #endif
    4036    preferredWay_(0)
    4137{
     
    5450  model_ = rhs.model_;
    5551  id_ = rhs.id_;
    56 #ifdef CBC_DETERMINISTIC_THREAD
    5752  position_ = rhs.position_;
    58 #endif
    5953  preferredWay_ = rhs.preferredWay_;
    6054}
     
    6862    model_ = rhs.model_;
    6963    id_ = rhs.id_;
    70 #ifdef CBC_DETERMINISTIC_THREAD
    7164    position_ = rhs.position_;
    72 #endif
    7365    preferredWay_ = rhs.preferredWay_;
    7466  }
  • trunk/Cbc/src/CbcBranchBase.hpp

    r1100 r1121  
    215215  { return id_;}
    216216 
    217 #ifdef CBC_DETERMINISTIC_THREAD
    218217  /// Get position in object_ list
    219218  inline int position() const
     
    223222  inline void setPosition(int position)
    224223  { position_ = position;}
    225 #endif
    226224 
    227225   /// update model
     
    249247  /// Identifier (normally column number in matrix)
    250248  int id_;
    251 #ifdef CBC_DETERMINISTIC_THREAD
    252249  /// Position in object list
    253250  int position_;
    254 #endif
    255251  /// If -1 down always chosen first, +1 up always, 0 normal
    256252  int preferredWay_;
  • trunk/Cbc/src/CbcBranchCut.cpp

    r912 r1121  
    220220    }
    221221  }
     222  // leave as cut
     223  //model_->setNextRowCut(*cut);
     224  //return 0.0;
    222225  // assume cut was cunningly constructed so we need not worry too much about tolerances
    223226  if (low+1.0e-8>=ub&&canFix_) {
     
    373376    mark_ = new char[numberColumns];
    374377    memcpy(mark_,mark,numberColumns);
     378  } else {
     379    mark_ = NULL;
    375380  }
    376381  depth_ = depth;
     
    445450  double tolerance = CoinMin(1.0e-8,integerTolerance);
    446451  // How many fixed are we aiming at
    447   int wantedFixed = (int) ((double)numberIntegers*fractionFixed_);
     452  int wantedFixed = static_cast<int> (static_cast<double>(numberIntegers)*fractionFixed_);
    448453  int nSort=0;
    449454  int numberFixed=0;
     
    478483    CoinSort_2(dsort,dsort+nSort,sort);
    479484    nSort= CoinMin(nSort,wantedFixed-numberFixed);
    480   } else {
     485  } else if (type<10) {
    481486    int i;
    482487    //const double * rowLower = solver->getRowLower();
     
    535540    // sort
    536541    CoinSort_2(dsort,dsort+numberColumns,sort);
     542  } else {
     543    // new way
     544    for (i=0;i<numberIntegers;i++) {
     545      int iColumn = integerVariable[i];
     546      if (upper[iColumn]>lower[iColumn]) {
     547        if (!mark_||!mark_[iColumn]) {
     548          double distanceDown=solution[iColumn]-lower[iColumn];
     549          double distanceUp=upper[iColumn]-solution[iColumn];
     550          double distance = CoinMin(distanceDown,distanceUp);
     551          if (distance>0.001&&distance<0.5) {
     552            dsort[nSort]=distance;
     553            sort[nSort++]=iColumn;
     554          }
     555        }
     556      }
     557    }
     558    // sort
     559    CoinSort_2(dsort,dsort+nSort,sort);
     560    int n=0;
     561    double sum=0.0;
     562    for (int k=0;k<nSort;k++) {
     563      sum += dsort[k];
     564      if (sum<=djTolerance_)
     565        n=k;
     566      else
     567        break;
     568    }
     569    nSort = CoinMin(n,numberClean_/1000000);
    537570  }
    538571  OsiRowCut down;
     
    541574  for (i=0;i<nSort;i++) {
    542575    int iColumn = sort[i];
    543     if(solution[iColumn]<lower[iColumn]+tolerance) {
     576    double distanceDown=solution[iColumn]-lower[iColumn];
     577    double distanceUp=upper[iColumn]-solution[iColumn];
     578    if(distanceDown<distanceUp) {
    544579      rhs += lower[iColumn];
    545580      dsort[i]=1.0;
    546       assert (!lower[iColumn]);
    547581    } else {
    548       assert (solution[iColumn]>upper[iColumn]-tolerance);
    549582      rhs -= upper[iColumn];
    550583      dsort[i]=-1.0;
    551       //printf("%d at ub of %g\n",iColumn,upper[iColumn]);
    552584    }
    553585  }
    554586  down.setUb(rhs);
    555587  down.setRow(nSort,sort,dsort);
     588  down.setEffectiveness(COIN_DBL_MAX); // so will persist
    556589  delete [] sort;
    557590  delete [] dsort;
     
    569602/* Does a lot of the work,
    570603   Returns 0 if no good, 1 if dj, 2 if clean, 3 if both
     604   10 if branching on ones away from bound
    571605*/
    572606int
     
    585619  int numberIntegers = model_->numberIntegers();
    586620  const int * integerVariable = model_->integerVariable();
     621  if (numberClean_>1000000) {
     622    int wanted = numberClean_%1000000;
     623    int * sort = new int[numberIntegers];
     624    double * dsort = new double[numberIntegers];
     625    int nSort=0;
     626    for (i=0;i<numberIntegers;i++) {
     627      int iColumn = integerVariable[i];
     628      if (upper[iColumn]>lower[iColumn]) {
     629        if (!mark_||!mark_[iColumn]) {
     630          double distanceDown=solution[iColumn]-lower[iColumn];
     631          double distanceUp=upper[iColumn]-solution[iColumn];
     632          double distance = CoinMin(distanceDown,distanceUp);
     633          if (distance>0.001&&distance<0.5) {
     634            dsort[nSort]=distance;
     635            sort[nSort++]=iColumn;
     636          }
     637        }
     638      }
     639    }
     640    // sort
     641    CoinSort_2(dsort,dsort+nSort,sort);
     642    int n=0;
     643    double sum=0.0;
     644    for (int k=0;k<nSort;k++) {
     645      sum += dsort[k];
     646      if (sum<=djTolerance_)
     647        n=k;
     648      else
     649        break;
     650    }
     651    delete [] sort;
     652    delete [] dsort;
     653    return (n>=wanted) ? 10 : 0;
     654  }
    587655  double integerTolerance =
    588656    model_->getDblParam(CbcModel::CbcIntegerTolerance);
     
    590658  double tolerance = CoinMin(1.0e-8,integerTolerance);
    591659  // How many fixed are we aiming at
    592   int wantedFixed = (int) ((double)numberIntegers*fractionFixed_);
     660  int wantedFixed = static_cast<int> (static_cast<double>(numberIntegers)*fractionFixed_);
    593661  if (djTolerance_<1.0e10) {
    594662    int nSort=0;
  • trunk/Cbc/src/CbcBranchDynamic.cpp

    r1088 r1121  
    1010#include <cfloat>
    1111//#define CBC_DEBUG
    12 
     12//#define TRACE_ONE 19
    1313#include "OsiSolverInterface.hpp"
    1414#include "OsiSolverBranch.hpp"
     
    399399CbcSimpleIntegerDynamicPseudoCost::updateBefore(const OsiObject * rhs)
    400400{
     401#ifndef NDEBUG
    401402  const CbcSimpleIntegerDynamicPseudoCost * rhsObject =
    402403    dynamic_cast <const CbcSimpleIntegerDynamicPseudoCost *>(rhs) ;
    403404  assert (rhsObject);
     405#else
     406  const CbcSimpleIntegerDynamicPseudoCost * rhsObject =
     407    static_cast <const CbcSimpleIntegerDynamicPseudoCost *>(rhs) ;
     408#endif
    404409  copySome(rhsObject);
    405410}
     
    410415CbcSimpleIntegerDynamicPseudoCost::updateAfter(const OsiObject * rhs, const OsiObject * baseObjectX)
    411416{
     417#ifndef NDEBUG
    412418  const CbcSimpleIntegerDynamicPseudoCost * rhsObject =
    413419    dynamic_cast <const CbcSimpleIntegerDynamicPseudoCost *>(rhs) ;
     
    416422    dynamic_cast <const CbcSimpleIntegerDynamicPseudoCost *>(baseObjectX) ;
    417423  assert (baseObject);
     424#else
     425  const CbcSimpleIntegerDynamicPseudoCost * rhsObject =
     426    static_cast <const CbcSimpleIntegerDynamicPseudoCost *>(rhs) ;
     427  const CbcSimpleIntegerDynamicPseudoCost * baseObject =
     428    static_cast <const CbcSimpleIntegerDynamicPseudoCost *>(baseObjectX) ;
     429#endif
    418430  // compute current
    419   double sumDown = downDynamicPseudoCost_*(numberTimesDown_+numberTimesDownInfeasible_);
    420   sumDown -= baseObject->downDynamicPseudoCost_*(baseObject->numberTimesDown_+baseObject->numberTimesDownInfeasible_);
     431  double sumDown = downDynamicPseudoCost_*numberTimesDown_;
     432  sumDown -= baseObject->downDynamicPseudoCost_*baseObject->numberTimesDown_;
    421433  sumDown = CoinMax(sumDown,0.0);
    422   sumDown += rhsObject->downDynamicPseudoCost_*(rhsObject->numberTimesDown_+rhsObject->numberTimesDownInfeasible_);
    423   double sumUp = upDynamicPseudoCost_*(numberTimesUp_+numberTimesUpInfeasible_);
    424   sumUp -= baseObject->upDynamicPseudoCost_*(baseObject->numberTimesUp_+baseObject->numberTimesUpInfeasible_);
    425   sumUp += rhsObject->upDynamicPseudoCost_*(rhsObject->numberTimesUp_+rhsObject->numberTimesUpInfeasible_);
     434  sumDown += rhsObject->downDynamicPseudoCost_*rhsObject->numberTimesDown_;
     435  assert (rhsObject->numberTimesDown_>=baseObject->numberTimesDown_);
     436  assert (rhsObject->numberTimesDownInfeasible_>=baseObject->numberTimesDownInfeasible_);
     437  assert( rhsObject->sumDownCost_>=baseObject->sumDownCost_);
     438  double sumUp = upDynamicPseudoCost_*numberTimesUp_;
     439  sumUp -= baseObject->upDynamicPseudoCost_*baseObject->numberTimesUp_;
    426440  sumUp = CoinMax(sumUp,0.0);
     441  sumUp += rhsObject->upDynamicPseudoCost_*rhsObject->numberTimesUp_;
     442  assert (rhsObject->numberTimesUp_>=baseObject->numberTimesUp_);
     443  assert (rhsObject->numberTimesUpInfeasible_>=baseObject->numberTimesUpInfeasible_);
     444  assert( rhsObject->sumUpCost_>=baseObject->sumUpCost_);
    427445  sumDownCost_ += rhsObject->sumDownCost_-baseObject->sumDownCost_;
    428446  sumUpCost_ += rhsObject->sumUpCost_-baseObject->sumUpCost_;
     
    446464  numberTimesUpTotalFixed_ += rhsObject->numberTimesUpTotalFixed_-baseObject->numberTimesUpTotalFixed_;
    447465  numberTimesProbingTotal_ += rhsObject->numberTimesProbingTotal_-baseObject->numberTimesProbingTotal_;
    448   if (numberTimesDown_+numberTimesDownInfeasible_>0) {
    449     setDownDynamicPseudoCost(sumDown/(double) (numberTimesDown_+numberTimesDownInfeasible_));
    450   }
    451   if (numberTimesUp_+numberTimesUpInfeasible_>0) {
    452     setUpDynamicPseudoCost(sumUp/(double) (numberTimesUp_+numberTimesUpInfeasible_));
     466  if (numberTimesDown_>0) {
     467    setDownDynamicPseudoCost(sumDown/static_cast<double> (numberTimesDown_));
     468  }
     469  if (numberTimesUp_>0) {
     470    setUpDynamicPseudoCost(sumUp/static_cast<double> (numberTimesUp_));
    453471  }
    454472  //printf("XX %d down %d %d %g up %d %d %g\n",columnNumber_,numberTimesDown_,numberTimesDownInfeasible_,downDynamicPseudoCost_,
     
    642660#if INFEAS==1
    643661  sum += numberTimesDownInfeasible_*CoinMax(distanceToCutoff/(downCost+1.0e-12),sumDownCost_);
    644   number += numberTimesDownInfeasible_;
    645662#endif
    646663#elif TYPE2==1
     
    649666#if INFEAS==1
    650667  sum += numberTimesDownInfeasible_*CoinMax(distanceToCutoff/(downCost+1.0e-12),sumDownCost_);
    651   number += numberTimesDownInfeasible_;
    652668#endif
    653669#elif TYPE2==2
     
    655671#if INFEAS==1
    656672  sum += numberTimesDownInfeasible_*(distanceToCutoff/(downCost+1.0e-12));
    657   number += numberTimesDownInfeasible_;
    658673#endif
    659674#endif
     
    668683#if INFEAS==1
    669684  sum += numberTimesUpInfeasible_*CoinMax(distanceToCutoff/(upCost+1.0e-12),sumUpCost_);
    670   number += numberTimesUpInfeasible_;
    671685#endif
    672686#elif TYPE2==1
     
    675689#if INFEAS==1
    676690  sum += numberTimesUpInfeasible_*CoinMax(distanceToCutoff/(upCost+1.0e-12),sumUpCost_);
    677   number += numberTimesUpInfeasible_;
    678691#endif
    679692#elif TYPE2==1
     
    681694#if INFEAS==1
    682695  sum += numberTimesUpInfeasible_*(distanceToCutoff/(upCost+1.0e-12));
    683   number += numberTimesUpInfeasible_;
    684696#endif
    685697#endif
     
    739751        number = numberTimesDown_;
    740752        if (number>0)
    741           downCost2 *= sum / (double) number;
     753          downCost2 *= sum / static_cast<double> (number);
    742754        else
    743755          downCost2  *=  downDynamicPseudoCost_;
     
    746758        number = numberTimesUp_;
    747759        if (number>0)
    748           upCost2 *= sum / (double) number;
     760          upCost2 *= sum / static_cast<double> (number);
    749761        else
    750762          upCost2  *=  upDynamicPseudoCost_;
     
    780792      double down=1.0e-15;
    781793      if (numberTimesProbingTotal_) {
    782         up += numberTimesUpTotalFixed_/((double) numberTimesProbingTotal_);
    783         down += numberTimesDownTotalFixed_/((double) numberTimesProbingTotal_);
     794        up += numberTimesUpTotalFixed_/static_cast<double> (numberTimesProbingTotal_);
     795        down += numberTimesDownTotalFixed_/static_cast<double> (numberTimesProbingTotal_);
    784796      }
    785797      returnValue = 1 + 10.0*CoinMin(numberTimesDownLocalFixed_,numberTimesUpLocalFixed_) +
     
    793805      numberTimesInfeasible_  = CoinMax(numberTimesUp_,numberTimesDown_);
    794806    } else if (nn) {
    795       returnValue *= sqrt((double) nn);
     807      returnValue *= sqrt(static_cast<double> (nn));
    796808    }
    797809#endif
     
    853865#if INFEAS==1
    854866  sum += numberTimesDownInfeasible_*(distanceToCutoff/(downCost+1.0e-12));
    855   number += numberTimesDownInfeasible_;
    856867#endif
    857868  if (number>0)
    858     downCost *= sum / (double) number;
     869    downCost *= sum / static_cast<double> (number);
    859870  else
    860871    downCost  *=  downDynamicPseudoCost_;
     
    864875#if INFEAS==1
    865876  sum += numberTimesUpInfeasible_*(distanceToCutoff/(upCost+1.0e-12));
    866   number += numberTimesUpInfeasible_;
    867877#endif
    868878  if (number>0)
    869     upCost *= sum / (double) number;
     879    upCost *= sum / static_cast<double> (number);
    870880  else
    871881    upCost  *=  upDynamicPseudoCost_;
     
    914924      double down=1.0e-15;
    915925      if (numberTimesProbingTotal_) {
    916         up += numberTimesUpTotalFixed_/((double) numberTimesProbingTotal_);
    917         down += numberTimesDownTotalFixed_/((double) numberTimesProbingTotal_);
     926        up += numberTimesUpTotalFixed_/static_cast<double> (numberTimesProbingTotal_);
     927        down += numberTimesDownTotalFixed_/static_cast<double> (numberTimesProbingTotal_);
    918928      }
    919929      returnValue = 1 + 10.0*CoinMin(numberTimesDownLocalFixed_,numberTimesUpLocalFixed_) +
     
    10161026  double downCost = CoinMax((value-below)*downDynamicPseudoCost_,0.0);
    10171027  return downCost;
     1028}
     1029// Set down pseudo cost
     1030void
     1031CbcSimpleIntegerDynamicPseudoCost::setDownDynamicPseudoCost(double value)
     1032{
     1033#ifdef TRACE_ONE
     1034  double oldDown = sumDownCost_;
     1035#endif
     1036  downDynamicPseudoCost_=value;
     1037  sumDownCost_ = CoinMax(sumDownCost_,value*numberTimesDown_);
     1038#ifdef TRACE_ONE
     1039  if (columnNumber_==TRACE_ONE) {
     1040    double down = downDynamicPseudoCost_*numberTimesDown_;
     1041    printf("For %d sumDown %g (%d), inf (%d) - pseudo %g - sumDown was %g -> %g\n",
     1042           TRACE_ONE,down,numberTimesDown_,
     1043           numberTimesDownInfeasible_,downDynamicPseudoCost_,
     1044           oldDown,sumDownCost_);
     1045  }
     1046#endif
     1047}
     1048// Set up pseudo cost
     1049void
     1050CbcSimpleIntegerDynamicPseudoCost::setUpDynamicPseudoCost(double value)
     1051{
     1052#ifdef TRACE_ONE
     1053  double oldUp = sumUpCost_;
     1054#endif
     1055  upDynamicPseudoCost_=value;
     1056  sumUpCost_ = CoinMax(sumUpCost_,value*numberTimesUp_);
     1057#ifdef TRACE_ONE
     1058  if (columnNumber_==TRACE_ONE) {
     1059    double up = upDynamicPseudoCost_*numberTimesUp_;
     1060    printf("For %d sumUp %g (%d), inf (%d) - pseudo %g - sumUp was %g -> %g\n",
     1061           TRACE_ONE,up,numberTimesUp_,
     1062           numberTimesUpInfeasible_,upDynamicPseudoCost_,
     1063           oldUp,sumUpCost_);
     1064  }
     1065#endif
    10181066}
    10191067/* Pass in information on branch just done and create CbcObjectUpdateData instance.
     
    10711119  return newData;
    10721120}
     1121// Just update using feasible branches and keep count of infeasible
     1122#undef INFEAS
    10731123// Update object by CbcObjectUpdateData
    10741124void
     
    10961146      //printf("(down change %g value down %g ",change,movement);
    10971147      incrementNumberTimesDown();
     1148      addToSumDownChange(1.0e-30+movement);
     1149      addToSumDownDecrease(data.intDecrease_);
     1150#if TYPE2==0
     1151      addToSumDownCost(change/(1.0e-30+movement));
     1152      setDownDynamicPseudoCost(sumDownCost()/static_cast<double>( numberTimesDown()));
     1153#elif TYPE2==1
     1154      addToSumDownCost(change);
     1155      setDownDynamicPseudoCost(sumDownCost()/sumDownChange());
     1156#elif TYPE2==2
     1157      addToSumDownCost(change*TYPERATIO+(1.0-TYPERATIO)*change/(1.0e-30+movement));
     1158      setDownDynamicPseudoCost(sumDownCost()*(TYPERATIO/sumDownChange()+(1.0-TYPERATIO)/(double) numberTimesDown()));
     1159#endif
     1160    } else {
     1161#ifdef COIN_DEVELOP
     1162      hist.status_='d';
     1163#endif
     1164      //printf("(down infeasible value down %g ",change,movement);
     1165      incrementNumberTimesDown();
     1166      incrementNumberTimesDownInfeasible();
     1167#if INFEAS==2
     1168      double distanceToCutoff=0.0;
     1169      double objectiveValue = model->getCurrentMinimizationObjValue();
     1170      distanceToCutoff =  model->getCutoff()  - originalValue;
     1171      if (distanceToCutoff<1.0e20)
     1172        change = distanceToCutoff*2.0;
     1173      else
     1174        change = downDynamicPseudoCost()*movement*10.0;
     1175      change = CoinMax(1.0e-12*(1.0+fabs(originalValue)),change);
    10981176      addToSumDownChange(1.0e-30+movement);
    10991177      addToSumDownDecrease(data.intDecrease_);
     
    11081186      setDownDynamicPseudoCost(sumDownCost()*(TYPERATIO/sumDownChange()+(1.0-TYPERATIO)/(double) numberTimesDown()));
    11091187#endif
    1110     } else {
    1111 #ifdef COIN_DEVELOP
    1112       hist.status_='d';
    1113 #endif
    1114       //printf("(down infeasible value down %g ",change,movement);
    1115       incrementNumberTimesDownInfeasible();
    1116 #if INFEAS==2
    1117       double distanceToCutoff=0.0;
    1118       double objectiveValue = model->getCurrentMinimizationObjValue();
    1119       distanceToCutoff =  model->getCutoff()  - originalValue;
    1120       if (distanceToCutoff<1.0e20)
    1121         change = distanceToCutoff*2.0;
    1122       else
    1123         change = downDynamicPseudoCost()*movement*10.0;
    1124       change = CoinMax(1.0e-12*(1.0+fabs(originalValue)),change);
    1125       incrementNumberTimesDown();
    1126       addToSumDownChange(1.0e-30+movement);
    1127       addToSumDownDecrease(data.intDecrease_);
    1128 #if TYPE2==0
    1129       addToSumDownCost(change/(1.0e-30+movement));
    1130       setDownDynamicPseudoCost(sumDownCost()/(double) numberTimesDown());
    1131 #elif TYPE2==1
    1132       addToSumDownCost(change);
    1133       setDownDynamicPseudoCost(sumDownCost()/sumDownChange());
    1134 #elif TYPE2==2
    1135       addToSumDownCost(change*TYPERATIO+(1.0-TYPERATIO)*change/(1.0e-30+movement));
    1136       setDownDynamicPseudoCost(sumDownCost()*(TYPERATIO/sumDownChange()+(1.0-TYPERATIO)/(double) numberTimesDown()));
    1137 #endif
    11381188#endif
    11391189    }
     
    11471197      distanceToCutoff=10.0+fabs(originalValue);
    11481198    sum += numberTimesDownInfeasible_*CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(originalValue)));
    1149     number += numberTimesDownInfeasible_;
    1150     setDownDynamicPseudoCost(sum/(double) number);
     1199    setDownDynamicPseudoCost(sum/static_cast<double> (number));
    11511200#endif
    11521201  } else {
     
    11601209      //printf("(up change %g value down %g ",change,movement);
    11611210      incrementNumberTimesUp();
     1211      addToSumUpChange(1.0e-30+movement);
     1212      addToSumUpDecrease(data.intDecrease_);
     1213#if TYPE2==0
     1214      addToSumUpCost(change/(1.0e-30+movement));
     1215      setUpDynamicPseudoCost(sumUpCost()/static_cast<double> (numberTimesUp()));
     1216#elif TYPE2==1
     1217      addToSumUpCost(change);
     1218      setUpDynamicPseudoCost(sumUpCost()/sumUpChange());
     1219#elif TYPE2==2
     1220      addToSumUpCost(change*TYPERATIO+(1.0-TYPERATIO)*change/(1.0e-30+movement));
     1221      setUpDynamicPseudoCost(sumUpCost()*(TYPERATIO/sumUpChange()+(1.0-TYPERATIO)/(double) numberTimesUp()));
     1222#endif
     1223    } else {
     1224#ifdef COIN_DEVELOP
     1225      hist.status_='u';
     1226#endif
     1227      //printf("(up infeasible value down %g ",change,movement);
     1228      incrementNumberTimesUp();
     1229      incrementNumberTimesUpInfeasible();
     1230#if INFEAS==2
     1231      double distanceToCutoff=0.0;
     1232      double objectiveValue = model->getCurrentMinimizationObjValue();
     1233      distanceToCutoff =  model->getCutoff()  - originalValue;
     1234      if (distanceToCutoff<1.0e20)
     1235        change = distanceToCutoff*2.0;
     1236      else
     1237        change = upDynamicPseudoCost()*movement*10.0;
     1238      change = CoinMax(1.0e-12*(1.0+fabs(originalValue)),change);
    11621239      addToSumUpChange(1.0e-30+movement);
    11631240      addToSumUpDecrease(data.intDecrease_);
     
    11721249      setUpDynamicPseudoCost(sumUpCost()*(TYPERATIO/sumUpChange()+(1.0-TYPERATIO)/(double) numberTimesUp()));
    11731250#endif
    1174     } else {
    1175 #ifdef COIN_DEVELOP
    1176       hist.status_='u';
    1177 #endif
    1178       //printf("(up infeasible value down %g ",change,movement);
    1179       incrementNumberTimesUpInfeasible();
    1180 #if INFEAS==2
    1181       double distanceToCutoff=0.0;
    1182       double objectiveValue = model->getCurrentMinimizationObjValue();
    1183       distanceToCutoff =  model->getCutoff()  - originalValue;
    1184       if (distanceToCutoff<1.0e20)
    1185         change = distanceToCutoff*2.0;
    1186       else
    1187         change = upDynamicPseudoCost()*movement*10.0;
    1188       change = CoinMax(1.0e-12*(1.0+fabs(originalValue)),change);
    1189       incrementNumberTimesUp();
    1190       addToSumUpChange(1.0e-30+movement);
    1191       addToSumUpDecrease(data.intDecrease_);
    1192 #if TYPE2==0
    1193       addToSumUpCost(change/(1.0e-30+movement));
    1194       setUpDynamicPseudoCost(sumUpCost()/(double) numberTimesUp());
    1195 #elif TYPE2==1
    1196       addToSumUpCost(change);
    1197       setUpDynamicPseudoCost(sumUpCost()/sumUpChange());
    1198 #elif TYPE2==2
    1199       addToSumUpCost(change*TYPERATIO+(1.0-TYPERATIO)*change/(1.0e-30+movement));
    1200       setUpDynamicPseudoCost(sumUpCost()*(TYPERATIO/sumUpChange()+(1.0-TYPERATIO)/(double) numberTimesUp()));
    1201 #endif
    12021251#endif
    12031252    }
     
    12111260      distanceToCutoff=10.0+fabs(originalValue);
    12121261    sum += numberTimesUpInfeasible_*CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(originalValue)));
    1213     number += numberTimesUpInfeasible_;
    1214     setUpDynamicPseudoCost(sum/(double) number);
     1262    setUpDynamicPseudoCost(sum/static_cast<double> (number));
    12151263#endif
    12161264  }
    12171265  if (data.way_<0)
    1218     assert (numberTimesDown_+numberTimesDownInfeasible_>0);
     1266    assert (numberTimesDown_>0);
    12191267  else
    1220     assert (numberTimesUp_+numberTimesUpInfeasible_>0);
     1268    assert (numberTimesUp_>0);
    12211269  assert (downDynamicPseudoCost_>=0.0&&downDynamicPseudoCost_<1.0e100);
    12221270  downDynamicPseudoCost_ = CoinMax(1.0e-10,downDynamicPseudoCost_);
     
    12551303  numberTimesUpInfeasible_ = numberUpInfeasible;
    12561304  sumUpCost_ = sumUp;
    1257   if (numberTimesDown_+numberTimesDownInfeasible_>0) {
    1258     setDownDynamicPseudoCost(sumDownCost_/(double) (numberTimesDown_+numberTimesDownInfeasible_));
     1305  if (numberTimesDown_>0) {
     1306    setDownDynamicPseudoCost(sumDownCost_/static_cast<double> (numberTimesDown_));
    12591307    assert (downDynamicPseudoCost_>0.0&&downDynamicPseudoCost_<1.0e50);
    12601308  }
    1261   if (numberTimesUp_+numberTimesUpInfeasible_>0) {
    1262     setUpDynamicPseudoCost(sumUpCost_/(double) (numberTimesUp_+numberTimesUpInfeasible_));
     1309  if (numberTimesUp_>0) {
     1310    setUpDynamicPseudoCost(sumUpCost_/static_cast<double> (numberTimesUp_));
    12631311    assert (upDynamicPseudoCost_>0.0&&upDynamicPseudoCost_<1.0e50);
    12641312  }
     
    12831331    double devDown =0.0;
    12841332    if (numberTimesDown_) {
    1285       meanDown = sumDownCost_/(double) numberTimesDown_;
     1333      meanDown = sumDownCost_/static_cast<double> (numberTimesDown_);
    12861334      devDown = meanDown*meanDown + sumDownCostSquared_ -
    12871335        2.0*meanDown*sumDownCost_;
     
    12921340    double devUp =0.0;
    12931341    if (numberTimesUp_) {
    1294       meanUp = sumUpCost_/(double) numberTimesUp_;
     1342      meanUp = sumUpCost_/static_cast<double> (numberTimesUp_);
    12951343      devUp = meanUp*meanUp + sumUpCostSquared_ -
    12961344        2.0*meanUp*sumUpCost_;
     
    13381386    sum += numberTimesDownInfeasible()*(distanceToCutoff/(downCost+1.0e-12));
    13391387    if (number>0)
    1340       downCost *= sum / (double) number;
     1388      downCost *= sum / static_cast<double> (number);
    13411389    else
    13421390      downCost  *=  downDynamicPseudoCost_;
     
    13471395    sum += numberTimesUpInfeasible()*(distanceToCutoff/(upCost+1.0e-12));
    13481396    if (number>0)
    1349       upCost *= sum / (double) number;
     1397      upCost *= sum / static_cast<double> (number);
    13501398    else
    13511399      upCost  *=  upDynamicPseudoCost_;
     
    14551503    info.upMovement = object_->upDynamicPseudoCost()*(ceil(value_)-value_);
    14561504    info.downMovement = object_->downDynamicPseudoCost()*(value_-floor(value_));
    1457     info.numIntInfeasUp  -= (int) (object_->sumUpDecrease()/
    1458                                    (1.0e-12+(double) object_->numberTimesUp()));
     1505    info.numIntInfeasUp  -= static_cast<int> (object_->sumUpDecrease()/
     1506                                              (1.0e-12+static_cast<double> (object_->numberTimesUp())));
    14591507    info.numIntInfeasUp = CoinMax(info.numIntInfeasUp,0);
    14601508    info.numObjInfeasUp = 0;
    14611509    info.finishedUp = false;
    14621510    info.numItersUp = 0;
    1463     info.numIntInfeasDown  -= (int) (object_->sumDownDecrease()/
    1464                                    (1.0e-12+(double) object_->numberTimesDown()));
     1511    info.numIntInfeasDown  -= static_cast<int> (object_->sumDownDecrease()/
     1512                                                (1.0e-12+static_cast<double> (object_->numberTimesDown())));
    14651513    info.numIntInfeasDown = CoinMax(info.numIntInfeasDown,0);
    14661514    info.numObjInfeasDown = 0;
     
    14691517    info.fix =0;
    14701518  if (object_->numberTimesUp()<object_->numberBeforeTrust()+
    1471       object_->numberTimesUpInfeasible()||
     1519      2*object_->numberTimesUpInfeasible()||
    14721520      object_->numberTimesDown()<object_->numberBeforeTrust()+
    1473       object_->numberTimesDownInfeasible()) {
     1521      2*object_->numberTimesDownInfeasible()) {
    14741522    return 0;
    14751523  } else {
     
    15471595{
    15481596  OsiBranchingObject * obj = object->clone();
     1597#ifndef NDEBUG
    15491598  CbcBranchingObject * obj2 =
    15501599    dynamic_cast<CbcBranchingObject *>(obj);
     
    15551604  if (!branchingObject)
    15561605    printf("no dynamic branching object Dynamic Decision\n");
     1606#endif
     1607#else
     1608  CbcBranchingObject * obj2 =
     1609    static_cast<CbcBranchingObject *>(obj);
    15571610#endif
    15581611  //object_=branchingObject;
     
    16231676#if TYPE2==0
    16241677      object->addToSumDownCost(change/(1.0e-30+movement));
    1625       object->setDownDynamicPseudoCost(object->sumDownCost()/(double) object->numberTimesDown());
     1678      object->setDownDynamicPseudoCost(object->sumDownCost()/
     1679                                       static_cast<double> (object->numberTimesDown()));
    16261680#elif TYPE2==1
    16271681      object->addToSumDownCost(change);
     
    16331687    } else {
    16341688      //printf("(down infeasible value down %g ",change,movement);
     1689      object->incrementNumberTimesDown();
    16351690      object->incrementNumberTimesDownInfeasible();
    16361691#if INFEAS==2
     
    16431698        change = object->downDynamicPseudoCost()*movement*10.0;
    16441699      change = CoinMax(1.0e-12*(1.0+fabs(originalValue)),change);
    1645       object->incrementNumberTimesDown();
    16461700      object->addToSumDownChange(1.0e-30+movement);
    16471701      object->addToSumDownDecrease(originalUnsatisfied-unsatisfied);
     
    16691723#if TYPE2==0
    16701724      object->addToSumUpCost(change/(1.0e-30+movement));
    1671       object->setUpDynamicPseudoCost(object->sumUpCost()/(double) object->numberTimesUp());
     1725      object->setUpDynamicPseudoCost(object->sumUpCost()/
     1726                                     static_cast<double> (object->numberTimesUp()));
    16721727#elif TYPE2==1
    16731728      object->addToSumUpCost(change);
     
    16791734    } else {
    16801735      //printf("(up infeasible value down %g ",change,movement);
     1736      object->incrementNumberTimesUp();
    16811737      object->incrementNumberTimesUpInfeasible();
    16821738#if INFEAS==2
     
    16891745        change = object->upDynamicPseudoCost()*movement*10.0;
    16901746      change = CoinMax(1.0e-12*(1.0+fabs(originalValue)),change);
    1691       object->incrementNumberTimesUp();
    16921747      object->addToSumUpChange(1.0e-30+movement);
    16931748      object->addToSumUpDecrease(unsatisfied-originalUnsatisfied);
     
    17901845    distanceToCutoffC = CoinMax(distanceToCutoffC,1.0e-12*(1.0+fabs(objectiveValue)));
    17911846    int numberInfC = model->getContinuousInfeasibilities();
    1792     double perInf = distanceToCutoffC/((double) numberInfC);
     1847    double perInf = distanceToCutoffC/static_cast<double> (numberInfC);
    17931848    assert (perInf>0.0);
    17941849    //int numberIntegers = model->numberIntegers();
  • trunk/Cbc/src/CbcBranchDynamic.hpp

    r1087 r1121  
    4545
    4646  // Destructor
    47   ~CbcSimpleIntegerDynamicPseudoCost ();
     47  virtual ~CbcSimpleIntegerDynamicPseudoCost ();
    4848 
    4949  using CbcObject::infeasibility ;
     
    100100  { return downDynamicPseudoCost_;}
    101101  /// Set down pseudo cost
    102   inline void setDownDynamicPseudoCost(double value)
    103   { downDynamicPseudoCost_=value;}
     102  void setDownDynamicPseudoCost(double value) ;
    104103
    105104  /// Up pseudo cost
     
    107106  { return upDynamicPseudoCost_;}
    108107  /// Set up pseudo cost
    109   inline void setUpDynamicPseudoCost(double value)
    110   { upDynamicPseudoCost_=value;}
     108  void setUpDynamicPseudoCost(double value);
    111109
    112110  /// Up down separator
  • trunk/Cbc/src/CbcCompareActual.cpp

    r904 r1121  
    303303  double costPerInteger =
    304304    (model->getObjValue()-objectiveAtContinuous)/
    305     ((double) numberInfeasibilitiesAtContinuous);
     305    static_cast<double> (numberInfeasibilitiesAtContinuous);
    306306  weight_ = 0.95*costPerInteger;
    307307  saveWeight_ = 0.95*weight_;
  • trunk/Cbc/src/CbcCountRowCut.cpp

    r1088 r1121  
    2121  whichCutGenerator_(-1)
    2222{
    23 #ifdef CBC_DETERMINISTIC_THREAD
    24   numberPointingToThis_=10;
    25 #endif
    2623#ifdef CHECK_CUT_COUNTS
    2724  printf("CbcCountRowCut default constructor %x\n",this);
     
    3734    whichCutGenerator_(-1)
    3835{
    39 #ifdef CBC_DETERMINISTIC_THREAD
    40   numberPointingToThis_=10;
    41 #endif
    4236#ifdef CHECK_CUT_COUNTS
    4337  printf("CbcCountRowCut constructor %x from RowCut\n",this);
     
    4741CbcCountRowCut::CbcCountRowCut (const OsiRowCut & rhs,
    4842                                CbcNodeInfo * info, int whichOne,
    49                                 int whichGenerator)
     43                                int whichGenerator,
     44                                int numberPointingToThis)
    5045  : OsiRowCut(rhs),
    5146    owner_(info),
    5247    ownerCut_(whichOne),
    53     numberPointingToThis_(0),
     48    numberPointingToThis_(numberPointingToThis),
    5449    whichCutGenerator_(whichGenerator)
    5550{
    56 #ifdef CBC_DETERMINISTIC_THREAD
    57   numberPointingToThis_=10;
     51#ifdef CHECK_CUT_COUNTS
     52  printf("CbcCountRowCut constructor %x from RowCut and info %d\n",
     53         this,numberPointingToThis_);
    5854#endif
    59 #ifdef CHECK_CUT_COUNTS
    60   printf("CbcCountRowCut constructor %x from RowCut and info\n",this);
    61 #endif
     55  assert (!numberPointingToThis||numberPointingToThis==1000000000);
    6256}
    6357CbcCountRowCut::~CbcCountRowCut()
     
    7670{
    7771  assert(ownerCut_!=-1234567);
    78 #ifndef CBC_DETERMINISTIC_THREAD
    7972  numberPointingToThis_+=change;
    80 #endif
    8173}
    8274
     
    8678{
    8779  assert(ownerCut_!=-1234567);
    88 #ifndef CBC_DETERMINISTIC_THREAD
    89   //assert(numberPointingToThis_>=change);
    90   assert(numberPointingToThis_>=0);
    91   if(numberPointingToThis_<change) {
    92     assert(numberPointingToThis_>0);
    93     printf("negative cut count %d - %d\n",numberPointingToThis_, change);
    94     change = numberPointingToThis_;
     80  // See if plausible number
     81  if (change<900000000) {
     82    //assert(numberPointingToThis_>=change);
     83    assert(numberPointingToThis_>=0);
     84    if(numberPointingToThis_<change) {
     85      assert(numberPointingToThis_>0);
     86      printf("negative cut count %d - %d\n",numberPointingToThis_, change);
     87      change = numberPointingToThis_;
     88    }
     89    numberPointingToThis_-=change;
    9590  }
    96   numberPointingToThis_-=change;
    97 #else
    98   assert (numberPointingToThis_==10);
    99 #endif
    10091  return numberPointingToThis_;
    10192}
  • trunk/Cbc/src/CbcCountRowCut.hpp

    r952 r1121  
    4545    /// `Copy' constructor using an OsiRowCut and an CbcNodeInfo
    4646    CbcCountRowCut(const OsiRowCut &, CbcNodeInfo *, int whichOne,
    47                    int whichGenerator=-1); 
     47                   int whichGenerator=-1,int numberPointingToThis=0); 
    4848
    4949    /** Destructor
     
    109109
    110110};
    111 //#define CBC_DETERMINISTIC_THREAD
    112111
    113112#endif
  • trunk/Cbc/src/CbcCutGenerator.cpp

    r1053 r1121  
    3838    mustCallAgain_(false),
    3939    switchedOff_(false),
     40    globalCutsAtRoot_(false),
    4041    timing_(false),
    4142    timeInCutGenerator_(0.0),
     
    6061    mustCallAgain_(false),
    6162    switchedOff_(false),
     63    globalCutsAtRoot_(false),
    6264    timing_(false),
    6365    timeInCutGenerator_(0.0),
     
    6971    numberActiveCutsAtRoot_(0)
    7072{
     73  if (howOften<-1000) {
     74    globalCutsAtRoot_=true;
     75    howOften+=1000;
     76  }
    7177  model_ = model;
    7278  generator_=generator->clone();
     
    101107  mustCallAgain_ = rhs.mustCallAgain_;
    102108  switchedOff_ = rhs.switchedOff_;
     109  globalCutsAtRoot_ = rhs.globalCutsAtRoot_;
    103110  timing_ = rhs.timing_;
    104111  timeInCutGenerator_ = rhs.timeInCutGenerator_;
     
    132139    mustCallAgain_ = rhs.mustCallAgain_;
    133140    switchedOff_ = rhs.switchedOff_;
     141    globalCutsAtRoot_ = rhs.globalCutsAtRoot_;
    134142    timing_ = rhs.timing_;
    135143    timeInCutGenerator_ = rhs.timeInCutGenerator_;
     
    232240    info.inTree = node!=NULL;
    233241    info.randomNumberGenerator=randomNumberGenerator;
     242    info.options=(globalCutsAtRoot_) ? 8 : 0;
    234243    incrementNumberTimesEntered();
    235244    CglProbing* generator =
     
    246255      bool doCuts=false;
    247256      if (info2&&!depth) {
     257        info2->options=(globalCutsAtRoot_) ? 8 : 0;
    248258        info2->level = depth;
    249259        info2->pass = pass;
     
    269279            2000123,
    270280            2099999};
    271           int n = (int) (sizeof(test)/sizeof(int));
     281          int n = static_cast<int> (sizeof(test)/sizeof(int));
    272282          int saveStack = generator->getMaxLook();
    273283          int saveNumber = generator->getMaxProbe();
  • trunk/Cbc/src/CbcCutGenerator.hpp

    r931 r1121  
    290290  /// Temporary switch off marker
    291291  bool switchedOff_;
     292  /// Create global cuts (at root)
     293  bool globalCutsAtRoot_;
    292294  /// Whether call generator being timed
    293295  bool timing_;
  • trunk/Cbc/src/CbcFathomDynamicProgramming.cpp

    r904 r1121  
    198198  double check = COIN_INT_MAX;
    199199  for (i=0;i<numberRows;i++) {
    200     int n= (int) floor(rhs[i]+0.5);
     200    int n= static_cast<int> (floor(rhs[i]+0.5));
    201201    if (n) {
    202202      n++; // allow for 0,1... n
     
    227227    size_=COIN_INT_MAX;
    228228  else
    229     size_=(int) size;
     229    size_=static_cast<int> (size);
    230230       
    231231  int n01=0;
     
    273273    int kBit=0;
    274274    for (i=0;i<numberRows;i++) {
    275       int n= (int) floor(rhs[i]+0.5);
     275      int n= static_cast<int> (floor(rhs[i]+0.5));
    276276      if (n) {
    277277        lookup_[i]=numberActive;
     
    394394        int newRow = lookup_[i];
    395395        if (newRow>=0) {
    396           int gap=(int) (rowUpper[i]-CoinMax(0.0,rowLower[i]));
     396          int gap=static_cast<int> (rowUpper[i]-CoinMax(0.0,rowLower[i]));
    397397          lower2[newRow]=rhs_[newRow]-gap;
    398398          int numberBits = numberBits_[newRow];
     
    484484      double cost = direction * objective[i];
    485485      fixedObj += lowerValue*cost;
    486       int gap = (int) (upper[i]-lowerValue);
     486      int gap = static_cast<int> (upper[i]-lowerValue);
    487487      CoinBigIndex start = columnStart[i];
    488488      tryColumn(columnLength[i],row+start,element+start,cost,gap);
     
    522522        int newRow = lookup_[i];
    523523        if (newRow>=0) {
    524           int gap=(int) (rowUpper[i]-CoinMax(0.0,rowLower[i]));
     524          int gap=static_cast<int> (rowUpper[i]-CoinMax(0.0,rowLower[i]));
    525525          lower[newRow]=rhs_[newRow]-gap;
    526526          int numberBits = numberBits_[newRow];
     
    575575                int iRow=row[j];
    576576                double value = element[j];
    577                 int iValue = (int) value;
     577                int iValue = static_cast<int> (value);
    578578                if(iValue!=indices_[iRow]) {
    579579                  good=false;
     
    657657      int iRow=rows[j];
    658658      double value = coefficients[j];
    659       int iValue = (int) value;
     659      int iValue = static_cast<int> (value);
    660660      int newRow = lookup_[iRow];
    661661      if (newRow<0||iValue>rhs_[newRow]) {
  • trunk/Cbc/src/CbcHeuristic.cpp

    r1104 r1121  
    102102  howOften_(1),
    103103  decayFactor_(0.0),
     104  switches_(0),
    104105  shallowDepth_(1),
    105106  howOftenShallow_(1),
     
    127128  howOften_(1),
    128129  decayFactor_(0.0),
     130  switches_(0),
    129131  shallowDepth_(1),
    130132  howOftenShallow_(1),
     
    152154  howOften_ = rhs.howOften_;
    153155  decayFactor_ = rhs.howOften_;
     156  switches_ = rhs.switches_;
    154157  shallowDepth_= rhs.shallowDepth_;
    155158  howOftenShallow_= rhs.howOftenShallow_;
     
    204207        int way = brPrint->way();
    205208        printf("   parentBranch: var %i downBd [%i,%i] upBd [%i,%i] way %i\n",
    206                variable, (int)downBounds[0], (int)downBounds[1],
    207                (int)upBounds[0], (int)upBounds[1], way);
     209               variable, static_cast<int>(downBounds[0]), static_cast<int>(downBounds[1]),
     210               static_cast<int>(upBounds[0]), static_cast<int>(upBounds[1]), way);
    208211      }
    209212    }
     
    227230        int way = brPrint->way();
    228231        printf("        ownerbranch: var %i downBd [%i,%i] upBd [%i,%i] way %i\n",
    229                variable, (int)downBounds[0], (int)downBounds[1],
    230                (int)upBounds[0], (int)upBounds[1], way);
     232               variable, static_cast<int>(downBounds[0]), static_cast<int>(downBounds[1]),
     233               static_cast<int>(upBounds[0]), static_cast<int>(upBounds[1]), way);
    231234      }
    232235    }
     
    354357  if(depth != 0&&when_!=-999) {
    355358    const double numerator = depth * depth;
    356     const double denominator = exp(depth * log((double)2));
     359    const double denominator = exp(depth * log(2.0));
    357360    double probability = numerator / denominator;
    358361    double randomNumber = randomNumberGenerator_.randomDouble();
     
    386389            int old=howOften_;
    387390#endif
    388             howOften_ = CoinMin(CoinMax((int) (howOften_*1.1),howOften_+1),10000);
     391            howOften_ = CoinMin(CoinMax(static_cast<int> (howOften_*1.1),howOften_+1),10000);
    389392#ifdef COIN_DEVELOP
    390393            printf("Howoften changed from %d to %d for %s\n",
     
    470473  model_ = model;
    471474}
     475// Whether to exit at once on gap
     476bool
     477CbcHeuristic::exitNow(double bestObjective) const
     478{
     479  if ((switches_&1)==0)
     480    return false;
     481  // See if can stop on gap
     482  OsiSolverInterface * solver = model_->solver();
     483  double bestPossibleObjective = solver->getObjValue()*solver->getObjSense();
     484  double testGap = CoinMax(model_->getAllowableGap(),
     485                           CoinMax(fabs(bestObjective),
     486                                   fabs(bestPossibleObjective))
     487                           *model_->getAllowableFractionGap());
     488  if (bestObjective-bestPossibleObjective < testGap
     489      && model_->getCutoffIncrement()>=0.0) {
     490    return true;
     491  } else {
     492    return false;
     493  }
     494}
    472495#ifdef HISTORY_STATISTICS
    473496extern bool getHistoryStatistics_;
     
    513536    lpSolver->setSpecialOptions(lpSolver->specialOptions()|0x01000000); // say is Cbc (and in branch and bound)
    514537    lpSolver->setSpecialOptions(lpSolver->specialOptions()|
    515                                 (16384+4096+512+128));
     538                                (/*16384+*/4096+512+128));
    516539  }
    517540#endif
     
    551574      int afterRows = presolvedModel->getNumRows();
    552575      int afterCols = presolvedModel->getNumCols();
     576      //#define COIN_DEVELOP
     577#ifdef COIN_DEVELOP_z
     578      if (numberNodes<0) {
     579        solver->writeMpsNative("before.mps",NULL,NULL,2,1);
     580        presolvedModel->writeMpsNative("after1.mps",NULL,NULL,2,1);
     581      }
     582#endif
    553583      delete presolvedModel;
    554584      double after = 2*afterRows+afterCols;
     
    655685      // Say some rows cuts
    656686      int numberRows = solver->getNumRows();
    657       if (numberNodes_<numberRows) {
     687      if (numberNodes_<numberRows&&true /* think */) {
    658688        char * type = new char[numberRows];
    659689        memset(type,0,numberNodes_);
     
    672702      returnCode=2; // so will be infeasible
    673703    } else {
     704#ifdef COIN_DEVELOP_z
     705      if (numberNodes<0) {
     706        solver2->writeMpsNative("after2.mps",NULL,NULL,2,1);
     707      }
     708#endif
    674709      // see if too big
    675710      double after = 2*solver2->getNumRows()+solver2->getNumCols();
     
    787822        model.setSpecialOptions(model.specialOptions()|2);
    788823#ifdef CBC_THREAD
    789         if (model_->getNumberThreads()>0&&(model_->getThreadMode()&1)!=0) {
     824        if (model_->getNumberThreads()>0&&(model_->getThreadMode()&4)!=0) {
    790825          // See if at root node
    791826          bool atRoot = model_->getNodeCount()==0;
     
    11311166    int way = brPrint0->way();
    11321167    printf("   br0: var %i downBd [%i,%i] upBd [%i,%i] way %i\n",
    1133            variable, (int)downBounds[0], (int)downBounds[1],
    1134            (int)upBounds[0], (int)upBounds[1], way);
     1168           variable, static_cast<int>(downBounds[0]), static_cast<int>(downBounds[1]),
     1169           static_cast<int>(upBounds[0]), static_cast<int>(upBounds[1]), way);
    11351170    const CbcIntegerBranchingObject* brPrint1 =
    11361171      dynamic_cast<const CbcIntegerBranchingObject*>(br1);
     
    11401175    way = brPrint1->way();
    11411176    printf("   br1: var %i downBd [%i,%i] upBd [%i,%i] way %i\n",
    1142            variable, (int)downBounds[0], (int)downBounds[1],
    1143            (int)upBounds[0], (int)upBounds[1], way);
     1177           variable, static_cast<int>(downBounds[0]), static_cast<int>(downBounds[1]),
     1178           static_cast<int>(upBounds[0]), static_cast<int>(upBounds[1]), way);
    11441179#endif
    11451180    const int brComp = compare3BranchingObjects(br0, br1);
     
    19221957    int start[2];
    19231958    int end[2];
    1924     int iRandom = (int) (randomNumber*((double) numberIntegers));
     1959    int iRandom = static_cast<int> (randomNumber*(static_cast<double> (numberIntegers)));
    19251960    start[0]=iRandom;
    19261961    end[0]=numberIntegers;
  • trunk/Cbc/src/CbcHeuristic.hpp

    r1053 r1121  
    135135  inline int numberNodes() const
    136136  { return numberNodes_;}
     137  /** Switches (does not apply equally to all heuristics)
     138      1 bit - stop once allowable gap on objective reached
     139      2 bit - always do given number of passes
     140      4 bit - increase cutoff by 5% every 500 passes?
     141  */
     142  inline void setSwitches(int value)
     143  { switches_ = value;}
     144  /** Switches (does not apply equally to all heuristics)
     145      1 bit - stop once allowable gap on objective reached
     146      2 bit - always do given number of passes
     147      4 bit - increase cutoff by 5% every 500 passes?
     148  */
     149  inline int switches() const
     150  { return switches_;}
     151  /// Whether to exit at once on gap
     152  bool exitNow(double bestObjective) const;
    137153  /// Sets feasibility pump options (-1 is off)
    138154  inline void setFeasibilityPumpOptions(int value)
     
    224240  /// How much to increase how often
    225241  double decayFactor_;
     242  /** Switches on input (does not apply equally to all heuristics)
     243      1 bit - stop once allowable gap on objective reached
     244      2 bit - always do given number of passes
     245      4 bit - increase cutoff by 5% every 500 passes?
     246  */
     247  int switches_;
    226248  /** Upto this depth we call the tree shallow and the heuristic can be called
    227249      multiple times. That is, the test whether the current node is far from
  • trunk/Cbc/src/CbcHeuristicDive.cpp

    r1103 r1121  
    256256    candidate = new PseudoReducedCost [binVarIndex_.size()];
    257257
    258   const int maxNumberAtBoundToFix = (int) floor(percentageToFix_ * numberIntegers);
     258  const int maxNumberAtBoundToFix = static_cast<int> (floor(percentageToFix_ * numberIntegers));
    259259
    260260  // count how many fractional variables
     
    679679      }
    680680    }
    681     downLocks_[i] = (unsigned short) down;
    682     upLocks_[i] = (unsigned short) up;
     681    downLocks_[i] = static_cast<unsigned short> (down);
     682    upLocks_[i] = static_cast<unsigned short> (up);
    683683  }
    684684
  • trunk/Cbc/src/CbcHeuristicDiveVectorLength.cpp

    r944 r1121  
    105105       
    106106        // we want the smaller score
    107         double score = objDelta / ((double) columnLength[iColumn] + 1.0);
     107        double score = objDelta / (static_cast<double> (columnLength[iColumn]) + 1.0);
    108108
    109109        // if variable is not binary, penalize it
  • trunk/Cbc/src/CbcHeuristicFPump.cpp

    r1118 r1121  
    515515    }
    516516    if (scaleFactor)
    517       scaleFactor = (initialWeight_*sqrt((double) numberIntegers))/sqrt(scaleFactor);
     517      scaleFactor = (initialWeight_*sqrt(static_cast<double> (numberIntegers)))/sqrt(scaleFactor);
    518518#ifdef COIN_DEVELOP
    519519    if (scaleFactor)
     
    542542      if (numberIterationsPass1>=0) {
    543543        int n = totalNumberIterations - numberIterationsLastPass;
    544         if (n>CoinMax(15000,3*numberIterationsPass1)&&maximumPasses_<200) {
     544        if (n>CoinMax(15000,3*numberIterationsPass1)
     545            &&(switches_&2)==0&&maximumPasses_<200) {
    545546          exitAll=true;
    546547        }
    547548      }
    548549      // Exit on exact total number if maximumPasses large
    549       if (maximumPasses_>=200&&numberPasses+totalNumberPasses>=
     550      if ((maximumPasses_>=200||(switches_&2)!=0)
     551          &&numberPasses+totalNumberPasses>=
    550552          maximumPasses_)
    551553        exitAll=true;
     
    641643            memcpy(betterSolution,newSolution,numberColumns*sizeof(double));
    642644            solutionFound=true;
     645            if (exitNow(newSolutionValue))
     646              exitAll=true;
    643647            CoinWarmStartBasis * basis =
    644648              dynamic_cast<CoinWarmStartBasis *>(solver->getWarmStart()) ;
     
    673677                <<CoinMessageEol;
    674678            }
     679            if (exitNow(newSolutionValue))
     680              exitAll=true;
    675681          } else {
    676682            sprintf(pumpPrint,"Mini branch and bound could not fix general integers");
     
    874880                dynamic_cast<CoinWarmStartBasis *>(solver->getWarmStart()) ;
    875881              solutionFound=true;
     882              if (exitNow(newSolutionValue))
     883                exitAll=true;
    876884              if (basis) {
    877885                bestBasis = * basis;
     
    898906              solutionValue=newSolutionValue;
    899907              solutionFound=true;
     908              if (exitNow(newSolutionValue))
     909                exitAll=true;
    900910            } else {
    901911              returnCode=0;
     
    10301040            newTrueSolutionValue *= direction;
    10311041            if (newNumberInfeas&&newNumberInfeas<-20) {
    1032 #if 0
     1042#if 1
    10331043              roundingObjective=solutionValue;
    10341044              OsiSolverInterface * saveSolver = model_->swapSolver(solver);
     1045              double * currentObjective =
     1046                CoinCopyOfArray(solver->getObjCoefficients(),numberColumns);
     1047              solver->setObjective(saveObjective);
    10351048              int ifSol = roundingHeuristic.solution(roundingObjective,roundingSolution);
     1049              solver->setObjective(currentObjective);
     1050              delete [] currentObjective;
    10361051              model_->swapSolver(saveSolver);
    10371052              if (ifSol>0)
     
    11491164          if (false) {
    11501165            OsiSolverInterface * saveSolver = model_->swapSolver(solver);
     1166            double * currentObjective =
     1167              CoinCopyOfArray(solver->getObjCoefficients(),numberColumns);
     1168            solver->setObjective(saveObjective);
     1169            double saveOffset2;
     1170            solver->getDblParam(OsiObjOffset,saveOffset2);
     1171            //assert (saveOffset==saveOffset2);
     1172            solver->setDblParam(OsiObjOffset,saveOffset);
    11511173            CbcRounding heuristic1(*model_);
    11521174            heuristic1.setHeuristicName("rounding in feaspump!");
    11531175            heuristic1.setWhen(1);
    1154             roundingObjective = newTrueSolutionValue;
    1155             double testObjectiveValue = CoinMin(solutionValue,roundingObjective);
    1156             int returnCode = heuristic1.solution(testObjectiveValue,roundingSolution,newTrueSolutionValue) ;
     1176            roundingObjective = CoinMin(roundingObjective,solutionValue);
     1177            double testSolutionValue=newTrueSolutionValue;
     1178            int returnCode = heuristic1.solution(roundingObjective,
     1179                                                 roundingSolution,
     1180                                                 testSolutionValue) ;
     1181            solver->setObjective(currentObjective);
     1182            solver->setDblParam(OsiObjOffset,saveOffset2);
     1183            delete [] currentObjective;
    11571184            if (returnCode==1) {
    1158               assert(testObjectiveValue < CoinMin(solutionValue,roundingObjective));
    1159               roundingObjective = testObjectiveValue;
     1185              printf("rounding obj of %g?\n",roundingObjective);
     1186              //roundingObjective = newSolutionValue;
    11601187            } else {
    1161               roundingObjective = COIN_DBL_MAX;
     1188              //  roundingObjective = COIN_DBL_MAX;
    11621189            }
    11631190            model_->swapSolver(saveSolver);
     
    13201347        <<CoinMessageEol;
    13211348      solutionValue=roundingObjective;
     1349      newSolutionValue = solutionValue;
    13221350      memcpy(betterSolution,roundingSolution,numberColumns*sizeof(double));
    13231351      solutionFound=true;
     1352      if (exitNow(roundingObjective))
     1353        exitAll=true;
    13241354    }
    13251355    if (!solutionFound) {
     
    15831613          solutionValue=newSolutionValue;
    15841614          solutionFound=true;
     1615          if (exitNow(newSolutionValue))
     1616            exitAll=true;
    15851617          CoinWarmStartBasis * basis =
    15861618            dynamic_cast<CoinWarmStartBasis *>(newSolver->getWarmStart()) ;
     
    16821714      solutionValue=newSolutionValue;
    16831715      solutionFound=true;
     1716      if (exitNow(newSolutionValue))
     1717        exitAll=true;
    16841718    }
    16851719    delete newSolver;
     
    17151749    printf("XXX total iterations %d ratios - %g %g %g\n",
    17161750           totalNumberIterations,
    1717            ((double) totalNumberIterations)/nrow,
    1718            ((double) totalNumberIterations)/ncol,
    1719            ((double) totalNumberIterations)/(2*nrow+2*ncol));
     1751           static_cast<double> (totalNumberIterations)/nrow,
     1752           static_cast<double> (totalNumberIterations)/ncol,
     1753           static_cast<double> (totalNumberIterations)/(2*nrow+2*ncol));
    17201754  }
    17211755#endif
     
    17511785  int flip_down  = 0;
    17521786  double  v = randomNumberGenerator_.randomDouble() * 20.0;
    1753   int nn = 10 + (int) v;
     1787  int nn = 10 + static_cast<int> (v);
    17541788  int nnv = 0;
    17551789  int * list = new int [nn];
  • trunk/Cbc/src/CbcHeuristicFPump.hpp

    r1105 r1121  
    181181       2 - reuse solves, do not accumulate integer solutions for local search
    182182       3 - reuse solves, accumulate integer solutions for local search
    183        If we add 4 then use second form of problem (with extra rows and variables)
     183       If we add 4 then use second form of problem (with extra rows and variables for general integers)
     184       If we do not accumulate solutions then no mini branch and bounds will be done
     185       reuse - refers to initial solve after adding in new "cut"
    184186  */
    185187  int accumulate_;
  • trunk/Cbc/src/CbcHeuristicRINS.cpp

    r1100 r1121  
    226226      numberTries_++;
    227227      if ((numberTries_%10)==0&&numberSuccesses_*3<numberTries_)
    228         howOften_ += (int) (howOften_*decayFactor_);
     228        howOften_ += static_cast<int> (howOften_*decayFactor_);
    229229    }
    230230
     
    542542      double value=bestSolution[iColumn];
    543543      double nearest=floor(value+0.5);
    544       values_[0][i]=(int) nearest;
     544      values_[0][i]=static_cast<int> (nearest);
    545545    }
    546546    numberKeptSolutions_ = CoinMin(numberKeptSolutions_+1,maximumKeepSolutions_);
     
    591591          valueInt=originalUpper;
    592592        }
    593         int intValue = (int) floor(valueInt+0.5);
     593        int intValue = static_cast<int> (floor(valueInt+0.5));
    594594        double currentValue = currentSolution[iColumn];
    595595        double currentLower = colLower[iColumn];
     
    738738    numberTries_++;
    739739    if ((numberTries_%10)==0&&numberSuccesses_*3<numberTries_)
    740       howOften_ += (int) (howOften_*decayFactor_);
     740      howOften_ += static_cast<int> (howOften_*decayFactor_);
    741741  }
    742742  return finalReturnCode;
  • trunk/Cbc/src/CbcHeuristicRandRound.cpp

    r1101 r1121  
    2121static inline int intRand(const int range)
    2222{
    23   return (int) floor(CoinDrand48() * range);
     23  return static_cast<int> (floor(CoinDrand48() * range));
    2424}
    2525
  • trunk/Cbc/src/CbcLinked.cpp

    r1103 r1121  
    34523452    bool onOptimalPath=true;
    34533453    for (i=0;i<7;i++) {
    3454       if ((int) upper[i]!=fake[i])
     3454      if (static_cast<int> (upper[i])!=fake[i])
    34553455        onOptimalPath=false;
    34563456    }
     
    41464146    weight /= sum;
    41474147    valueInfeasibility = lastNonZero-firstNonZero+1;
    4148     valueInfeasibility *= 0.5/((double) numberMembers_);
     4148    valueInfeasibility *= 0.5/static_cast<double> (numberMembers_);
    41494149    //#define DISTANCE
    41504150#ifdef DISTANCE
     
    67206720  }
    67216721  // See how many points
    6722   numberPoints_ = (int) ((xB[1]-xB[0]+0.5*xMesh)/xMesh);
     6722  numberPoints_ = static_cast<int> ((xB[1]-xB[0]+0.5*xMesh)/xMesh);
    67236723  // redo exactly
    6724   xMeshSize_ = (xB[1]-xB[0])/((double) numberPoints_);
     6724  xMeshSize_ = (xB[1]-xB[0])/static_cast<double> (numberPoints_);
    67256725  numberPoints_++;
    67266726  //#define KEEPXY
     
    69366936    // new step size
    69376937    assert (numberPoints_>2);
    6938     step = CoinMax((1.5*step)/((double) (numberPoints_-1)),0.5*step);
     6938    step = CoinMax((1.5*step)/static_cast<double> (numberPoints_-1),0.5*step);
    69396939    xB[0] = CoinMax(xB[0],xValue-0.5*step);
    69406940    xB[1] = CoinMin(xB[1],xValue+0.5*step);
    69416941    // and now divide these
    6942     mesh = (xB[1]-xB[0])/((double) (numberPoints_-1));
     6942    mesh = (xB[1]-xB[0])/static_cast<double> (numberPoints_-1);
    69436943  } else {
    69446944    // back to original
     
    74877487    assert (fabs(floor(gap+0.5)-gap)<1.0e-5);
    74887488    whichColumn[numJ]=iColumn;
    7489     bound[numJ]=(int) gap;
     7489    bound[numJ]=static_cast<int> (gap);
    74907490    size[numJ++]=triple.value();
    74917491    offset += triple.value()*lowerColumn;
  • trunk/Cbc/src/CbcModel.cpp

    r1120 r1121  
    8484#include "CbcCompareActual.hpp"
    8585#include "CbcTree.hpp"
    86 //#define CBC_DETERMINISTIC_THREAD
    8786#ifdef CBC_THREAD
    88 #ifdef CBC_DETERMINISTIC_THREAD
    89 //#define DELETE_OUTSIDE
    90 #else
    91 #define CBC_NORMAL_THREAD
    92 #endif
    9387#include <pthread.h>
    9488#ifdef HAVE_CLOCK_GETTIME
     
    157151  int threadNumber;
    158152#endif
    159 #ifdef CBC_DETERMINISTIC_THREAD
     153  int nDeleteNode;
    160154  CbcNode ** delNode;
    161155  int maxDeleteNode;
    162   int nDeleteNode;
    163156  int nodesThisTime;
    164157  int iterationsThisTime;
    165 #endif
    166158} threadStruct;
    167159static void * doNodesThread(void * voidInfo);
     
    494486            else if (cost!=objValue)
    495487              cost=-COIN_DBL_MAX;
    496             int gap = (int) (upper[iColumn]-lower[iColumn]);
     488            int gap = static_cast<int> (upper[iColumn]-lower[iColumn]);
    497489            if (gap>1) {
    498490              numberGeneralIntegerObj++;
     
    987979          double value = objValue*multiplier ;
    988980          if (value <2.1e9) {
    989             int nearest = (int) floor(value+0.5) ;
     981            int nearest = static_cast<int> (floor(value+0.5)) ;
    990982            if (fabs(value-floor(value+0.5)) > 1.0e-8)
    991983              { increment = 0 ;
     
    10161008        if (bigIntegers) {
    10171009          // allow for 1.0
    1018           increment = gcd(increment,(int) multiplier);
     1010          increment = gcd(increment,static_cast<int> (multiplier));
    10191011          value = increment;
    10201012        }
     
    10801072  CoinThreadRandom randomGenerator(1234567);
    10811073  // See if should do cuts old way
    1082 #ifdef CBC_DETERMINISTIC_THREAD
    1083   if (numberThreads_>0||dynamic_cast<CbcTreeLocal *> (tree_))
     1074  if (parallelMode()<0) {
    10841075    specialOptions_ |= 4096+8192;
    1085 #else
    1086   if (numberThreads_>0)
     1076  } else if (parallelMode()>0) {
    10871077    specialOptions_ |= 4096;
     1078  }
    10881079  if (dynamic_cast<CbcTreeLocal *> (tree_))
    10891080    specialOptions_ |= 4096+8192;
    1090 #endif
    10911081#ifdef COIN_HAS_CLP
    10921082 {
     
    18771867    // fake number of objects
    18781868    numberObjects_--;
    1879 #ifdef CBC_DETERMINISTIC_THREAD
    1880     // But make sure position is correct
    1881     OsiObject * obj2 = object_[numberObjects_];
    1882     obj = dynamic_cast<CbcObject *> (obj2);
    1883     assert (obj);
    1884     obj->setPosition(numberObjects_);
    1885 #endif
     1869    if (parallelMode()<-1) {
     1870      // But make sure position is correct
     1871      OsiObject * obj2 = object_[numberObjects_];
     1872      obj = dynamic_cast<CbcObject *> (obj2);
     1873      assert (obj);
     1874      obj->setPosition(numberObjects_);
     1875    }
    18861876  }
    18871877#ifdef COIN_HAS_CLP
     
    22742264        // zap parent nodeInfo
    22752265#ifdef COIN_DEVELOP
    2276         printf("zapping CbcNodeInfo %x\n",newNode->nodeInfo()->parent());
     2266        printf("zapping CbcNodeInfo %x\n",reinterpret_cast<int>(newNode->nodeInfo()->parent()));
    22772267#endif
    22782268        if (newNode->nodeInfo())
     
    24052395  pthread_cond_t * condition2 = NULL;
    24062396  threadStruct * threadInfo = NULL;
    2407 #ifdef CBC_NORMAL_THREAD
    24082397  bool locked=false;
    2409 #endif
    24102398  int threadStats[6];
    2411 #ifdef CBC_DETERMINISTIC_THREAD
    24122399  int defaultParallelIterations=500;
    24132400  int defaultParallelNodes=10;
    2414 #endif
    24152401  memset(threadStats,0,sizeof(threadStats));
    24162402  double timeWaiting=0.0;
     
    24282414    mutex2 = new pthread_mutex_t [numberThreads_];
    24292415    condition2 = new pthread_cond_t [numberThreads_];
    2430 #ifdef CBC_DETERMINISTIC_THREAD
    2431     // May need for deterministic
    2432     saveObjects=new OsiObject * [numberObjects_];
    2433     for (int i=0;i<numberObjects_;i++) {
    2434       saveObjects[i] = object_[i]->clone();
    2435     }
    2436 #endif
     2416    if (parallelMode()<-1) {
     2417      // May need for deterministic
     2418      saveObjects=new OsiObject * [numberObjects_];
     2419      for (int i=0;i<numberObjects_;i++) {
     2420        saveObjects[i] = object_[i]->clone();
     2421      }
     2422    }
    24372423    // we don't want a strategy object
    24382424    CbcStrategy * saveStrategy = strategy_;
     
    24442430      threadInfo[i].baseModel=this;
    24452431      threadModel[i]=new CbcModel(*this,true);
     2432      threadModel[i]->synchronizeHandlers(1);
    24462433#ifdef COIN_HAS_CLP
    24472434      // Solver may need to know about model
     
    24522439        solver->setCbcModel(thisModel);
    24532440#endif
    2454       mutex_ = (void *) (threadInfo+i);
     2441      mutex_ = reinterpret_cast<void *> (threadInfo+i);
    24552442      threadModel[i]->moveToModel(this,-1);
    24562443      threadInfo[i].thisModel=threadModel[i];
     
    24742461      threadInfo[i].threadNumber=i+2;
    24752462#endif
    2476 #ifdef CBC_DETERMINISTIC_THREAD
    24772463      threadInfo[i].delNode = NULL;
    24782464      threadInfo[i].maxDeleteNode=0;
     
    24802466      threadInfo[i].nodesThisTime=0;
    24812467      threadInfo[i].iterationsThisTime=0;
    2482 #endif
    24832468      pthread_create(&(threadId[i].thr),NULL,doNodesThread,threadInfo+i);
    24842469      threadId[i].status = 1;
     
    24882473    threadInfo[numberThreads_].baseModel=this;
    24892474    threadModel[numberThreads_]=this;
    2490     mutex_ = (void *) (threadInfo+numberThreads_);
     2475    mutex_ = reinterpret_cast<void *> (threadInfo+numberThreads_);
    24912476    threadInfo[numberThreads_].node=NULL;
    24922477    threadInfo[numberThreads_].mutex=&mutex;
     
    25432528    }
    25442529  }
    2545 #ifdef CBC_DETERMINISTIC_THREAD
     2530#ifdef CBC_THREAD
     2531  bool goneParallel=false;
     2532#endif
    25462533#define MAX_DEL_NODE 1
    25472534  CbcNode * delNode[MAX_DEL_NODE+1];
    25482535  int nDeleteNode=0;
    2549   bool goneParallel=false;
    2550 #endif
    25512536  // For Printing etc when parallel
    25522537  int lastEvery1000=0;
    25532538  int lastPrintEvery=0;
    25542539  while (true) {
    2555 #ifdef CBC_NORMAL_THREAD
    2556     if (!locked) {
     2540    if (parallelMode()>0&&!locked) {
    25572541      lockThread();
    25582542      locked=true;
    25592543    }
    2560 #endif
    25612544#ifdef COIN_HAS_CLP
    25622545    // Possible change of pivot method
     
    25892572#endif
    25902573    if (tree_->empty()) {
    2591 #ifdef CBC_NORMAL_THREAD
    2592       if (numberThreads_) {
     2574      if (parallelMode()>0) {
    25932575#ifdef COIN_DEVELOP
    25942576        printf("empty\n");
     
    26062588          printf("waiting for thread %d code 0\n",iThread);
    26072589#endif
    2608 #ifndef CBC_DETERMINISTIC_THREAD
    2609           unlockThread();
    2610 #endif
    2611           locked = false;
     2590          if (parallelMode()>0) {
     2591            unlockThread();
     2592            locked = false;
     2593          }
    26122594          pthread_cond_signal(threadInfo[iThread].condition2); // unlock in case
    26132595          while (true) {
     
    26622644          }
    26632645          if (iThread<numberThreads_) {
    2664 #ifndef CBC_DETERMINISTIC_THREAD
    2665             unlockThread();
    2666 #endif
    2667             locked = false;
     2646            if (parallelMode()>0) {
     2647              unlockThread();
     2648              locked = false;
     2649            }
    26682650            threadModel[iThread]->moveToModel(this,1);
    26692651            assert (threadInfo[iThread].returnCode==1);
     
    26942676        printf("finished ************\n");
    26952677#endif
    2696       }
    2697 #ifndef CBC_DETERMINISTIC_THREAD
     2678        unlockThread();
     2679        locked=false; // not needed as break
     2680      }
     2681      break;
     2682    }
     2683    if (parallelMode()>0) {
    26982684      unlockThread();
    2699 #endif
    2700       locked=false; // not needed as break
    2701 #endif
    2702       break;
    2703     }
    2704 #ifdef CBC_NORMAL_THREAD
    2705     unlockThread();
    2706     locked = false;
    2707 #endif
     2685      locked = false;
     2686    }
    27082687    // If done 100 nodes see if worth trying reduction
    27092688    if (numberNodes_==100&&saveSolver) {
     
    27732752        // back to solver without cuts?
    27742753#if 0
    2775         OsiSolverInterface * solver2 = continuousSolver_->clone();
     2754        int numberCuts = solver_->getNumRows()-continuousSolver_->getNumRows();
     2755        OsiSolverInterface * solver2;
     2756        if (numberCuts>50&&numberCuts*10>solver_->getNumRows())
     2757          solver2 = continuousSolver_->clone();
     2758        else
     2759          solver2 = saveSolver->clone();
    27762760#else
    27772761        OsiSolverInterface * solver2 = saveSolver->clone();
     
    28802864        }
    28812865      }
    2882 #ifndef CBC_DETERMINISTIC_THREAD
    2883       lockThread();
    2884 #endif
     2866      if (parallelMode()>0)
     2867        lockThread();
    28852868      // Do from deepest
    28862869      tree_->cleanTree(this, newCutoff,bestPossibleObjective_) ;
     
    28902873      tree_->setComparison(*nodeCompare_) ;
    28912874      if (tree_->empty()) {
    2892 #ifndef CBC_DETERMINISTIC_THREAD
    2893         unlockThread();
    2894 #endif
     2875        if (parallelMode()>0)
     2876          unlockThread();
    28952877        // For threads we need to check further
    28962878        //break; // finished
    28972879        continue;
    28982880      }
    2899 #ifndef CBC_DETERMINISTIC_THREAD
    2900       unlockThread();
    2901 #endif
     2881      if (parallelMode()>0)
     2882        unlockThread();
    29022883    }
    29032884    cutoff = getCutoff() ;
     
    29092890*/
    29102891    if (numberNodes_>=lastEvery1000) {
    2911 #ifndef CBC_DETERMINISTIC_THREAD
    2912       lockThread();
    2913 #endif
     2892      if (parallelMode()>0)
     2893        lockThread();
    29142894#ifdef COIN_HAS_CLP
    29152895      // Possible change of pivot method
     
    29732953      }
    29742954#endif
    2975 #ifndef CBC_DETERMINISTIC_THREAD
    2976       unlockThread();
    2977 #endif
     2955      if (parallelMode()>0)
     2956        unlockThread();
    29782957    }
    29792958    if (saveCompare&&!hotstartSolution_) {
     
    29832962      saveCompare=NULL;
    29842963      // redo tree
    2985 #ifndef CBC_DETERMINISTIC_THREAD
    2986       lockThread();
    2987 #endif
     2964      if (parallelMode()>0)
     2965        lockThread();
    29882966      tree_->setComparison(*nodeCompare_) ;
    2989 #ifndef CBC_DETERMINISTIC_THREAD
    2990       unlockThread();
    2991 #endif
     2967      if (parallelMode()>0)
     2968        unlockThread();
    29922969    }
    29932970    if (numberNodes_>=lastPrintEvery) {
     
    30052982      }
    30062983#endif
    3007 #ifndef CBC_DETERMINISTIC_THREAD
    3008       lockThread();
    3009 #endif
     2984      if (parallelMode()>0)
     2985        lockThread();
    30102986      int nNodes = tree_->size() ;
    30112987
    30122988      //MODIF PIERRE
    30132989      bestPossibleObjective_ = tree_->getBestPossibleObjective();
    3014 #ifndef CBC_DETERMINISTIC_THREAD
    3015       unlockThread();
    3016 #endif
     2990      if (parallelMode()>0)
     2991        unlockThread();
    30172992      if (!intParam_[CbcPrinting]) {
    30182993        messageHandler()->message(CBC_STATUS,messages())
     
    30633038  active subproblem.
    30643039*/
    3065 #ifdef BACK_TO_OLD_WAY //old way without threads #ifndef CBC_THREAD
    3066     CbcNode *node = tree_->bestNode(cutoff) ;
    3067     // Possible one on tree worse than cutoff
    3068     if (!node||node->objectiveValue()>cutoff)
    3069       continue;
    3070     int currentNumberCuts = 0 ;
    3071     currentNode_=node; // so can be accessed elsewhere
    3072 #ifdef CBC_DEBUG
    3073     printf("%d unsat, way %d, obj %g est %g\n",
    3074            node->numberUnsatisfied(),node->way(),node->objectiveValue(),
    3075            node->guessedObjectiveValue());
    3076 #endif
    3077 #if NEW_UPDATE_OBJECT==0
    3078     // Save clone in branching decision
    3079     if(branchingMethod_)
    3080       branchingMethod_->saveBranchingObject(node->modifiableBranchingObject());
    3081 #endif
    3082     // Say not on optimal path
    3083     bool onOptimalPath=false;
    3084 #   ifdef CHECK_NODE
    3085     printf("Node %x popped from tree - %d left, %d count\n",node,
    3086            node->nodeInfo()->numberBranchesLeft(),
    3087            node->nodeInfo()->numberPointingToThis()) ;
    3088     printf("\tdepth = %d, z =  %g, unsat = %d, var = %d.\n",
    3089            node->depth(),node->objectiveValue(),
    3090            node->numberUnsatisfied(),
    3091            node->columnNumber()) ;
    3092 #   endif
    3093     lastDepth=node->depth();
    3094     lastUnsatisfied=node->numberUnsatisfied();
    3095 
    3096 /*
    3097   Rebuild the subproblem for this node:  Call addCuts() to adjust the model
    3098   to recreate the subproblem for this node (set proper variable bounds, add
    3099   cuts, create a basis).  This may result in the problem being fathomed by
    3100   bound or infeasibility. Returns 1 if node is fathomed.
    3101   Execute the current arm of the branch: If the problem survives, save the
    3102   resulting variable bounds and call branch() to modify variable bounds
    3103   according to the current arm of the branching object. If we're processing
    3104   the final arm of the branching object, flag the node for removal from the
    3105   live set.
    3106 */
    3107     CbcNodeInfo * nodeInfo = node->nodeInfo() ;
    3108     newNode = NULL ;
    3109     int branchesLeft=0;
    3110     if (!addCuts(node,lastws,numberFixedNow_>numberFixedAtRoot_))
    3111     { int i ;
    3112       const double * lower = getColLower() ;
    3113       const double * upper = getColUpper() ;
    3114       for (i = 0 ; i < numberColumns ; i++)
    3115       { lowerBefore[i]= lower[i] ;
    3116         upperBefore[i]= upper[i] ; }
    3117       if ((solverCharacteristics_->extraCharacteristics()&2)!=0) {
    3118         solverCharacteristics_->setBeforeLower(lowerBefore);
    3119         solverCharacteristics_->setBeforeUpper(upperBefore);
    3120       }
    3121       if (messageHandler()->logLevel()>2)
    3122         node->modifiableBranchingObject()->print();
    3123       if (!useOsiBranching)
    3124         branchesLeft = node->branch(NULL); // old way
    3125       else
    3126         branchesLeft = node->branch(solver_); // new way
    3127       if (branchesLeft) {
    3128         // set nodenumber correctly
    3129         node->nodeInfo()->setNodeNumber(numberNodes2_);
    3130         tree_->push(node) ;
    3131         if (statistics_) {
    3132           if (numberNodes2_==maximumStatistics_) {
    3133             maximumStatistics_ = 2*maximumStatistics_;
    3134             CbcStatistics ** temp = new CbcStatistics * [maximumStatistics_];
    3135             memset(temp,0,maximumStatistics_*sizeof(CbcStatistics *));
    3136             memcpy(temp,statistics_,numberNodes2_*sizeof(CbcStatistics *));
    3137             delete [] statistics_;
    3138             statistics_=temp;
    3139           }
    3140           assert (!statistics_[numberNodes2_]);
    3141           statistics_[numberNodes2_]=new CbcStatistics(node,this);
    3142         }
    3143         numberNodes2_++;
    3144         //nodeOnTree=true; // back on tree
    3145         //deleteNode = false ;
    3146 #       ifdef CHECK_NODE
    3147         printf("Node %x pushed back on tree - %d left, %d count\n",node,
    3148                nodeInfo->numberBranchesLeft(),
    3149                nodeInfo->numberPointingToThis()) ;
    3150 #       endif
    3151       } else {
    3152         //deleteNode = true ;
    3153         if (!nodeInfo->numberBranchesLeft())
    3154           nodeInfo->allBranchesGone(); // can clean up
    3155       }
    3156       if ((specialOptions_&1)!=0) {
    3157         /*
    3158           This doesn't work as intended --- getRowCutDebugger will return null
    3159           unless the current feasible solution region includes the optimal solution
    3160           that RowCutDebugger knows. There's no way to tell inactive from off the
    3161           optimal path.
    3162         */
    3163         const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ;
    3164         if (debugger) {
    3165           onOptimalPath=true;
    3166           printf("On optimal path\n") ;
    3167         }
    3168       }
    3169      
    3170 /*
    3171   Reoptimize, possibly generating cuts and/or using heuristics to find
    3172   solutions.  Cut reference counts are unaffected unless we lose feasibility,
    3173   in which case solveWithCuts() will make the adjustment.
    3174 */
    3175       phase_=2;
    3176       cuts = OsiCuts() ;
    3177       currentNumberCuts = solver_->getNumRows()-numberRowsAtContinuous_ ;
    3178       int saveNumber = numberIterations_;
    3179       if(solverCharacteristics_->solutionAddsCuts()) {
    3180         int returnCode=resolve(node ? node->nodeInfo() : NULL,1);
    3181         feasible = returnCode != 0;
    3182         if (feasible) {
    3183           int iObject ;
    3184           int preferredWay ;
    3185           int numberUnsatisfied = 0 ;
    3186           memcpy(currentSolution_,solver_->getColSolution(),
    3187                  numberColumns*sizeof(double)) ;
    3188           // point to useful information
    3189           OsiBranchingInformation usefulInfo=usefulInformation();
    3190          
    3191           for (iObject = 0 ; iObject < numberObjects_ ; iObject++) {
    3192             double infeasibility =
    3193               object_[iObject]->infeasibility(&usefulInfo,preferredWay) ;
    3194             if (infeasibility ) numberUnsatisfied++ ;
    3195           }
    3196           if (returnCode>0) {
    3197             if (numberUnsatisfied)   {
    3198               feasible = solveWithCuts(cuts,maximumCutPasses_,node);
    3199             } else {
    3200               // may generate cuts and turn the solution
    3201               //to an infeasible one
    3202               feasible = solveWithCuts(cuts, 1,
    3203                                        node);
    3204 #if 0
    3205               currentNumberCuts_ = cuts.sizeRowCuts();
    3206               if (currentNumberCuts_ >= maximumNumberCuts_) {
    3207                 maximumNumberCuts_ = currentNumberCuts;
    3208                 delete [] addedCuts_;
    3209                 addedCuts_ = new CbcCountRowCut * [maximumNumberCuts_];
    3210               }
    3211 #endif
    3212             }
    3213           }
    3214           // check extra info on feasibility
    3215           if (!solverCharacteristics_->mipFeasible()) {
    3216             feasible = false;
    3217             solverCharacteristics_->setMipBound(-COIN_DBL_MAX);
    3218           }
    3219         }
    3220       } else {
    3221         // normal
    3222         //int zzzzzz=0;
    3223         //if (zzzzzz)
    3224         //solver_->writeMps("before");
    3225         feasible = solveWithCuts(cuts,maximumCutPasses_,node);
    3226       }
    3227       if ((specialOptions_&1)!=0&&onOptimalPath) {
    3228         if (!solver_->getRowCutDebugger()) {
    3229           if (solver_->getRowCutDebuggerAlways()->optimalValue()<
    3230               getCutoff()-1.0e-5) {
    3231             // dj fix did something???
    3232             solver_->writeMpsNative("infeas2.mps",NULL,NULL,2);
    3233             solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_);
    3234             assert (solver_->getRowCutDebugger()) ;
    3235           }
    3236         }
    3237       }
    3238       if (statistics_) {
    3239         assert (numberNodes2_);
    3240         assert (statistics_[numberNodes2_-1]);
    3241         assert (statistics_[numberNodes2_-1]->node()==numberNodes2_-1);
    3242         statistics_[numberNodes2_-1]->endOfBranch(numberIterations_-saveNumber,
    3243                                                feasible ? solver_->getObjValue()
    3244                                                : COIN_DBL_MAX);
    3245       }
    3246 /*
    3247   Are we still feasible? If so, create a node and do the work to attach a
    3248   branching object, reoptimising as needed if chooseBranch() identifies
    3249   monotone objects.
    3250 
    3251   Finally, attach a partial nodeInfo object and store away any cuts that we
    3252   created back in solveWithCuts. addCuts() will initialise the reference
    3253   counts for these new cuts.
    3254 
    3255   This next test can be problematic if we've discovered an
    3256   alternate equivalent answer and subsequently fathom the solution
    3257   known to the row cut debugger due to bounds.
    3258 */
    3259         if (onOptimalPath) {
    3260           bool objLim = solver_->isDualObjectiveLimitReached() ;
    3261           if (!feasible && !objLim) {
    3262             printf("infeas2\n");
    3263             solver_->writeMpsNative("infeas.mps",NULL,NULL,2);
    3264             solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_);
    3265             CoinWarmStartBasis *slack =
    3266               dynamic_cast<CoinWarmStartBasis *>(solver_->getEmptyWarmStart()) ;
    3267             solver_->setWarmStart(slack);
    3268             delete slack ;
    3269             solver_->setHintParam(OsiDoReducePrint,false,OsiHintDo,0) ;
    3270             solver_->initialSolve();
    3271             assert (!solver_->isProvenOptimal());
    3272           }
    3273           assert (feasible || objLim);
    3274         }
    3275         bool checkingNode=false;
    3276         if (feasible) {
    3277           newNode = new CbcNode ;//Regular node of the tree
    3278           // Set objective value (not so obvious if NLP etc)
    3279           setObjectiveValue(newNode,node);
    3280           anyAction =-1 ;
    3281           resolved = false ;
    3282           if (newNode->objectiveValue() >= getCutoff())
    3283             anyAction=-2;
    3284           // only allow at most a few passes
    3285           int numberPassesLeft=5;
    3286           checkingNode=true;
    3287         OsiSolverBranch * branches=NULL;
    3288         // point to useful information
    3289         anyAction = chooseBranch(newNode, numberPassesLeft,node, cuts,resolved,
    3290                                  lastws, lowerBefore, upperBefore, branches);
    3291 /*
    3292   If we end up infeasible, we can delete the new node immediately. Since this
    3293   node won't be needing the cuts we collected, decrement the reference counts.
    3294   If we are feasible, then we'll be placing this node into the live set, so
    3295   increment the reference count in the current (parent) nodeInfo.
    3296 */
    3297         if (anyAction == -2)
    3298           { delete newNode ;
    3299           newNode = NULL ;
    3300           // say strong doing well
    3301           if (checkingNode)
    3302             setSpecialOptions(specialOptions_|8);
    3303           for (i = 0 ; i < currentNumberCuts_ ; i++)
    3304             { if (addedCuts_[i])
    3305               { if (!addedCuts_[i]->decrement(1))
    3306                 delete addedCuts_[i] ; } } }
    3307         else
    3308           { nodeInfo->increment() ;
    3309           if ((numberNodes_%20)==0) {
    3310             // say strong not doing as well
    3311             setSpecialOptions(specialOptions_&~8);
    3312           }
    3313         }
    3314         }
    3315 /*
    3316   At this point, there are three possibilities:
    3317     * newNode is live and will require further branching to resolve
    3318       (variable() >= 0). Increment the cut reference counts by
    3319       numberBranches() to allow for use by children of this node, and
    3320       decrement by 1 because we've executed one arm of the branch of our
    3321       parent (consuming one reference). Before we push newNode onto the
    3322       search tree, try for a heuristic solution.
    3323     * We have a solution, in which case newNode is non-null but we have no
    3324       branching variable. Decrement the cut counts and save the solution.
    3325     * The node was found to be infeasible, in which case it's already been
    3326       deleted, and newNode is null.
    3327 */
    3328         if (!eventHandler->event(CbcEventHandler::node)) {
    3329           eventHappened_=true; // exit
    3330         }
    3331         assert (!newNode || newNode->objectiveValue() <= getCutoff()) ;
    3332         if (statistics_) {
    3333           assert (numberNodes2_);
    3334           assert (statistics_[numberNodes2_-1]);
    3335           assert (statistics_[numberNodes2_-1]->node()==numberNodes2_-1);
    3336           if (newNode)
    3337             statistics_[numberNodes2_-1]->updateInfeasibility(newNode->numberUnsatisfied());
    3338           else
    3339             statistics_[numberNodes2_-1]->sayInfeasible();
    3340         }
    3341         if (newNode) {
    3342           if (newNode->branchingObject() == NULL&&solverCharacteristics_->solverType()==4) {
    3343             // need to check if any cuts would do anything
    3344             OsiCuts theseCuts;
    3345             // reset probing info
    3346             //if (probingInfo_)
    3347             //probingInfo_->initializeFixing();
    3348             for (int i = 0;i<numberCutGenerators_;i++) {
    3349               bool generate = generator_[i]->normal();
    3350               // skip if not optimal and should be (maybe a cut generator has fixed variables)
    3351               if (generator_[i]->needsOptimalBasis()&&!solver_->basisIsAvailable())
    3352                 generate=false;
    3353               if (!generator_[i]->mustCallAgain())
    3354                 generate=false; // only special cuts
    3355               if (generate) {
    3356                 generator_[i]->generateCuts(theseCuts,1,solver_,NULL) ;
    3357                 int numberRowCutsAfter = theseCuts.sizeRowCuts() ;
    3358                 if (numberRowCutsAfter) {
    3359                   // need dummy branch
    3360                   newNode->setBranchingObject(new CbcDummyBranchingObject(this));
    3361                   newNode->nodeInfo()->initializeInfo(1);
    3362                   break;
    3363                 }
    3364               }
    3365             }
    3366           }
    3367           if (newNode->branchingObject())
    3368           { handler_->message(CBC_BRANCH,messages_)
    3369                << numberNodes_<< newNode->objectiveValue()
    3370                << newNode->numberUnsatisfied()<< newNode->depth()
    3371                << CoinMessageEol ;
    3372             // Increment cut counts (taking off current)
    3373             int numberLeft = newNode->numberBranches() ;
    3374             for (i = 0;i < currentNumberCuts_;i++)
    3375             { if (addedCuts_[i])
    3376               {
    3377 #               ifdef CHECK_CUT_COUNTS
    3378                 printf("Count on cut %x increased by %d\n",addedCuts_[i],
    3379                         numberLeft-1) ;
    3380 #               endif
    3381                 addedCuts_[i]->increment(numberLeft-1) ; } }
    3382 
    3383             double estValue = newNode->guessedObjectiveValue() ;
    3384             int found = -1 ;
    3385             // no - overhead on small problems solver_->resolve() ;     // double check current optimal
    3386             // assert (!solver_->getIterationCount());
    3387             double * newSolution = new double [numberColumns] ;
    3388             double heurValue = getCutoff() ;
    3389             int iHeur ;
    3390             for (iHeur = 0 ; iHeur < numberHeuristics_ ; iHeur++) {
    3391 #if MODEL3
    3392               // skip if can't run here
    3393               if (!heuristic_[iHeur]->shouldHeurRun())
    3394                 continue;
    3395 #endif
    3396               double saveValue = heurValue ;
    3397               int ifSol = heuristic_[iHeur]->solution(heurValue,newSolution) ;
    3398               if (ifSol > 0) {
    3399                 // new solution found
    3400                 heuristic_[iHeur]->incrementNumberSolutionsFound();
    3401                 found = iHeur ;
    3402                 incrementUsed(newSolution);
    3403                 lastHeuristic_ = heuristic_[found];
    3404                 setBestSolution(CBC_ROUNDING,heurValue,newSolution) ;
    3405               } else if (ifSol < 0) {
    3406                 // just returning an estimate
    3407                 estValue = CoinMin(heurValue,estValue) ;
    3408                 heurValue = saveValue ;
    3409               }
    3410             }
    3411             delete [] newSolution ;
    3412             newNode->setGuessedObjectiveValue(estValue) ;
    3413             tree_->push(newNode) ;
    3414             if (statistics_) {
    3415               if (numberNodes2_==maximumStatistics_) {
    3416                 maximumStatistics_ = 2*maximumStatistics_;
    3417                 CbcStatistics ** temp = new CbcStatistics * [maximumStatistics_];
    3418                 memset(temp,0,maximumStatistics_*sizeof(CbcStatistics *));
    3419                 memcpy(temp,statistics_,numberNodes2_*sizeof(CbcStatistics *));
    3420                 delete [] statistics_;
    3421                 statistics_=temp;
    3422               }
    3423               assert (!statistics_[numberNodes2_]);
    3424               statistics_[numberNodes2_]=new CbcStatistics(newNode,this);
    3425             }
    3426             numberNodes2_++;
    3427 #           ifdef CHECK_NODE
    3428             printf("Node %x pushed on tree c\n",newNode) ;
    3429 #           endif
    3430           }
    3431           else
    3432           {
    3433             if(solverCharacteristics_ && //we may be in a non standard bab
    3434                solverCharacteristics_->solutionAddsCuts()// we are in some kind of OA based bab.
    3435                )
    3436               {
    3437                 std::cerr<<"You should never get here"<<std::endl;
    3438                 throw CoinError("Nodes should not be fathomed on integer infeasibility in this setting",
    3439                                 "branchAndBound","CbcModel") ;
    3440               }
    3441             for (i = 0 ; i < currentNumberCuts_ ; i++)
    3442             { if (addedCuts_[i])
    3443               { if (!addedCuts_[i]->decrement(1))
    3444                   delete addedCuts_[i] ; } }
    3445           double objectiveValue = newNode->objectiveValue();
    3446             setBestSolution(CBC_SOLUTION,objectiveValue,
    3447                             solver_->getColSolution()) ;
    3448             lastHeuristic_ = NULL;
    3449             incrementUsed(solver_->getColSolution());
    3450             //assert(nodeInfo->numberPointingToThis() <= 2) ;
    3451             // avoid accidental pruning, if newNode was final branch arm
    3452             nodeInfo->increment();
    3453             delete newNode ;
    3454             nodeInfo->decrement() ; } }
    3455 /*
    3456   This node has been completely expanded and can be removed from the live
    3457   set.
    3458 */
    3459       if (branchesLeft)
    3460       {
    3461       }
    3462       else
    3463       {
    3464         if (!nodeInfo->numberBranchesLeft())
    3465           nodeInfo->allBranchesGone(); // can clean up
    3466         delete node ; }
    3467     } else {
    3468       // add cuts found to be infeasible (on bound)!
    3469       abort();
    3470       delete node;
    3471     }
    3472 /*
    3473   Delete cuts to get back to the original system.
    3474 
    3475   I'm thinking this is redundant --- the call to addCuts that conditions entry
    3476   to this code block also performs this action.
    3477 */
    3478       int numberToDelete = getNumRows()-numberRowsAtContinuous_ ;
    3479       if (numberToDelete)
    3480       { int * delRows = new int[numberToDelete] ;
    3481         int i ;
    3482         for (i = 0 ; i < numberToDelete ; i++)
    3483         { delRows[i] = i+numberRowsAtContinuous_ ; }
    3484         solver_->deleteRows(numberToDelete,delRows) ;
    3485         delete [] delRows ; }
    3486 #else // end of not CBC_THREAD
    3487 #ifndef CBC_DETERMINISTIC_THREAD
    3488       CbcNode *node = tree_->bestNode(cutoff) ;
     3040    CbcNode * node=NULL;
     3041    if (!parallelMode()||parallelMode()==-1) {
     3042      node = tree_->bestNode(cutoff) ;
    34893043      // Possible one on tree worse than cutoff
    34903044      if (!node||node->objectiveValue()>cutoff)
    34913045        continue;
    3492     if (!numberThreads_) {
    3493 #else
    3494       if (!numberThreads_||(tree_->size()<5*numberThreads_&&!goneParallel)) {
    3495       CbcNode *node = tree_->bestNode(cutoff) ;
    3496       // Possible one on tree worse than cutoff
    3497       if (!node||node->objectiveValue()>cutoff)
    3498         continue;
    3499 #endif
    35003046      // Do main work of solving node here
    35013047      doOneNode(this,node,createdNode);
    3502 #ifdef CBC_DETERMINISTIC_THREAD
     3048    } else if (parallelMode()>0) {
     3049      node = tree_->bestNode(cutoff) ;
     3050      // Possible one on tree worse than cutoff
     3051      if (!node||node->objectiveValue()>cutoff)
     3052        continue;
     3053      threadStats[0]++;
     3054      //need to think
     3055      int iThread;
     3056      // Start one off if any available
     3057      for (iThread=0;iThread<numberThreads_;iThread++) {
     3058        if (threadInfo[iThread].returnCode==-1)
     3059          break;
     3060      }
     3061      if (iThread<numberThreads_) {
     3062        threadInfo[iThread].node=node;
     3063        assert (threadInfo[iThread].returnCode==-1);
     3064        // say in use
     3065        threadInfo[iThread].returnCode=0;
     3066        threadModel[iThread]->moveToModel(this,0);
     3067        pthread_cond_signal(threadInfo[iThread].condition2); // unlock
     3068        threadCount[iThread]++;
     3069      }
     3070      lockThread();
     3071      locked=true;
     3072      // see if any finished
     3073      for (iThread=0;iThread<numberThreads_;iThread++) {
     3074        if (threadInfo[iThread].returnCode>0)
     3075          break;
     3076      }
     3077      unlockThread();
     3078      locked=false;
     3079      if (iThread<numberThreads_) {
     3080        threadModel[iThread]->moveToModel(this,1);
     3081        assert (threadInfo[iThread].returnCode==1);
     3082        // say available
     3083        threadInfo[iThread].returnCode=-1;
     3084        // carry on
     3085        threadStats[3]++;
     3086      } else {
     3087        // Start one off if any available
     3088        for (iThread=0;iThread<numberThreads_;iThread++) {
     3089          if (threadInfo[iThread].returnCode==-1)
     3090            break;
     3091        }
     3092        if (iThread<numberThreads_) {
     3093          lockThread();
     3094          locked=true;
     3095          // If any on tree get
     3096          if (!tree_->empty()) {
     3097            //node = tree_->bestNode(cutoff) ;
     3098            //assert (node);
     3099            threadStats[1]++;
     3100            continue; // ** get another node
     3101          }
     3102          unlockThread();
     3103          locked=false;
     3104        }
     3105        // wait (for debug could sleep and use test)
     3106        bool finished=false;
     3107        while (!finished) {
     3108          pthread_mutex_lock(&condition_mutex);
     3109          struct timespec absTime;
     3110          my_gettime(&absTime);
     3111          double time = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
     3112          absTime.tv_nsec += 1000000; // millisecond
     3113          if (absTime.tv_nsec>=1000000000) {
     3114            absTime.tv_nsec -= 1000000000;
     3115            absTime.tv_sec++;
     3116          }
     3117          pthread_cond_timedwait(&condition_main,&condition_mutex,&absTime);
     3118          my_gettime(&absTime);
     3119          double time2 = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
     3120          timeWaiting += time2-time;
     3121          pthread_mutex_unlock(&condition_mutex);
     3122          for (iThread=0;iThread<numberThreads_;iThread++) {
     3123            if (threadInfo[iThread].returnCode>0) {
     3124              finished=true;
     3125              break;
     3126            } else if (threadInfo[iThread].returnCode==0) {
     3127              pthread_cond_signal(threadInfo[iThread].condition2); // unlock
     3128            }
     3129          }
     3130        }
     3131        assert (iThread<numberThreads_);
     3132        // move information to model
     3133        threadModel[iThread]->moveToModel(this,1);
     3134        node = threadInfo[iThread].node;
     3135        threadInfo[iThread].node=NULL;
     3136        assert (threadInfo[iThread].returnCode==1);
     3137        // say available
     3138        threadInfo[iThread].returnCode=-1;
     3139        // carry on
     3140        threadStats[2]++;
     3141      }
     3142    } else {
     3143      // Deterministic parallel
     3144      if (tree_->size()<5*numberThreads_&&!goneParallel) {
     3145        node = tree_->bestNode(cutoff) ;
     3146        // Possible one on tree worse than cutoff
     3147        if (!node||node->objectiveValue()>cutoff)
     3148          continue;
     3149        // Do main work of solving node here
     3150        doOneNode(this,node,createdNode);
    35033151        assert (createdNode);
    35043152        if (!createdNode->active()) {
    3505           //if (createdNode->nodeInfo()) {
    3506           //createdNode->nodeInfo()->throwAway();
    3507           //}
    35083153          delete createdNode;
    35093154          createdNode=NULL;
     
    35133158          tree_->push(createdNode) ;
    35143159        }
    3515         //if (node) {
    3516         //assert (node->active());
    35173160        if (node->active()) {
    35183161          assert (node->nodeInfo());
     
    35403183          nDeleteNode=0;
    35413184        }
    3542 #endif
    35433185      } else {
    3544 #ifdef CBC_NORMAL_THREAD
    3545         threadStats[0]++;
    3546         //need to think
    3547         int iThread;
    3548         // Start one off if any available
    3549         for (iThread=0;iThread<numberThreads_;iThread++) {
    3550           if (threadInfo[iThread].returnCode==-1)
    3551             break;
    3552         }
    3553         if (iThread<numberThreads_) {
    3554           threadInfo[iThread].node=node;
    3555           assert (threadInfo[iThread].returnCode==-1);
    3556           // say in use
    3557           threadInfo[iThread].returnCode=0;
    3558           threadModel[iThread]->moveToModel(this,0);
    3559           pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    3560           threadCount[iThread]++;
    3561         }
    3562         lockThread();
    3563         locked=true;
    3564         // see if any finished
    3565         for (iThread=0;iThread<numberThreads_;iThread++) {
    3566           if (threadInfo[iThread].returnCode>0)
    3567             break;
    3568         }
    3569         unlockThread();
    3570         locked=false;
    3571         if (iThread<numberThreads_) {
    3572           threadModel[iThread]->moveToModel(this,1);
    3573           assert (threadInfo[iThread].returnCode==1);
    3574           // say available
    3575           threadInfo[iThread].returnCode=-1;
    3576           // carry on
    3577           threadStats[3]++;
    3578         } else {
    3579           // Start one off if any available
    3580           for (iThread=0;iThread<numberThreads_;iThread++) {
    3581             if (threadInfo[iThread].returnCode==-1)
    3582               break;
    3583           }
    3584           if (iThread<numberThreads_) {
    3585             lockThread();
    3586             locked=true;
    3587             // If any on tree get
    3588             if (!tree_->empty()) {
    3589               //node = tree_->bestNode(cutoff) ;
    3590               //assert (node);
    3591               threadStats[1]++;
    3592               continue; // ** get another node
    3593             }
    3594             unlockThread();
    3595             locked=false;
    3596           }
    3597           // wait (for debug could sleep and use test)
    3598           bool finished=false;
    3599           while (!finished) {
    3600             pthread_mutex_lock(&condition_mutex);
    3601             struct timespec absTime;
    3602             my_gettime(&absTime);
    3603             double time = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
    3604             absTime.tv_nsec += 1000000; // millisecond
    3605             if (absTime.tv_nsec>=1000000000) {
    3606               absTime.tv_nsec -= 1000000000;
    3607               absTime.tv_sec++;
    3608             }
    3609             pthread_cond_timedwait(&condition_main,&condition_mutex,&absTime);
    3610             my_gettime(&absTime);
    3611             double time2 = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
    3612             timeWaiting += time2-time;
    3613             pthread_mutex_unlock(&condition_mutex);
    3614             for (iThread=0;iThread<numberThreads_;iThread++) {
    3615               if (threadInfo[iThread].returnCode>0) {
    3616                 finished=true;
    3617                 break;
    3618               } else if (threadInfo[iThread].returnCode==0) {
    3619                 pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    3620               }
    3621             }
    3622           }
    3623           assert (iThread<numberThreads_);
    3624           // move information to model
    3625           threadModel[iThread]->moveToModel(this,1);
    3626           node = threadInfo[iThread].node;
    3627           threadInfo[iThread].node=NULL;
    3628           assert (threadInfo[iThread].returnCode==1);
    3629           // say available
    3630           threadInfo[iThread].returnCode=-1;
    3631           // carry on
    3632           threadStats[2]++;
    3633         }
    3634 #else
    3635         // Deterministic parallel
    3636 #ifndef CBC_DETERMINISTIC_THREAD
    3637         abort();
    3638 #endif
    3639 #ifdef CBC_THREAD
     3186        // Split
    36403187        int saveTreeSize = tree_->size();
    36413188        goneParallel=true;
    36423189        int nAffected=splitModel(numberThreads_,threadModel,defaultParallelNodes);
     3190#ifndef NDEBUG
    36433191        int saveTreeSize2 = tree_->size();
     3192#endif
    36443193        int iThread;
    36453194        // do all until finished
     
    36563205          threadInfo[iThread].returnCode=0;
    36573206          pthread_cond_signal(threadInfo[iThread].condition2); // unlock
    3658 #if 0
    3659           //wait!!
    3660           bool finished=false;
    3661           while (!finished) {
    3662             pthread_mutex_lock(&condition_mutex);
    3663             struct timespec absTime;
    3664             my_gettime(&absTime);
    3665             double time = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
    3666             absTime.tv_nsec += 1000000; // millisecond
    3667             if (absTime.tv_nsec>=1000000000) {
    3668               absTime.tv_nsec -= 1000000000;
    3669               absTime.tv_sec++;
    3670             }
    3671             pthread_cond_timedwait(&condition_main,&condition_mutex,&absTime);
    3672             my_gettime(&absTime);
    3673             double time2 = absTime.tv_sec+1.0e-9*absTime.tv_nsec;
    3674             timeWaiting += time2-time;
    3675             pthread_mutex_unlock(&condition_mutex);
    3676             finished=true;
    3677             if (threadInfo[iThread].returnCode<=0) {
    3678               finished=false;
    3679             }
    3680           }
    3681 #endif
    36823207        }
    36833208        // wait
     
    37433268        }
    37443269        if (scaleFactor!=1.0) {
    3745           int newNumber = (int) (defaultParallelNodes * scaleFactor+0.5001);
     3270          int newNumber = static_cast<int> (defaultParallelNodes * scaleFactor+0.5001);
    37463271          if (newNumber*2<defaultParallelIterations) {
    37473272            char general[200];
    37483273            sprintf(general,"Changing tree size from %d to %d",
    3749                    defaultParallelNodes,newNumber);
     3274                    defaultParallelNodes,newNumber);
    37503275            messageHandler()->message(CBC_GENERAL,
    37513276                                      messages())
     
    37543279          }
    37553280        }
    3756         //printf("Tree sizes %d %d %d - affected %d\n",saveTreeSize,saveTreeSize2,tree_->size(),nAffected);
    3757         // later remember random may not be thread neutral
    3758 #endif
    3759 #endif
    3760       }
    3761       //lastDepth=node->depth();
    3762       //lastUnsatisfied=node->numberUnsatisfied();
    3763 #endif // end of CBC_THREAD
    3764   }
    3765 #ifdef CBC_DETERMINISTIC_THREAD
     3281          //printf("Tree sizes %d %d %d - affected %d\n",saveTreeSize,saveTreeSize2,tree_->size(),nAffected);
     3282      }
     3283    }
     3284  }
    37663285  if (nDeleteNode) {
    37673286    for (int i=0;i<nDeleteNode;i++) {
     
    37703289    nDeleteNode=0;
    37713290  }
    3772 #endif
    37733291#ifdef CBC_THREAD
    37743292  if (numberThreads_) {
     
    38053323      pthread_mutex_lock(&condition_mutex); // not sure necessary but have had one hang on interrupt
    38063324      threadModel[i]->numberThreads_=0; // say exit
    3807 #ifdef CBC_DETERMINISTIC_THREAD
    3808       delete [] threadInfo[i].delNode;
    3809 #endif
     3325      if (parallelMode()<0)
     3326        delete [] threadInfo[i].delNode;
    38103327      threadInfo[i].returnCode=0;
    38113328      pthread_mutex_unlock(&condition_mutex);
     
    40773594    // Now print
    40783595    if (numberSolutions)
    4079       averageSolutionDepth /= (double) numberSolutions;
     3596      averageSolutionDepth /= static_cast<double> (numberSolutions);
    40803597    int numberSolved = numberNodes2_-numberCutoff;
    40813598    double averageNumberIterations2=numberIterations_-averageNumberIterations1
    40823599      -numberIterationsAtContinuous;
    40833600    if(numberCutoff) {
    4084       averageCutoffDepth /= (double) numberCutoff;
    4085       averageNumberIterations2 /= (double) numberCutoff;
     3601      averageCutoffDepth /= static_cast<double> (numberCutoff);
     3602      averageNumberIterations2 /= static_cast<double> (numberCutoff);
    40863603    }
    40873604    if (numberNodes2_)
    4088       averageValue /= (double) numberNodes2_;
     3605      averageValue /= static_cast<double> (numberNodes2_);
    40893606    if (numberSolved) {
    4090       averageNumberIterations1 /= (double) numberSolved;
    4091       averageSolvedDepth /= (double) numberSolved;
     3607      averageNumberIterations1 /= static_cast<double> (numberSolved);
     3608      averageSolvedDepth /= static_cast<double> (numberSolved);
    40923609    }
    40933610    printf("%d solution(s) were found (by branching) at an average depth of %g\n",
     
    41003617           numberSolved,averageSolvedDepth,averageNumberIterations1);
    41013618    if (numberDown) {
    4102       averageInfDown /= (double) numberDown;
    4103       averageObjDown /= (double) numberDown;
     3619      averageInfDown /= static_cast<double> (numberDown);
     3620      averageObjDown /= static_cast<double> (numberDown);
    41043621    }
    41053622    printf("Down %d nodes (%d first, %d second) - %d cutoff, rest decrease numinf %g increase obj %g\n",
     
    41073624           averageInfDown,averageObjDown);
    41083625    if (numberUp) {
    4109       averageInfUp /= (double) numberUp;
    4110       averageObjUp /= (double) numberUp;
     3626      averageInfUp /= static_cast<double> (numberUp);
     3627      averageObjUp /= static_cast<double> (numberUp);
    41113628    }
    41123629    printf("Up %d nodes (%d first, %d second) - %d cutoff, rest decrease numinf %g increase obj %g\n",
     
    42713788      = dynamic_cast<OsiClpSolverInterface *> (solver_);
    42723789    if (clpSolver)
    4273       clpSolver->setFakeObjective((double *) NULL);
     3790      clpSolver->setFakeObjective(reinterpret_cast<double *> (NULL));
    42743791  }
    42753792#endif
     
    63975914  { int i;
    63985915    if (currentNumberCuts) {
    6399 #ifndef CBC_DETERMINISTIC_THREAD
    6400       lockThread();
    6401 #endif
     5916      if (parallelMode()>0)
     5917        lockThread();
    64025918      int numberLeft = nodeInfo->numberBranchesLeft();
    64035919      for (i = 0 ; i < currentNumberCuts ; i++)
     
    64065922            { delete addedCuts_[i];
    64075923            addedCuts_[i] = NULL; } } }
    6408 #ifndef CBC_DETERMINISTIC_THREAD
    6409       unlockThread();
    6410 #endif
     5924      if (parallelMode()>0)
     5925        unlockThread();
    64115926    }
    64125927    return 1 ; }
     5928}
     5929/* Makes all handlers same.  If makeDefault 1 then makes top level
     5930   default and rest point to that.  If 2 then each is copy
     5931*/
     5932void
     5933CbcModel::synchronizeHandlers(int makeDefault)
     5934{
     5935  if (!defaultHandler_) {
     5936    // Must have clone
     5937    handler_ = handler_->clone();
     5938    defaultHandler_=true;
     5939  }
     5940#ifdef COIN_HAS_CLP
     5941  OsiClpSolverInterface * solver;
     5942  solver= dynamic_cast<OsiClpSolverInterface *>(solver_) ;
     5943  if (solver) {
     5944    solver->passInMessageHandler(handler_);
     5945    solver->getModelPtr()->passInMessageHandler(handler_);
     5946  }
     5947  solver= dynamic_cast<OsiClpSolverInterface *>(continuousSolver_) ;
     5948  if (solver) {
     5949    solver->passInMessageHandler(handler_);
     5950    solver->getModelPtr()->passInMessageHandler(handler_);
     5951  }
     5952#endif
    64135953}
    64145954
     
    66866226      threadModel[i]->solver_=NULL;
    66876227      threadModel[i]->numberThreads_=numberThreads_;
    6688       mutex_ = (void *) (threadInfo+i);
    6689       threadInfo[i].thisModel=(CbcModel *) threadModel[i];
     6228      mutex_ = reinterpret_cast<void *> (threadInfo+i);
     6229      threadInfo[i].thisModel=threadModel[i];
    66906230      threadInfo[i].baseModel=this;
    66916231      threadInfo[i].threadIdOfBase.thr=pthread_self();
     
    66986238    // Do a partial one for base model
    66996239    threadInfo[numberThreads_].baseModel=this;
    6700     mutex_ = (void *) (threadInfo+numberThreads_);
     6240    mutex_ = reinterpret_cast<void *> (threadInfo+numberThreads_);
    67016241    threadInfo[numberThreads_].condition2=&condition_main;
    67026242    threadInfo[numberThreads_].mutex2=&condition_mutex;
     
    67816321      // have to compute object number as not saved
    67826322      CbcSimpleInteger * simpleObject =
    6783           dynamic_cast <CbcSimpleInteger *>(object) ;
     6323          static_cast <CbcSimpleInteger *>(object) ;
    67846324      int iObject;
    67856325      int iColumn = simpleObject->columnNumber();
    67866326      for (iObject = 0 ; iObject < numberObjects_ ; iObject++) {
    67876327        simpleObject =
    6788           dynamic_cast <CbcSimpleInteger *>(object_[iObject]) ;
     6328          static_cast <CbcSimpleInteger *>(object_[iObject]) ;
    67896329        if (simpleObject->columnNumber()==iColumn)
    67906330          break;
     
    69916531    int numberViolated=0;
    69926532    if (currentPassNumber_ == 1 && howOftenGlobalScan_ > 0 &&
    6993         (numberNodes_%howOftenGlobalScan_) == 0)
    6994     { int numberCuts = globalCuts_.sizeColCuts() ;
     6533        (numberNodes_%howOftenGlobalScan_) == 0&&
     6534        doCutsNow(1)) {
     6535      int numberCuts = globalCuts_.sizeColCuts() ;
    69956536      int i;
    69966537      // possibly extend whichGenerator
     
    71656706#endif
    71666707          if (mustResolve) {
    7167             int returncode = resolve(node ? node->nodeInfo() : NULL,2);
    7168             feasible = returnCode  != 0 ;
    7169             if (returncode<0)
     6708            int returnCode = resolve(node ? node->nodeInfo() : NULL,2);
     6709            feasible = (returnCode  != 0) ;
     6710            if (returnCode<0)
    71706711              numberTries=0;
    71716712            if ((specialOptions_&1)!=0) {
     
    73606901            assert (threadInfo[iThread].returnCode);
    73616902            threadModel[iThread]->generator_[0]=generator_[i];
    7362             threadModel[iThread]->object_ = (OsiObject **) (eachCuts+i);
     6903            threadModel[iThread]->object_ = reinterpret_cast<OsiObject **> (eachCuts+i);
    73636904            // allow to start
    73646905            threadInfo[iThread].returnCode=0;
     
    78567397    { int i ;
    78577398      if (currentNumberCuts_) {
    7858 #ifndef CBC_DETERMINISTIC_THREAD
    7859         lockThread();
    7860 #endif
     7399        if (parallelMode()>0)
     7400          lockThread();
    78617401        for (i = 0;i<currentNumberCuts_;i++) {
    78627402          // take off node
     
    80537593    int numberRowsAdded = solver_->getNumRows()-numberRowsAtStart;
    80547594    CoinBigIndex numberElementsAdded =  solver_->getNumElements()-numberElementsAtStart ;
    8055     double densityOld = ((double) numberElementsAtStart)/((double) numberRowsAtStart);
    8056     double densityNew = numberRowsAdded ? ((double) (numberElementsAdded))/((double) numberRowsAdded)
     7595    double densityOld = static_cast<double> (numberElementsAtStart)/static_cast<double> (numberRowsAtStart);
     7596    double densityNew = numberRowsAdded ? (static_cast<double> (numberElementsAdded))/static_cast<double> (numberRowsAdded)
    80577597      : 0.0;
    80587598    if (!numberNodes_) {
     
    81997739    if (!numberNodes_) {
    82007740      double value = CoinMax(minimumDrop_,0.005*(thisObjective-startObjective)/
    8201                              ((double) currentPassNumber_));
     7741                             static_cast<double> (currentPassNumber_));
    82027742      if (numberColumns<200)
    82037743        value = CoinMax(minimumDrop_,0.1*value);
     
    82347774    int iProbing=-1;
    82357775    double smallProblem = (0.2* totalCuts) /
    8236       ((double) numberActiveGenerators) ;
     7776      static_cast<double> (numberActiveGenerators) ;
    82377777    for (i = 0;i<numberCutGenerators_;i++) {
    82387778     
     
    82867826            if (howOften!=1&&!probingWasOnBut) {
    82877827              if (generator_[i]->whatDepth()<0||howOften!=-1) {
    8288                 int k = (int) sqrt(smallProblem/thisCuts) ;
     7828                int k = static_cast<int> (sqrt(smallProblem/thisCuts)) ;
    82897829                if (howOften!=-98)
    82907830                  howOften = k+1000000 ;
     
    85978137    int oldCutIndex = 0 ;
    85988138    if (numberOldActiveCuts_) {
    8599 #ifndef CBC_DETERMINISTIC_THREAD
    8600       lockThread();
    8601 #endif
     8139      if (parallelMode()>0)
     8140        lockThread();
    86028141      for (i = 0 ; i < numberOldActiveCuts_ ; i++)
    86038142        { status = ws->getArtifStatus(i+firstOldCut) ;
     
    86238162        else
    86248163          { oldCutIndex++ ; } }
    8625 #ifndef CBC_DETERMINISTIC_THREAD
    8626       unlockThread();
    8627 #endif
     8164      if (parallelMode()>0)
     8165        unlockThread();
    86288166    }
    86298167/*
     
    86398177    for (i = 0 ; i < nCuts ; i++)
    86408178    { status = ws->getArtifStatus(i+firstNewCut) ;
    8641       if (status == CoinWarmStartBasis::basic&&whichGenerator_[i]!=-2)
     8179      if (status == CoinWarmStartBasis::basic&&
     8180          /*whichGenerator_[i]!=-2*/newCuts.rowCutPtr(i)->effectiveness()<1.0e20)
    86428181      { solverCutIndices[numberNewToDelete+numberOldToDelete] = i+firstNewCut ;
    86438182        newCutIndices[numberNewToDelete++] = i ; }
    86448183      else
    86458184      { // save which generator did it
    8646         assert (whichGenerator_[i]!=-2); // ?? what if it is - memory leak?
     8185        // -2 means branch cut! assert (whichGenerator_[i]!=-2); // ?? what if it is - memory leak?
    86478186        whichGenerator_[k++] = whichGenerator_[i] ; } }
    86488187    int baseRow = firstNewCut+nCuts;
     
    86518190    for (i = 0 ; i < numberNewCuts ; i++) {
    86528191      status = ws->getArtifStatus(i+baseRow) ;
    8653       if (status != CoinWarmStartBasis::basic) {
     8192      if (status != CoinWarmStartBasis::basic||
     8193          /*whichGenerator_[i+nCuts]==-2*/addedCuts[i]->effectiveness()>=1.0e20) {
    86548194        newCuts.insert(*addedCuts[i]) ;
    86558195        //newCuts.insert(mutableAdded[i]) ;
    86568196        //mutableAdded[i]=NULL;
    8657         if (status == CoinWarmStartBasis::basic&&whichGenerator_[i]!=-2) {
     8197        //if (status == CoinWarmStartBasis::basic&&whichGenerator_[i]!=-2) {
    86588198          // save which generator did it
    8659           whichGenerator_[k++] = whichGenerator_[i+nCuts] ;
    8660         }
     8199          //whichGenerator_[k++] = whichGenerator_[i+nCuts] ;
     8200        //}
    86618201      } else {
    86628202        solverCutIndices[numberTotalToDelete++] = i+baseRow ;
     
    89978537            value = fabs(cost)*multiplier ;
    89988538            if (value <2.1e9) {
    8999               int nearest = (int) floor(value+0.5) ;
     8539              int nearest = static_cast<int> (floor(value+0.5)) ;
    90008540              assert (fabs(value-floor(value+0.5)) < 1.0e-8);
    90018541              if (!increment)
     
    91638703      }
    91648704    }
    9165     int iUpper = (int) floor(upperValue+1.0e-5);
    9166     int iLower = (int) ceil(lowerValue-1.0e-5);
     8705    int iUpper = static_cast<int> (floor(upperValue+1.0e-5));
     8706    int iLower = static_cast<int> (ceil(lowerValue-1.0e-5));
    91678707    int state=0;
    91688708    if (upperValue<1.0e6) {
     
    92768816      printf("%d cliques of average size %g found, %d P1, %d M1\n",
    92778817             numberCliques,
    9278              ((double)(totalP1+totalM1))/((double) numberCliques),
     8818             (static_cast<double>(totalP1+totalM1))/(static_cast<double> numberCliques),
    92798819             totalP1,totalM1);
    92808820    else
     
    94118951  }
    94128952  if (numberIntegers) {
    9413     double smallDown = 0.01*(downSum/((double) numberIntegers));
    9414     double smallUp = 0.01*(upSum/((double) numberIntegers));
     8953    double smallDown = 0.01*(downSum/static_cast<double> (numberIntegers));
     8954    double smallUp = 0.01*(upSum/static_cast<double> (numberIntegers));
    94158955    for (int i=0;i<numberObjects_;i++) {
    94168956      CbcSimpleIntegerDynamicPseudoCost * obj1 =
     
    95089048    if (obj) {
    95099049      obj->setModel(this);
    9510 #ifdef CBC_DETERMINISTIC_THREAD
    95119050      obj->setPosition(i);
    9512 #endif
    95139051    }
    95149052  }
     
    1139010928            if(objective[iColumn]) {
    1139110929              double value = fabs(objective[iColumn])*multiplier;
    11392               int nearest = (int) floor(value+0.5);
     10930              int nearest = static_cast<int> (floor(value+0.5));
    1139310931              if (fabs(value-floor(value+0.5))>1.0e-8||value>2.1e9) {
    1139410932                increment=0;
     
    1176011298    int iColumn=integerVariable[i];
    1176111299    const OsiObject * object = object_[i];
     11300#if NDEBUG
    1176211301    const CbcSimpleInteger * integerObject =
    1176311302      dynamic_cast<const  CbcSimpleInteger *> (object);
    1176411303    assert(integerObject);
     11304#else
     11305    const CbcSimpleInteger * integerObject =
     11306      static_cast<const  CbcSimpleInteger *> (object);
     11307#endif
    1176511308    // get original bounds
    1176611309    double originalLower = integerObject->originalLowerBound();
     
    1189111434    int iColumn=integerVariable[i];
    1189211435    const OsiObject * object = object_[i];
     11436#if NDEBUG
    1189311437    const CbcSimpleInteger * integerObject =
    1189411438      dynamic_cast<const  CbcSimpleInteger *> (object);
    1189511439    assert(integerObject);
     11440#else
     11441    const CbcSimpleInteger * integerObject =
     11442      static_cast<const  CbcSimpleInteger *> (object);
     11443#endif
    1189611444    // get original bounds
    1189711445    double originalLower = integerObject->originalLowerBound();
     
    1276712315      } else {
    1276812316        if (lastws) {
    12769 #ifdef CBC_DETERMINISTIC_THREAD
    12770           lastws->fixFullBasis();
    12771 #else
    12772           if ((specialOptions_&8192)==0)
    12773             assert (lastws->fullBasis());
    12774           else
     12317          if (parallelMode()<-1) {
    1277512318            lastws->fixFullBasis();
    12776 #endif
     12319          } else {
     12320            if ((specialOptions_&8192)==0)
     12321              assert (lastws->fullBasis());
     12322            else
     12323              lastws->fixFullBasis();
     12324          }
    1277712325        }
    1277812326        newNode->createInfo(this,oldNode,lastws,lowerBefore,upperBefore,
     
    1278512333      newNode->initializeInfo() ;
    1278612334      if (cuts.sizeRowCuts()) {
    12787 #ifndef CBC_DETERMINISTIC_THREAD
    12788         lockThread();
    12789 #endif
     12335        int initialNumber=((threadMode_&1)==0) ? 0: 1000000000;
     12336        if (parallelMode()>0)
     12337          lockThread();
    1279012338        newNode->nodeInfo()->addCuts(cuts,newNode->numberBranches(),
    12791                                      whichGenerator_) ;
    12792 #ifndef CBC_DETERMINISTIC_THREAD
    12793         unlockThread();
    12794 #endif
     12339                                     whichGenerator_,
     12340                                     initialNumber) ;
     12341        if (parallelMode()>0)
     12342          unlockThread();
    1279512343      }
    1279612344    }
     
    1280912357      // zap parent nodeInfo
    1281012358#ifdef COIN_DEVELOP
    12811       printf("zapping3 CbcNodeInfo %x\n",newNode->nodeInfo()->parent());
     12359      printf("zapping3 CbcNodeInfo %x\n",reinterpret_cast<int>(newNode->nodeInfo()->parent()));
    1281212360#endif
    1281312361      if (newNode->nodeInfo())
     
    1303312581        // redo ids etc
    1303412582        CbcObject * obj =
    13035           dynamic_cast <CbcObject *>(object_[numberObjects_]) ;
     12583          static_cast <CbcObject *>(object_[numberObjects_]) ;
    1303612584        assert (obj);
    1303712585        obj->redoSequenceEtc(this,numberColumns,originalColumns);
     
    1320812756        lastHeuristic_ = heuristic_[i];
    1320912757        setBestSolution(CBC_ROUNDING,heuristicValue,newSolution) ;
     12758        if (heuristic_[i]->exitNow(bestObjective_))
     12759          break;
    1321012760      } else {
    1321112761        heuristicValue = saveValue ;
     
    1352413074  double * lowerBefore = new double [numberColumns] ;
    1352513075  double * upperBefore = new double [numberColumns] ;
    13526 #ifndef CBC_DETERMINISTIC_THREAD
    13527   newNode = NULL ;
    13528 #else
    13529   newNode = new CbcNode();
    13530   //printf("CbcNode %x newNode\n",newNode);
    13531 #endif
     13076  if (parallelMode()>=0)
     13077    newNode = NULL ;
     13078  else
     13079    newNode = new CbcNode();
    1353213080  bool feasible=true;
    1353313081  CoinWarmStartBasis *lastws = new CoinWarmStartBasis();
    13534 #ifndef CBC_DETERMINISTIC_THREAD
    13535   lockThread();
    13536 #endif
     13082  if (parallelMode()>0)
     13083    lockThread();
    1353713084  // point to genuine ones
    1353813085  //int save1 = maximumNumberCuts_;
    1353913086  //maximumNumberCuts_ = baseModel->maximumNumberCuts_;
    1354013087  //addedCuts_ = baseModel->addedCuts_;
    13541 #ifndef CBC_DETERMINISTIC_THREAD
    13542   maximumDepth_ = baseModel->maximumDepth_;
    13543   walkback_ = baseModel->walkback_;
     13088  if (parallelMode()>=0) {
     13089    maximumDepth_ = baseModel->maximumDepth_;
     13090    walkback_ = baseModel->walkback_;
    1354413091#ifdef NODE_LAST
    13545   lastNodeInfo_ = baseModel->lastNodeInfo_;
    13546   lastNumberCuts_ = baseModel->lastNumberCuts_;
    13547   lastCut_ = baseModel->lastCut_;
    13548   lastNumberCuts2_ = baseModel->lastNumberCuts2_;
    13549 #endif
    13550 #endif
    13551 #ifndef CBC_DETERMINISTIC_THREAD
     13092    lastNodeInfo_ = baseModel->lastNodeInfo_;
     13093    lastNumberCuts_ = baseModel->lastNumberCuts_;
     13094    lastCut_ = baseModel->lastCut_;
     13095    lastNumberCuts2_ = baseModel->lastNumberCuts2_;
     13096#endif
     13097  }
    1355213098  int save2 = maximumDepth_;
    13553 #endif
    1355413099  int retCode =addCuts(node,lastws,numberFixedNow_>numberFixedAtRoot_);
    1355513100  //if (save1<maximumNumberCuts_) {
     
    1355813103    //baseModel->addedCuts_ = addedCuts_;
    1355913104  //}
    13560 #ifndef CBC_DETERMINISTIC_THREAD
    13561   if (save2<maximumDepth_) {
     13105  if (parallelMode()>=0&&save2<maximumDepth_) {
    1356213106    // increased
    1356313107    baseModel->maximumDepth_ = maximumDepth_;
     
    1357013114#endif
    1357113115  }
    13572 #endif
    1357313116  int branchesLeft=0;
    1357413117  if (!retCode) {
    13575 #ifndef CBC_DETERMINISTIC_THREAD
    13576     unlockThread();
    13577 #endif
     13118    if (parallelMode()>0)
     13119      unlockThread();
    1357813120    int i ;
    1357913121    const double * lower = getColLower() ;
     
    1358713129      solverCharacteristics_->setBeforeUpper(upperBefore);
    1358813130    }
    13589 #ifndef CBC_DETERMINISTIC_THREAD
    13590     lockThread();
    13591 #endif
     13131    if (parallelMode()>0)
     13132      lockThread();
    1359213133    assert (node->objectiveValue()<1.0e200);
    1359313134    if (messageHandler()->logLevel()>2)
     
    1359813139      // old way so need to cheat
    1359913140      OsiBranchingObject * branch2 = node->modifiableBranchingObject();
     13141#ifndef NDEBUG
    1360013142      CbcBranchingObject * branch = dynamic_cast <CbcBranchingObject *>(branch2) ;
    1360113143      assert (branch);
     13144#else
     13145      CbcBranchingObject * branch = static_cast <CbcBranchingObject *>(branch2) ;
     13146#endif
    1360213147      branch->setModel(this);
    1360313148      branchesLeft = node->branch(NULL); // old way
    13604 #ifndef CBC_DETERMINISTIC_THREAD
    13605       branch->setModel(baseModel);
    13606 #endif
     13149      if (parallelMode()>=0)
     13150        branch->setModel(baseModel);
    1360713151    }
    1360813152    assert (branchesLeft==node->nodeInfo()->numberBranchesLeft());
    13609 #ifndef CBC_DETERMINISTIC_THREAD
    13610     if (mutex_) {
     13153    if (parallelMode()>0) {
     13154      assert(mutex_);
    1361113155      assert (node->nodeInfo());
    1361213156      node->nodeInfo()->increment() ;
    13613     }
    13614 #endif
    13615 #ifndef CBC_DETERMINISTIC_THREAD
    13616     unlockThread();
    13617 #endif
     13157      unlockThread();
     13158    }
    1361813159    if ((specialOptions_&1)!=0) {
    1361913160      /*
     
    1379213333            double smallest=1.0e50;
    1379313334            double largest=-1.0;
    13794             for (int i=0;i<numberIntegers_-000000;i++) {
     13335            for (int i=0;i<numberIntegers_;i++) {
     13336#ifndef NDEBUG
    1379513337              CbcSimpleIntegerDynamicPseudoCost * obj =
    1379613338                dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(object_[i]) ;
    1379713339              assert (obj&&obj->columnNumber()==integerVariable_[i]);
     13340#else
     13341              CbcSimpleIntegerDynamicPseudoCost * obj =
     13342                static_cast <CbcSimpleIntegerDynamicPseudoCost *>(object_[i]) ;
     13343#endif
    1379813344              if (info->numberUp_[i]>0) {
    1379913345                if (info->downPseudo_[i]>largest)
     
    1406113607      }
    1406213608#endif
    14063 #ifndef CBC_DETERMINISTIC_THREAD
    14064       newNode = new CbcNode() ;
    14065 #endif
     13609      if (parallelMode()>=0)
     13610        newNode = new CbcNode() ;
    1406613611      // Set objective value (not so obvious if NLP etc)
    1406713612      setObjectiveValue(newNode,node);
     
    1408413629        increment the reference count in the current (parent) nodeInfo.
    1408513630      */
    14086 #ifndef CBC_DETERMINISTIC_THREAD
    14087       lockThread();
    14088 #endif
     13631      if (parallelMode()>0)
     13632        lockThread();
    1408913633      if (anyAction == -2) {
    14090 #ifndef CBC_DETERMINISTIC_THREAD
    14091         if (mutex_) {
     13634        if (parallelMode()>0) {
     13635          assert (mutex_);
    1409213636          assert (node->nodeInfo());
    1409313637          node->nodeInfo()->decrement() ;
    14094         }
    14095         delete newNode ;
    14096         if (mutex_) {
     13638          delete newNode ;
    1409713639          assert (node->nodeInfo());
    1409813640          node->nodeInfo()->increment() ;
    14099         }
    14100         newNode = NULL ;
    14101 #else
    14102         //assert (newNode->active());
    14103         newNode->setActive(false);
    14104 #endif
     13641          newNode = NULL ;
     13642        } else if (parallelMode()==0) {
     13643          delete newNode ;
     13644          newNode = NULL ;
     13645        } else {
     13646          //assert (newNode->active());
     13647          newNode->setActive(false);
     13648        }
    1410513649        // say strong doing well
    1410613650        if (checkingNode)
     
    1411713661      } else {
    1411813662        assert (node->nodeInfo());
    14119 #ifndef CBC_DETERMINISTIC_THREAD
    14120         node->nodeInfo()->increment() ;
    14121 #endif
     13663        if (parallelMode()>=0)
     13664          node->nodeInfo()->increment() ;
    1412213665        if ((numberNodes_%20)==0) {
    1412313666          // say strong not doing as well
     
    1412513668        }
    1412613669      }
    14127 #ifndef CBC_DETERMINISTIC_THREAD
    14128       unlockThread();
    14129 #endif
     13670      if (parallelMode()>0)
     13671        unlockThread();
    1413013672    }
    1413113673    /*
     
    1414513687      eventHappened_=true; // exit
    1414613688    }
    14147 #ifndef CBC_DETERMINISTIC_THREAD
    14148     assert (!newNode || newNode->objectiveValue() <= getCutoff()) ;
    14149 #else
    14150     assert (!newNode->active() || newNode->objectiveValue() <= getCutoff()) ;
    14151 #endif
     13689    if (parallelMode()>=0)
     13690      assert (!newNode || newNode->objectiveValue() <= getCutoff()) ;
     13691    else
     13692      assert (!newNode->active() || newNode->objectiveValue() <= getCutoff()) ;
    1415213693    if (statistics_) {
    1415313694      assert (numberNodes2_);
     
    1415913700        statistics_[numberNodes2_-1]->sayInfeasible();
    1416013701    }
    14161 #ifndef CBC_DETERMINISTIC_THREAD
    14162     lockThread();
    14163 #endif
     13702    if (parallelMode()>0)
     13703      lockThread();
    1416413704#if NEW_UPDATE_OBJECT>1
    14165 #ifndef CBC_DETERMINISTIC_THREAD
    14166     if (!numberThreads_) {
    14167 #endif
     13705    if (parallelMode()<=0) {
    1416813706      if (numberUpdateItems_) {
    1416913707        for (i=0;i<numberUpdateItems_;i++) {
     
    1418713725        numberUpdateItems_=0;
    1418813726      }
    14189 #ifndef CBC_DETERMINISTIC_THREAD
    14190     }
    14191 #endif
     13727    }
    1419213728#endif
    1419313729    if (newNode)
     
    1423413770            }
    1423513771          }
    14236 #ifndef CBC_DETERMINISTIC_THREAD
    14237           unlockThread();
    14238 #endif
     13772          if (parallelMode()>0)
     13773            unlockThread();
    1423913774         
    1424013775          double estValue = newNode->guessedObjectiveValue() ;
     
    1425513790              heuristic_[iHeur]->incrementNumberSolutionsFound();
    1425613791              found = iHeur ;
    14257 #ifndef CBC_DETERMINISTIC_THREAD
    14258               lockThread();
    14259               baseModel->incrementUsed(newSolution);
    14260               unlockThread();
    14261 #endif
     13792              if (parallelMode()>0) {
     13793                lockThread();
     13794                baseModel->incrementUsed(newSolution);
     13795                unlockThread();
     13796              }
    1426213797            } else if (ifSol < 0)       { // just returning an estimate
    1426313798              estValue = CoinMin(heurValue,estValue) ;
     
    1427213807          delete [] newSolution ;
    1427313808          newNode->setGuessedObjectiveValue(estValue) ;
    14274 #ifndef CBC_DETERMINISTIC_THREAD
    14275           lockThread();
    14276 #endif
    14277 #ifndef CBC_DETERMINISTIC_THREAD
     13809          if (parallelMode()>0)
     13810            lockThread();
     13811          if (parallelMode()>=0) {
    1427813812#define PUSH_LATER
    1427913813#ifdef PUSH_LATER
    14280           if (!mutex_) // only if serial
    14281 #endif
    14282             tree_->push(newNode) ;
    14283 #endif
     13814            if (!mutex_) // only if serial
     13815#endif
     13816              tree_->push(newNode) ;
     13817          }
    1428413818          if (statistics_) {
    1428513819            if (numberNodes2_==maximumStatistics_) {
     
    1432513859          }
    1432613860          //assert(nodeInfo->numberPointingToThis() <= 2) ;
    14327 #ifndef CBC_DETERMINISTIC_THREAD
    14328           // avoid accidental pruning, if newNode was final branch arm
    14329           node->nodeInfo()->increment();
    14330           delete newNode ;
    14331           newNode=NULL;
    14332           node->nodeInfo()->decrement() ;
    14333 #else
    14334           newNode->setActive(false);
    14335 #endif
     13861          if (parallelMode()>=0) {
     13862            // avoid accidental pruning, if newNode was final branch arm
     13863            node->nodeInfo()->increment();
     13864            delete newNode ;
     13865            newNode=NULL;
     13866            node->nodeInfo()->decrement() ;
     13867          } else {
     13868            newNode->setActive(false);
     13869          }
    1433613870        }
    1433713871      }
     
    1434013874        if (node->nodeInfo())
    1434113875          node->nodeInfo()->setNodeNumber(numberNodes2_);
    14342 #ifndef CBC_DETERMINISTIC_THREAD
     13876        if (parallelMode()>=0) {
    1434313877#ifdef PUSH_LATER
    14344         if (!mutex_) // only if serial
    14345 #endif
    14346           tree_->push(node) ;
    14347 #endif
     13878          if (!mutex_) // only if serial
     13879#endif
     13880            tree_->push(node) ;
     13881        }
    1434813882        if (statistics_) {
    1434913883          if (numberNodes2_==maximumStatistics_) {
     
    1436613900               node->nodeInfo()->numberPointingToThis()) ;
    1436713901#       endif
    14368 #ifndef CBC_DETERMINISTIC_THREAD
    14369         if (mutex_) {
     13902        if (parallelMode()>0) {
    1437013903          assert (node->nodeInfo());
    1437113904          node->nodeInfo()->decrement() ;
    1437213905        }
    14373 #endif
    1437413906      } else {
    1437513907        /*
     
    1437713909          set.
    1437813910        */
    14379 #ifndef CBC_DETERMINISTIC_THREAD
    14380         if (mutex_) {
     13911        if (parallelMode()>0) {
     13912          assert (mutex_) ;
    1438113913          assert (node->nodeInfo());
    1438213914          node->nodeInfo()->decrement() ;
    1438313915        }
    14384 #endif
    1438513916        assert (node->nodeInfo());
    14386 #ifndef CBC_DETERMINISTIC_THREAD
    14387         if (!node->nodeInfo()->numberBranchesLeft())
    14388           node->nodeInfo()->allBranchesGone(); // can clean up
    14389         delete node ;
    14390         node=NULL;
    14391 #else
    14392         node->setActive(false);
    14393 #endif
    14394       }
    14395 #ifndef CBC_DETERMINISTIC_THREAD
    14396       unlockThread();
    14397 #endif
     13917        if (parallelMode()>=0) {
     13918          if (!node->nodeInfo()->numberBranchesLeft())
     13919            node->nodeInfo()->allBranchesGone(); // can clean up
     13920          delete node ;
     13921          node=NULL;
     13922        } else {
     13923          node->setActive(false);
     13924        }
     13925      }
     13926      if (parallelMode()>0)
     13927        unlockThread();
    1439813928  } else {
    1439913929    // add cuts found to be infeasible (on bound)!
     
    1440313933    //abort();
    1440413934    assert (node->nodeInfo());
    14405 #ifndef CBC_DETERMINISTIC_THREAD
    14406     if (!node->nodeInfo()->numberBranchesLeft())
    14407       node->nodeInfo()->allBranchesGone(); // can clean up
    14408     delete node;
    14409     node=NULL;
    14410 #else
    14411     node->setActive(false);
    14412 #endif
     13935    if (parallelMode()>=0) {
     13936      if (!node->nodeInfo()->numberBranchesLeft())
     13937        node->nodeInfo()->allBranchesGone(); // can clean up
     13938      delete node;
     13939      node=NULL;
     13940    } else {
     13941      node->setActive(false);
     13942    }
    1441313943  }
    1441413944  /*
     
    1443413964  if (bestObjective > bestObjective_)
    1443513965    foundSolution=2;
    14436 #ifndef CBC_DETERMINISTIC_THREAD
    14437   if (foundSolution) {
     13966  if (parallelMode()>=0&&foundSolution) {
    1443813967    lockThread();
    1443913968    // might as well mark all including continuous
     
    1445413983    unlockThread();
    1445513984  }
    14456 #endif
    1445713985  return foundSolution;
    1445813986}
     
    1457114099      //assert (cbcobj);
    1457214100      if (cbcobj) {
    14573 #ifdef CBC_DETERMINISTIC_THREAD
    1457414101        CbcObject * object = cbcobj->object();
    1457514102        assert (object);
     
    1458014107          dynamic_cast<CbcObject *> (otherModel->object_[position]);
    1458114108        cbcobj->setOriginalObject(objectNew);
    14582 #else
    14583         abort(); // should not be here
    14584 #endif
    1458514109      }
    1458614110      otherModel->tree_->push(node);
     
    1463414158    cutModifier_ = NULL;
    1463514159    assert (!analyzeResults_);
    14636     threadStruct * stuff = (threadStruct *) mutex_;
     14160    threadStruct * stuff = reinterpret_cast<threadStruct *> (mutex_);
    1463714161    assert (stuff);
    1463814162    //if (stuff)
     
    1465714181 } else if (mode==1) {
    1465814182    lockThread();
    14659     threadStruct * stuff = (threadStruct *) mutex_;
     14183    threadStruct * stuff = reinterpret_cast<threadStruct *> (mutex_);
    1466014184    assert (stuff);
    1466114185    //stateOfSearch_
     
    1471214236      generator->incrementTimeInCutGenerator(generator2->timeInCutGenerator());
    1471314237    }
    14714 #ifndef CBC_DETERMINISTIC_THREAD
    14715     nodeCompare_ = NULL;
    14716 #endif
     14238    if (parallelMode()>=0)
     14239      nodeCompare_ = NULL;
    1471714240    baseModel->maximumDepthActual_ = CoinMax(baseModel->maximumDepthActual_,maximumDepthActual_);
    1471814241    baseModel->numberDJFixed_ += numberDJFixed_;
     
    1472114244    for (i=0;i<3;i++)
    1472214245      baseModel->strongInfo_[i] += strongInfo_[i];
    14723 #ifndef CBC_DETERMINISTIC_THREAD
    14724     walkback_ = NULL;
     14246    if (parallelMode()>=0) {
     14247      walkback_ = NULL;
    1472514248#ifdef NODE_LAST
    14726     lastNodeInfo_ = NULL;
    14727     lastNumberCuts_ = NULL;
    14728     lastCut_ = NULL;
    14729 #endif
    14730     //addedCuts_ = NULL;
    14731     tree_ = NULL;
    14732 #else
    14733     //threadStruct * stuff = (threadStruct *) mutex_;
    14734     //assert (stuff);
    14735     //delete [] stuff->nodeCount;
    14736 #endif
     14249      lastNodeInfo_ = NULL;
     14250      lastNumberCuts_ = NULL;
     14251      lastCut_ = NULL;
     14252#endif
     14253      //addedCuts_ = NULL;
     14254      tree_ = NULL;
     14255    }
    1473714256    eventHandler_=NULL;
    1473814257    delete solverCharacteristics_;
    1473914258    solverCharacteristics_ = NULL;
    14740     //#ifndef CBC_DETERMINISTIC_THREAD
    1474114259    bool newMethod = (baseModel->branchingMethod_&&baseModel->branchingMethod_->chooseMethod());
    1474214260    if (newMethod) {
     
    1474514263      object_=NULL;
    1474614264    }
    14747     //#endif
    1474814265  } else if (mode==-1) {
    1474914266    delete eventHandler_;
     
    1475414271    solverCharacteristics_->setSolver(solver_);
    1475514272    setMaximumNodes(COIN_INT_MAX);
    14756 #ifndef CBC_DETERMINISTIC_THREAD
    14757     delete [] walkback_;
    14758     //delete [] addedCuts_;
    14759     walkback_ = NULL;
    14760     //addedCuts_ = NULL;
     14273    if (parallelMode()>=0) {
     14274      delete [] walkback_;
     14275      //delete [] addedCuts_;
     14276      walkback_ = NULL;
     14277      //addedCuts_ = NULL;
    1476114278#ifdef NODE_LAST
    14762     delete [] lastNodeInfo_ ;
    14763     lastNodeInfo_ = NULL;
    14764     delete [] lastNumberCuts_ ;
    14765     lastNumberCuts_ = NULL;
    14766     delete [] lastCut_ ;
    14767     lastCut_ = NULL;
    14768 #endif
    14769     delete tree_;
    14770     tree_ = NULL;
    14771     delete nodeCompare_;
    14772     nodeCompare_ = NULL;
    14773 #else
    14774     delete tree_;
    14775     tree_ = new CbcTree();
    14776     tree_->setComparison(*nodeCompare_) ;
    14777 #endif
     14279      delete [] lastNodeInfo_ ;
     14280      lastNodeInfo_ = NULL;
     14281      delete [] lastNumberCuts_ ;
     14282      lastNumberCuts_ = NULL;
     14283      delete [] lastCut_ ;
     14284      lastCut_ = NULL;
     14285#endif
     14286      delete tree_;
     14287      tree_ = NULL;
     14288      delete nodeCompare_;
     14289      nodeCompare_ = NULL;
     14290    } else {
     14291      delete tree_;
     14292      tree_ = new CbcTree();
     14293      tree_->setComparison(*nodeCompare_) ;
     14294    }
    1477814295    continuousSolver_ = baseModel->continuousSolver_->clone();
    1477914296    bool newMethod = (baseModel->branchingMethod_&&baseModel->branchingMethod_->chooseMethod());
     
    1478214299      // We may update an object in wrong order - shouldn't matter?
    1478314300      numberObjects_=baseModel->numberObjects_;
    14784 #ifndef CBC_DETERMINISTIC_THREAD
    14785       object_=baseModel->object_;
    14786 #else
    14787       printf("*****WARNING - fix testosi option\n");
    14788       object_=baseModel->object_;
    14789 #endif
     14301      if (parallelMode()>=0) {
     14302        object_=baseModel->object_;
     14303      } else {
     14304        printf("*****WARNING - fix testosi option\n");
     14305        object_=baseModel->object_;
     14306      }
    1479014307    }
    1479114308    mutex_ = baseModel->mutex_;
     
    1482414341    cutModifier_ = NULL;
    1482514342    assert (!analyzeResults_);
    14826     threadStruct * stuff = (threadStruct *) mutex_;
     14343    threadStruct * stuff = reinterpret_cast<threadStruct *> (mutex_);
    1482714344    assert (stuff);
    1482814345    //if (stuff)
     
    1484014357    //stuff->nodeCount = new int [baseModel->maximumDepth_+1];
    1484114358  } else if (mode==11) {
    14842 #ifdef CBC_DETERMINISTIC_THREAD
    14843     // from deterministic
    14844     threadStruct * stuff = (threadStruct *) mutex_;
    14845     assert (stuff);
    14846     // Move solution etc
    14847     // might as well mark all including continuous
    14848     int numberColumns = solver_->getNumCols();
    14849     for (int i=0;i<numberColumns;i++) {
    14850       baseModel->usedInSolution_[i] += usedInSolution_[i];
    14851       //usedInSolution_[i]=0;
    14852     }
    14853     baseModel->numberSolutions_ += numberSolutions_;
    14854     if (bestObjective_ < baseModel->bestObjective_&&bestObjective_<baseModel->getCutoff()) {
    14855       baseModel->bestObjective_ = bestObjective_ ;
     14359    if (parallelMode()<0) {
     14360      // from deterministic
     14361      threadStruct * stuff = reinterpret_cast<threadStruct *> (mutex_);
     14362      assert (stuff);
     14363      // Move solution etc
     14364      // might as well mark all including continuous
    1485614365      int numberColumns = solver_->getNumCols();
    14857       if (!baseModel->bestSolution_)
    14858         baseModel->bestSolution_ = new double[numberColumns];
    14859       CoinCopyN(bestSolution_,numberColumns,baseModel->bestSolution_);
    14860       baseModel->setCutoff(getCutoff());
    14861     }
    14862     //stateOfSearch_
     14366      for (int i=0;i<numberColumns;i++) {
     14367        baseModel->usedInSolution_[i] += usedInSolution_[i];
     14368        //usedInSolution_[i]=0;
     14369      }
     14370      baseModel->numberSolutions_ += numberSolutions_;
     14371      if (bestObjective_ < baseModel->bestObjective_&&bestObjective_<baseModel->getCutoff()) {
     14372        baseModel->bestObjective_ = bestObjective_ ;
     14373        int numberColumns = solver_->getNumCols();
     14374        if (!baseModel->bestSolution_)
     14375          baseModel->bestSolution_ = new double[numberColumns];
     14376        CoinCopyN(bestSolution_,numberColumns,baseModel->bestSolution_);
     14377        baseModel->setCutoff(getCutoff());
     14378      }
     14379      //stateOfSearch_
    1486314380#if 1
    14864     if(stuff->saveStuff[0]!=searchStrategy_) {
     14381      if(stuff->saveStuff[0]!=searchStrategy_) {
    1486514382#ifdef COIN_DEVELOP
    14866       printf("changing searchStrategy from %d to %d\n",
    14867              baseModel->searchStrategy_,searchStrategy_);
    14868 #endif
    14869       baseModel->searchStrategy_=searchStrategy_;
    14870     }
    14871     if(stuff->saveStuff[1]!=stateOfSearch_) {
     14383        printf("changing searchStrategy from %d to %d\n",
     14384               baseModel->searchStrategy_,searchStrategy_);
     14385#endif
     14386        baseModel->searchStrategy_=searchStrategy_;
     14387      }
     14388      if(stuff->saveStuff[1]!=stateOfSearch_) {
    1487214389#ifdef COIN_DEVELOP
    14873       printf("changing stateOfSearch from %d to %d\n",
    14874              baseModel->stateOfSearch_,stateOfSearch_);
    14875 #endif
    14876       baseModel->stateOfSearch_=stateOfSearch_;
    14877     }
    14878 #endif
    14879     int i;
    14880     if (eventHappened_)
    14881       baseModel->eventHappened_=true;
    14882     baseModel->numberNodes_ += stuff->nodesThisTime;
    14883     baseModel->numberIterations_ += stuff->iterationsThisTime;
    14884     double cutoff = baseModel->getCutoff();
    14885     while (!tree_->empty()) {
    14886       CbcNode * node = tree_->bestNode(COIN_DBL_MAX) ;
    14887       if (node->objectiveValue()<cutoff) {
    14888         CbcNodeInfo * nodeInfo = node->nodeInfo();
    14889         assert (nodeInfo);
    14890         // Make node join correctly
    14891         OsiBranchingObject * bobj = node->modifiableBranchingObject();
    14892         CbcBranchingObject * cbcobj = dynamic_cast<CbcBranchingObject *> (bobj);
    14893         if (cbcobj) {
    14894 #ifdef CBC_DETERMINISTIC_THREAD
    14895           CbcObject * object = cbcobj->object();
    14896           assert (object);
    14897           int position = object->position();
    14898           assert (position>=0);
    14899           assert (object_[position]==object);
    14900           CbcObject * objectNew =
    14901             dynamic_cast<CbcObject *> (baseModel->object_[position]);
    14902           cbcobj->setOriginalObject(objectNew);
    14903 #else
    14904           abort(); // should not be here
    14905 #endif
    14906         }
    14907         baseModel->tree_->push(node);
    14908       } else {
    14909         delete node;
    14910       }
    14911     }
    14912     for (i=0;i<stuff->nDeleteNode;i++) {
    14913       //printf("CbcNode %x stuff delete\n",stuff->delNode[i]);
    14914       delete stuff->delNode[i];
    14915     }
    14916 #endif
     14390        printf("changing stateOfSearch from %d to %d\n",
     14391               baseModel->stateOfSearch_,stateOfSearch_);
     14392#endif
     14393        baseModel->stateOfSearch_=stateOfSearch_;
     14394      }
     14395#endif
     14396      int i;
     14397      if (eventHappened_)
     14398        baseModel->eventHappened_=true;
     14399      baseModel->numberNodes_ += stuff->nodesThisTime;
     14400      baseModel->numberIterations_ += stuff->iterationsThisTime;
     14401      double cutoff = baseModel->getCutoff();
     14402      while (!tree_->empty()) {
     14403        CbcNode * node = tree_->bestNode(COIN_DBL_MAX) ;
     14404        if (node->objectiveValue()<cutoff) {
     14405          assert(node->nodeInfo());
     14406          // Make node join correctly
     14407          OsiBranchingObject * bobj = node->modifiableBranchingObject();
     14408          CbcBranchingObject * cbcobj = dynamic_cast<CbcBranchingObject *> (bobj);
     14409          if (cbcobj) {
     14410            CbcObject * object = cbcobj->object();
     14411            assert (object);
     14412            int position = object->position();
     14413            assert (position>=0);
     14414            assert (object_[position]==object);
     14415            CbcObject * objectNew =
     14416              dynamic_cast<CbcObject *> (baseModel->object_[position]);
     14417            cbcobj->setOriginalObject(objectNew);
     14418          }
     14419          baseModel->tree_->push(node);
     14420        } else {
     14421          delete node;
     14422        }
     14423      }
     14424      for (i=0;i<stuff->nDeleteNode;i++) {
     14425        //printf("CbcNode %x stuff delete\n",stuff->delNode[i]);
     14426        delete stuff->delNode[i];
     14427      }
     14428    }
    1491714429  } else {
    1491814430    abort();
     
    1492214434static void * doNodesThread(void * voidInfo)
    1492314435{
    14924   threadStruct * stuff = (threadStruct *) voidInfo;
     14436  threadStruct * stuff = reinterpret_cast<threadStruct *> (voidInfo);
    1492514437  pthread_mutex_t * mutex = stuff->mutex2;
    1492614438  pthread_cond_t * condition = stuff->condition2;
     
    1494714459      double time2 = CoinCpuTime();
    1494814460      assert (stuff->returnCode==0);
    14949 #ifndef CBC_DETERMINISTIC_THREAD
    14950       assert (stuff->node->nodeInfo());
    14951       thisModel->doOneNode(baseModel,stuff->node,stuff->createdNode);
    14952       stuff->returnCode=1;
    14953 #else
    14954       assert (!stuff->node);
    14955       assert (!stuff->createdNode);
    14956       int numberIterations = stuff->nDeleteNode;
    14957       int nDeleteNode = 0;
    14958       int maxDeleteNode = stuff->maxDeleteNode;
    14959       CbcNode ** delNode = stuff->delNode;
    14960       int returnCode=1;
    14961       // this should be updated by heuristics strong branching etc etc
    14962       assert (numberIterations>0);
    14963       thisModel->setNumberThreads(0);
    14964       int nodesThisTime=thisModel->getNodeCount();
    14965       int iterationsThisTime=thisModel->getIterationCount();
    14966       thisModel->setStopNumberIterations(thisModel->getIterationCount()+numberIterations);
    14967       int numberColumns = thisModel->getNumCols();
    14968       int * used = CoinCopyOfArray(thisModel->usedInSolution(),numberColumns);
    14969       int numberSolutions = thisModel->getSolutionCount();
    14970       while (true) {
    14971         if (thisModel->tree()->empty()) {
    14972           returnCode=1+1;
    14973           break;
    14974         }
    14975         if (thisModel->getIterationCount()>thisModel->getStopNumberIterations()) {
    14976           // out of loop
    14977           //printf("out of loop\n");
    14978           break;
    14979         }
    14980         double cutoff = thisModel->getCutoff() ;
    14981         CbcNode *node = thisModel->tree()->bestNode(cutoff) ;
    14982         // Possible one on tree worse than cutoff
    14983         if (!node)
    14984           continue;
    14985         CbcNode * createdNode=NULL;
     14461      if (thisModel->parallelMode()>=0) {
     14462        assert (stuff->node->nodeInfo());
     14463        thisModel->doOneNode(baseModel,stuff->node,stuff->createdNode);
     14464        stuff->returnCode=1;
     14465      } else {
     14466        assert (!stuff->node);
     14467        assert (!stuff->createdNode);
     14468        int numberIterations = stuff->nDeleteNode;
     14469        int nDeleteNode = 0;
     14470        int maxDeleteNode = stuff->maxDeleteNode;
     14471        CbcNode ** delNode = stuff->delNode;
     14472        int returnCode=1;
     14473        // this should be updated by heuristics strong branching etc etc
     14474        assert (numberIterations>0);
     14475        thisModel->setNumberThreads(0);
     14476        int nodesThisTime=thisModel->getNodeCount();
     14477        int iterationsThisTime=thisModel->getIterationCount();
     14478        thisModel->setStopNumberIterations(thisModel->getIterationCount()+numberIterations);
     14479        int numberColumns = thisModel->getNumCols();
     14480        int * used = CoinCopyOfArray(thisModel->usedInSolution(),numberColumns);
     14481        int numberSolutions = thisModel->getSolutionCount();
     14482        while (true) {
     14483          if (thisModel->tree()->empty()) {
     14484            returnCode=1+1;
     14485            break;
     14486          }
     14487          if (thisModel->getIterationCount()>thisModel->getStopNumberIterations()) {
     14488            // out of loop
     14489            //printf("out of loop\n");
     14490            break;
     14491          }
     14492          double cutoff = thisModel->getCutoff() ;
     14493          CbcNode *node = thisModel->tree()->bestNode(cutoff) ;
     14494          // Possible one on tree worse than cutoff
     14495          if (!node)
     14496            continue;
     14497          CbcNode * createdNode=NULL;
    1498614498#if 0
    14987         nXXXXXX++;
    14988         if (nXXXXXX==66)
    14989           printf("next one %d\n",nXXXXXX);
    14990         else
    14991           printf("xxxx %d\n",nXXXXXX);
    14992 #endif
    14993         // Do real work of node
    14994         thisModel->doOneNode(NULL,node,createdNode);
     14499          nXXXXXX++;
     14500          if (nXXXXXX==66)
     14501            printf("next one %d\n",nXXXXXX);
     14502          else
     14503            printf("xxxx %d\n",nXXXXXX);
     14504#endif
     14505          // Do real work of node
     14506          thisModel->doOneNode(NULL,node,createdNode);
    1499514507#if CBC_THREAD_DEBUG
    14996         //printf("SThread %d node %d\n",stuff->threadNumber,thisModel->getNodeCount());
    14997         //node->print();
    14998         //createdNode->print();
    14999         //printf("EThread %d node %d\n",stuff->threadNumber,thisModel->getNodeCount());
    15000 #endif
    15001         assert (createdNode);
    15002         if (!createdNode->active()) {
    15003           delete createdNode;
    15004         } else {
    15005           // Say one more pointing to this **** postpone if marked
    15006           node->nodeInfo()->increment() ;
    15007           thisModel->tree()->push(createdNode) ;
    15008         }
    15009         if (node->active()) {
    15010           assert (node->nodeInfo());
    15011           if (node->nodeInfo()->numberBranchesLeft()) {
    15012             thisModel->tree()->push(node) ;
     14508          //printf("SThread %d node %d\n",stuff->threadNumber,thisModel->getNodeCount());
     14509          //node->print();
     14510          //createdNode->print();
     14511          //printf("EThread %d node %d\n",stuff->threadNumber,thisModel->getNodeCount());
     14512#endif
     14513          assert (createdNode);
     14514          if (!createdNode->active()) {
     14515            delete createdNode;
    1501314516          } else {
    15014             node->setActive(false);
     14517            // Say one more pointing to this **** postpone if marked
     14518            node->nodeInfo()->increment() ;
     14519            thisModel->tree()->push(createdNode) ;
    1501514520          }
    15016         } else {
    15017           if (node->nodeInfo()) {
    15018             if (!node->nodeInfo()->numberBranchesLeft())
    15019               node->nodeInfo()->allBranchesGone(); // can clean up
    15020             // So will delete underlying stuff
    15021             node->setActive(true);
     14521          if (node->active()) {
     14522            assert (node->nodeInfo());
     14523            if (node->nodeInfo()->numberBranchesLeft()) {
     14524              thisModel->tree()->push(node) ;
     14525            } else {
     14526              node->setActive(false);
     14527            }
     14528          } else {
     14529            if (node->nodeInfo()) {
     14530              if (!node->nodeInfo()->numberBranchesLeft())
     14531                node->nodeInfo()->allBranchesGone(); // can clean up
     14532              // So will delete underlying stuff
     14533              node->setActive(true);
     14534            }
     14535            if (nDeleteNode==maxDeleteNode) {
     14536              maxDeleteNode = (3*maxDeleteNode)/2+10;
     14537              stuff->maxDeleteNode=maxDeleteNode;
     14538              stuff->delNode = new CbcNode * [maxDeleteNode];
     14539              for (int i=0;i<nDeleteNode;i++)
     14540                stuff->delNode[i] = delNode[i];
     14541              delete [] delNode;
     14542              delNode = stuff->delNode;
     14543            }
     14544            delNode[nDeleteNode++]=node;
    1502214545          }
    15023           if (nDeleteNode==maxDeleteNode) {
    15024             maxDeleteNode = (3*maxDeleteNode)/2+10;
    15025             stuff->maxDeleteNode=maxDeleteNode;
    15026             stuff->delNode = new CbcNode * [maxDeleteNode];
    15027             for (int i=0;i<nDeleteNode;i++)
    15028               stuff->delNode[i] = delNode[i];
    15029             delete [] delNode;
    15030             delNode = stuff->delNode;
    15031           }
    15032           delNode[nDeleteNode++]=node;
    15033         }
    15034       }
    15035       // end of this sub-tree
    15036       int * usedA = thisModel->usedInSolution();
    15037       for (int i=0;i<numberColumns;i++) {
    15038         usedA[i] -= used[i];
    15039       }
    15040       delete [] used;
    15041       thisModel->setSolutionCount(thisModel->getSolutionCount()-numberSolutions);
    15042       stuff->nodesThisTime=thisModel->getNodeCount()-nodesThisTime;
    15043       stuff->iterationsThisTime=thisModel->getIterationCount()-iterationsThisTime;
    15044       stuff->nDeleteNode=nDeleteNode;
    15045       stuff->returnCode=returnCode;
    15046       thisModel->setNumberThreads(mode);
    15047 #endif
     14546        }
     14547        // end of this sub-tree
     14548        int * usedA = thisModel->usedInSolution();
     14549        for (int i=0;i<numberColumns;i++) {
     14550          usedA[i] -= used[i];
     14551        }
     14552        delete [] used;
     14553        thisModel->setSolutionCount(thisModel->getSolutionCount()-numberSolutions);
     14554        stuff->nodesThisTime=thisModel->getNodeCount()-nodesThisTime;
     14555        stuff->iterationsThisTime=thisModel->getIterationCount()-iterationsThisTime;
     14556        stuff->nDeleteNode=nDeleteNode;
     14557        stuff->returnCode=returnCode;
     14558        thisModel->setNumberThreads(mode);
     14559      }
    1504814560      //printf("end node %x\n",stuff->node);
    15049       threadStruct * stuffMain = (threadStruct *) baseModel->mutex();
     14561      threadStruct * stuffMain = reinterpret_cast<threadStruct *> (baseModel->mutex());
    1505014562      //pthread_mutex_t * condition_mutex = stuffMain->mutex2;
    1505114563      pthread_cond_t * condition_main = stuffMain->condition2;
     
    1506414576static void * doCutsThread(void * voidInfo)
    1506514577{
    15066   threadStruct * stuff = (threadStruct *) voidInfo;
     14578  threadStruct * stuff = reinterpret_cast<threadStruct *> (voidInfo);
    1506714579  pthread_mutex_t * mutex = stuff->mutex2;
    1506814580  pthread_cond_t * condition = stuff->condition2;
     
    1508114593      int fullScan = thisModel->getNodeCount()==0 ? 1 : 0; //? was >0
    1508214594      CbcCutGenerator * generator = thisModel->cutGenerator(0);
    15083       OsiCuts * cuts = (OsiCuts *) thisModel->objects();
     14595      OsiCuts * cuts = reinterpret_cast<OsiCuts *> (thisModel->objects());
    1508414596      OsiSolverInterface * thisSolver = thisModel->solver();
    1508514597      generator->generateCuts(*cuts,fullScan,thisSolver,NULL);
    1508614598      stuff->returnCode=1;
    1508714599      //printf("end node %x\n",stuff->node);
    15088       threadStruct * stuffMain = (threadStruct *) baseModel->mutex();
     14600      threadStruct * stuffMain = reinterpret_cast<threadStruct *> (baseModel->mutex());
    1508914601      //pthread_mutex_t * condition_mutex = stuffMain->mutex2;
    1509014602      pthread_cond_t * condition_main = stuffMain->condition2;
     
    1512514637CbcModel::lockThread()
    1512614638{
    15127   threadStruct * stuff = (threadStruct *) mutex_;
     14639  threadStruct * stuff = reinterpret_cast<threadStruct *> (mutex_);
    1512814640  if (stuff) {
    1512914641    if(!stuff->locked) {
     
    1518414696CbcModel::unlockThread()
    1518514697{
    15186   threadStruct * stuff = (threadStruct *) mutex_;
     14698  threadStruct * stuff = reinterpret_cast<threadStruct *> (mutex_);
    1518714699  if (stuff) {
    1518814700    if(stuff->locked) {
     
    1523014742{
    1523114743#ifdef CBC_THREAD
    15232   threadStruct * stuff = (threadStruct *) mutex_;
     14744  threadStruct * stuff = reinterpret_cast<threadStruct *> (mutex_);
    1523314745  if (stuff) {
    1523414746    return (stuff->locked);
     
    1536414876                          int * numberUpInfeasible) const
    1536514877{
    15366   CoinZeroN(downCosts,numberIntegers_);
    15367   CoinZeroN(upCosts,numberIntegers_);
    15368   if (!allDynamic())
    15369     return; // Odd problem
     14878  CoinFillN(downCosts,numberIntegers_,1.0);
     14879  CoinFillN(upCosts,numberIntegers_,1.0);
     14880  if (numberDown) {
     14881    CoinFillN(numberDown,numberIntegers_,1);
     14882    CoinFillN(numberUp,numberIntegers_,1);
     14883  }
     14884  if (numberDownInfeasible) {
     14885    CoinZeroN(numberDownInfeasible,numberIntegers_);
     14886    CoinZeroN(numberUpInfeasible,numberIntegers_);
     14887  }
    1537014888  int numberColumns = getNumCols();
    1537114889  int * back = new int[numberColumns];
     
    1537814896    CbcSimpleIntegerDynamicPseudoCost * obj =
    1537914897      dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(object_[i]) ;
    15380     assert (obj);
     14898    if (!obj)
     14899      continue;
    1538114900    int iColumn = obj->columnNumber();
    1538214901    iColumn = back[iColumn];
  • trunk/Cbc/src/CbcModel.hpp

    r1112 r1121  
    11981198  /** Set thread mode
    11991199      always use numberThreads for branching
    1200       1 set then use numberThreads in root mini branch and bound
     1200      1 set then deterministic
    12011201      2 set then use numberThreads for root cuts
     1202      4 set then use numberThreads in root mini branch and bound
    12021203      default is 0
    12031204  */
    12041205  inline void setThreadMode(int value)
    12051206  { threadMode_=value;}
     1207  /** Return
     1208      -2 if deterministic threaded and main thread
     1209      -1 if deterministic threaded and serial thread
     1210      0 if serial
     1211      1 if opportunistic threaded
     1212  */
     1213  inline int parallelMode() const
     1214  { if (!numberThreads_) {
     1215      if ((threadMode_&1)==0)
     1216        return 0;
     1217      else
     1218        return -1;
     1219      return 0;
     1220    } else {
     1221      if ((threadMode_&1)==0)
     1222        return 1;
     1223      else
     1224        return -2;
     1225    }
     1226  }
    12061227  /// Get number of "iterations" to stop after
    12071228  inline int getStopNumberIterations() const
     
    16341655  */
    16351656  int reducedCostFix() ;
     1657  /** Makes all handlers same.  If makeDefault 1 then makes top level
     1658      default and rest point to that.  If 2 then each is copy
     1659  */
     1660  void synchronizeHandlers(int makeDefault);
     1661     
    16361662  /// Encapsulates solver resolve
    16371663  int resolve(OsiSolverInterface * solver);
     
    19731999  */
    19742000  CbcNodeInfo ** walkback_;
    1975   //#define CBC_DETERMINISTIC_THREAD
    1976 #ifndef CBC_DETERMINISTIC_THREAD
    19772001#define NODE_LAST
    1978 #endif
    19792002#ifdef NODE_LAST
    19802003  CbcNodeInfo ** lastNodeInfo_;
     
    22392262  /** thread mode
    22402263      always use numberThreads for branching
    2241       1 set then use numberThreads in root mini branch and bound
     2264      1 set then deterministic
    22422265      2 set then use numberThreads for root cuts
     2266      4 set then use numberThreads in root mini branch and bound
    22432267      default is 0
    22442268  */
  • trunk/Cbc/src/CbcNode.cpp

    r1088 r1121  
    330330void
    331331CbcNodeInfo::addCuts (OsiCuts & cuts, int numberToBranchOn,
    332                       int * whichGenerator)
     332                      int * whichGenerator,int numberPointingToThis)
    333333{
    334334  int numberCuts = cuts.sizeRowCuts();
     
    345345    for (i=0;i<numberCuts;i++) {
    346346      CbcCountRowCut * thisCut = new CbcCountRowCut(*cuts.rowCutPtr(i),
    347                                                     this,numberCuts_);
     347                                                    this,numberCuts_,
     348                                                    -1,numberPointingToThis);
    348349      thisCut->increment(numberToBranchOn);
    349350      cuts_[numberCuts_++] = thisCut;
     
    642643{
    643644  const unsigned int * saved =
    644     (const unsigned int *) basis_->getArtificialStatus();
     645    reinterpret_cast<const unsigned int *> (basis_->getArtificialStatus());
    645646  unsigned int * now =
    646     (unsigned int *) basis.getArtificialStatus();
     647    reinterpret_cast<unsigned int *> (basis.getArtificialStatus());
    647648  int number=basis_->getNumArtificial()>>4;;
    648649  int i;
     
    682683  int size = numberChangedBounds_*(sizeof(double)+sizeof(int));
    683684  char * temp = new char [size];
    684   newBounds_ = (double *) temp;
    685   variables_ = (int *) (newBounds_+numberChangedBounds_);
     685  newBounds_ = reinterpret_cast<double *> (temp);
     686  variables_ = reinterpret_cast<int *> (newBounds_+numberChangedBounds_);
    686687
    687688  int i ;
     
    704705  int size = numberChangedBounds_*(sizeof(double)+sizeof(int));
    705706  char * temp = new char [size];
    706   newBounds_ = (double *) temp;
    707   variables_ = (int *) (newBounds_+numberChangedBounds_);
     707  newBounds_ = reinterpret_cast<double *> (temp);
     708  variables_ = reinterpret_cast<int *> (newBounds_+numberChangedBounds_);
    708709
    709710  int i ;
     
    854855    int size = (numberChangedBounds_+nAdd)*(sizeof(double)+sizeof(int));
    855856    char * temp = new char [size];
    856     double * newBounds = (double *) temp;
    857     int * variables = (int *) (newBounds+numberChangedBounds_+nAdd);
     857    double * newBounds = reinterpret_cast<double *> (temp);
     858    int * variables = reinterpret_cast<int *> (newBounds+numberChangedBounds_+nAdd);
    858859
    859860    int i ;
     
    17361737        int * whichColumn = new int[2*numberColumns];
    17371738        int nBound;
    1738         ClpSimplex * small = ((ClpSimplexOther *) clp)->crunch(rhs,whichRow,whichColumn,nBound,true);
     1739        ClpSimplex * small = static_cast<ClpSimplexOther *> (clp)->crunch(rhs,whichRow,whichColumn,nBound,true);
    17391740        if (!small) {
    17401741          anyAction=-2;
     
    17791780          int iObject = choice[i].objectNumber;
    17801781          const OsiObject * object = model->object(iObject);
    1781           const CbcSimpleInteger * simple = dynamic_cast <const CbcSimpleInteger *> (object);
     1782          const CbcSimpleInteger * simple = static_cast <const CbcSimpleInteger *> (object);
    17821783          int iSequence = simple->columnNumber();
    17831784          newLower[i]= ceil(saveSolution[iSequence]);
     
    18141815            int iObject = choice[i].objectNumber;
    18151816            const OsiObject * object = model->object(iObject);
    1816             const CbcSimpleInteger * simple = dynamic_cast <const CbcSimpleInteger *> (object);
     1817            const CbcSimpleInteger * simple = static_cast <const CbcSimpleInteger *> (object);
    18171818            int iSequence = simple->columnNumber();
    18181819            which[i]=iSequence;
     
    24122413    for (int i=0;i<numberRows;i++)
    24132414      sumPi += fabs(pi[i]);
    2414     sumPi /= ((double) numberRows);
     2415    sumPi /= static_cast<double> (numberRows);
    24152416    // and scale back
    24162417    sumPi *= 0.01;
     
    25132514    for ( i=0;i<numberObjects;i++) {
    25142515      OsiObject * object = model->modifiableObject(i);
     2516#ifndef NDEBUG
    25152517      CbcSimpleIntegerDynamicPseudoCost * dynamicObject =
    25162518        dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
    25172519      assert(dynamicObject);
     2520#else
     2521      CbcSimpleIntegerDynamicPseudoCost * dynamicObject =
     2522        static_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
     2523#endif
    25182524      int  numberUp2=0;
    25192525      int numberDown2=0;
     
    25372543    }
    25382544    if (numberUp)
    2539       averageUp /= (double) numberUp;
     2545      averageUp /= static_cast<double> (numberUp);
    25402546    else
    25412547      averageUp=1.0;
    25422548    if (numberDown)
    2543       averageDown /= (double) numberDown;
     2549      averageDown /= static_cast<double> (numberDown);
    25442550    else
    25452551      averageDown=1.0;
     
    26132619      }
    26142620      if (numberUp)
    2615         averageUp /= (double) numberUp;
     2621        averageUp /= static_cast<double> (numberUp);
    26162622      else
    26172623        averageUp=1.0;
    26182624      if (numberDown)
    2619         averageDown /= (double) numberDown;
     2625        averageDown /= static_cast<double> (numberDown);
    26202626      else
    26212627        averageDown=1.0;
     
    33693375          OsiObject * object = model->modifiableObject(iObject);
    33703376          CbcSimpleIntegerDynamicPseudoCost * dynamicObject =
    3371             dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
     3377            static_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
    33723378          int iSequence=dynamicObject->columnNumber();
    33733379          double value = saveSolution[iSequence];
     
    36363642        OsiObject * object = model->modifiableObject(iObject);
    36373643        CbcSimpleIntegerDynamicPseudoCost * dynamicObject =
    3638           dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
     3644          static_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
    36393645        int iColumn = dynamicObject ? dynamicObject->columnNumber() : numberColumns+iObject;
    36403646        int preferredWay;
     
    43224328        }
    43234329      }
    4324       double averageChange = model->sumChangeObjective()/((double) model->getNodeCount());
     4330      double averageChange = model->sumChangeObjective()/
     4331        static_cast<double> (model->getNodeCount());
    43254332      if (depth_<10||worstFeasible>0.2*averageChange)
    43264333        solveAll=false;
     
    47064713    OsiObject * object = model->modifiableObject(iObject);
    47074714    CbcSimpleIntegerDynamicPseudoCost * dynamicObject =
    4708       dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
     4715      static_cast <CbcSimpleIntegerDynamicPseudoCost *>(object) ;
    47094716    int iColumn = dynamicObject->columnNumber();
    47104717    int preferredWay;
  • trunk/Cbc/src/CbcNode.hpp

    r1087 r1121  
    177177  { parent_=NULL;}
    178178
    179   void addCuts(OsiCuts & cuts,int numberToBranch, int * whichGenerator);
     179  void addCuts(OsiCuts & cuts,int numberToBranch, int * whichGenerator
     180               ,int numberPointingToThis);
    180181  void addCuts(int numberCuts, CbcCountRowCut ** cuts,int numberToBranch);
    181182  /** Delete cuts (decrements counts)
  • trunk/Cbc/src/CbcSolver.cpp

    r1112 r1121  
    153153#include "CglLandP.hpp"
    154154#include "CglResidualCapacity.hpp"
     155#ifdef ZERO_HALF_CUTS
     156#include "CglZeroHalf.hpp"
     157#endif
    155158
    156159#include "CbcModel.hpp"
     
    175178#include  "CbcCutGenerator.hpp"
    176179#include  "CbcStrategy.hpp"
    177 #include "CbcBranchLotsize.hpp"
     180#include "CbcBranchCut.hpp"
    178181
    179182#include "OsiClpSolverInterface.hpp"
     
    488491  // Set up likely cut generators and defaults
    489492  parameters_[whichParam(PREPROCESS,numberParameters_,parameters_)].setCurrentOption("sos");
    490   parameters_[whichParam(MIPOPTIONS,numberParameters_,parameters_)].setIntValue(128|64|1);
    491493  parameters_[whichParam(MIPOPTIONS,numberParameters_,parameters_)].setIntValue(1025);
    492494  parameters_[whichParam(CUTPASSINTREE,numberParameters_,parameters_)].setIntValue(1);
     
    499501  parameters_[whichParam(PROBINGCUTS,numberParameters_,parameters_)].setCurrentOption("ifmove");
    500502  parameters_[whichParam(KNAPSACKCUTS,numberParameters_,parameters_)].setCurrentOption("ifmove");
     503  parameters_[whichParam(ZEROHALFCUTS,numberParameters_,parameters_)].setCurrentOption("off");
    501504  parameters_[whichParam(REDSPLITCUTS,numberParameters_,parameters_)].setCurrentOption("off");
    502505  parameters_[whichParam(CLIQUECUTS,numberParameters_,parameters_)].setCurrentOption("ifmove");
     
    11691172  int * whichColumn = new int[2*numberColumns];
    11701173  int nBound;
    1171   ClpSimplex * small = ((ClpSimplexOther *) model)->crunch(rhs,whichRow,whichColumn,
     1174  ClpSimplex * small = static_cast<ClpSimplexOther *> (model)->crunch(rhs,whichRow,whichColumn,
    11721175                                                               nBound,false,false);
    11731176  if (small) {
     
    11751178    if (small->problemStatus()==0) {
    11761179      model->setProblemStatus(0);
    1177       ((ClpSimplexOther *) model)->afterCrunch(*small,whichRow,whichColumn,nBound);
     1180      static_cast<ClpSimplexOther *> (model)->afterCrunch(*small,whichRow,whichColumn,nBound);
    11781181    } else if (small->problemStatus()!=3) {
    11791182      model->setProblemStatus(1);
     
    16571660    for (int jLayer=0;jLayer<kLayer;jLayer++) {
    16581661      int check[]={-1,0,1,2,3,4,5,10,50,100,500,1000,5000,10000,COIN_INT_MAX};
    1659       int nCheck = (int) (sizeof(check)/sizeof(int));
     1662      int nCheck = static_cast<int> (sizeof(check)/sizeof(int));
    16601663      int countsI[20];
    16611664      int countsC[20];
     
    17821785              if (clpSolver->isInteger(iColumn)) {
    17831786                double value = lastSolution[iColumn];
    1784                 int iValue = (int) (value+0.5);
    1785                 assert (fabs(value-((double) iValue))<1.0e-3);
     1787                int iValue = static_cast<int> (value+0.5);
     1788                assert (fabs(value-static_cast<double> (iValue))<1.0e-3);
    17861789                assert (iValue>=columnLower[iColumn]&&
    17871790                        iValue<=columnUpper[iColumn]);
     
    17991802            if (clpSolver->isInteger(iColumn)) {
    18001803              double value = lastSolution[iColumn];
    1801               int iValue = (int) (value+0.5);
    1802               assert (fabs(value-((double) iValue))<1.0e-3);
     1804              int iValue = static_cast<int> (value+0.5);
     1805              assert (fabs(value-static_cast<double> (iValue))<1.0e-3);
    18031806              assert (iValue>=columnLower[iColumn]&&
    18041807                      iValue<=columnUpper[iColumn]);
     
    21602163      }
    21612164      printf("This fixes %d variables in lower priorities - total %d (%d integer) - all target %d, int target %d\n",
    2162              nTotalFixed,nFixed,nFixedI,(int)(fractionFixed*numberColumns),(int) (fractionIntFixed*numberInteger));
     2165             nTotalFixed,nFixed,nFixedI,static_cast<int>(fractionFixed*numberColumns),static_cast<int> (fractionIntFixed*numberInteger));
    21632166      int nBad=0;
    21642167      int nRelax=0;
     
    27452748  }
    27462749}
    2747 #ifdef COIN_HAS_ASL
    2748 #define AFTER_KNAPSACK
    2749 #elif NEW_STYLE_SOLVER
    2750 #define AFTER_KNAPSACK
    2751 #endif
    2752 #ifdef AFTER_KNAPSACK
     2750#if NEW_STYLE_SOLVER
    27532751// Fills in original solution (coinModel length)
    27542752static void
     
    31993197  // Set up likely cut generators and defaults
    32003198  parameters[whichParam(PREPROCESS,numberParameters,parameters)].setCurrentOption("sos");
    3201   parameters[whichParam(MIPOPTIONS,numberParameters,parameters)].setIntValue(128|64|1);
    32023199  parameters[whichParam(MIPOPTIONS,numberParameters,parameters)].setIntValue(1025);
    32033200  parameters[whichParam(CUTPASSINTREE,numberParameters,parameters)].setIntValue(1);
     
    32103207  parameters[whichParam(PROBINGCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    32113208  parameters[whichParam(KNAPSACKCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     3209  parameters[whichParam(ZEROHALFCUTS,numberParameters,parameters)].setCurrentOption("off");
    32123210  parameters[whichParam(REDSPLITCUTS,numberParameters,parameters)].setCurrentOption("off");
    32133211  parameters[whichParam(CLIQUECUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     
    32593257  int useDIVING2 = parameters_[whichParam(DIVINGS,numberParameters_,parameters_)].currentOptionAsInteger();
    32603258  int useNaive = parameters_[whichParam(NAIVE,numberParameters_,parameters_)].currentOptionAsInteger();
     3259  int kType = (type<10) ? type : 1;
     3260  assert (kType==1||kType==2);
    32613261  // FPump done first as it only works if no solution
    3262   int kType = (type<3) ? type : 1;
    3263   if (useFpump>=kType) {
     3262  if (useFpump>=kType&&useFpump<=kType+1) {
    32643263    anyToDo=true;
    32653264    CbcHeuristicFPump heuristic4(*model);
     
    33623361#endif
    33633362  }
    3364   if (useRounding>=type) {
     3363  if (useRounding>=type&&useRounding>=kType&&useRounding<=kType+1) {
    33653364    CbcRounding heuristic1(*model);
    33663365    heuristic1.setHeuristicName("rounding");
     
    33683367    anyToDo=true;
    33693368  }
    3370   if (useCombine>=type) {
     3369  if (useCombine>=type&&useCombine>=kType&&useCombine<=kType+1) {
    33713370    CbcHeuristicLocal heuristic2(*model);
    33723371    heuristic2.setHeuristicName("combine solutions");
     
    33763375    anyToDo=true;
    33773376  }
    3378   if (useGreedy>=type) {
     3377  if (useGreedy>=type&&useGreedy>=kType&&useGreedy<=kType+1) {
    33793378    CbcHeuristicGreedyCover heuristic3(*model);
    33803379    heuristic3.setHeuristicName("greedy cover");
     
    33853384    anyToDo=true;
    33863385  }
    3387   if (useRENS>=kType) {
     3386  if (useRENS>=kType&&useRENS<=kType+1) {
    33883387    CbcHeuristicRENS heuristic6(*model);
    33893388    heuristic6.setHeuristicName("RENS");
    33903389    heuristic6.setFractionSmall(0.4);
    33913390    heuristic6.setFeasibilityPumpOptions(1008003);
    3392     int nodes []={-2,0,200,1000,10000};
     3391    int nodes []={-2,50,50,50,200,1000,10000};
    33933392    heuristic6.setNumberNodes(nodes[useRENS]);
    33943393    model->addHeuristic(&heuristic6) ;
    33953394    anyToDo=true;
    33963395  }
    3397   if (useNaive>=kType) {
     3396  if (useNaive>=kType&&useNaive<=kType+1) {
    33983397    CbcHeuristicNaive heuristic5b(*model);
    33993398    heuristic5b.setHeuristicName("Naive");
     
    34033402    anyToDo=true;
    34043403  }
    3405   if (useDINS>=kType) {
    3406     CbcHeuristicDINS heuristic5a(*model);
    3407     heuristic5a.setHeuristicName("DINS");
    3408     heuristic5a.setFractionSmall(0.6);
    3409     if (useDINS==1)
    3410       heuristic5a.setDecayFactor(5.0);
    3411     else
    3412       heuristic5a.setDecayFactor(1.5);
    3413     heuristic5a.setNumberNodes(1000);
    3414     model->addHeuristic(&heuristic5a) ;
    3415     anyToDo=true;
    3416   }
    3417   if (useRINS>=kType) {
    3418     CbcHeuristicRINS heuristic5(*model);
    3419     heuristic5.setHeuristicName("RINS");
    3420     if (useRINS==1) {
    3421       heuristic5.setFractionSmall(0.5);
    3422       heuristic5.setDecayFactor(5.0);
    3423     } else {
    3424       heuristic5.setFractionSmall(0.6);
    3425       heuristic5.setDecayFactor(1.5);
    3426     }
    3427     model->addHeuristic(&heuristic5) ;
    3428     anyToDo=true;
    3429   }
    34303404  int useDIVING=0;
    34313405  {
    3432     useDIVING |= 1*((parameters_[whichParam(DIVINGV,numberParameters_,parameters_)].currentOptionAsInteger()>=kType) ? 1 : 0);
    3433     useDIVING |= 2*((parameters_[whichParam(DIVINGG,numberParameters_,parameters_)].currentOptionAsInteger()>=kType) ? 1 : 0);
    3434     useDIVING |= 4*((parameters_[whichParam(DIVINGF,numberParameters_,parameters_)].currentOptionAsInteger()>=kType) ? 1 : 0);
    3435     useDIVING |= 8*((parameters_[whichParam(DIVINGC,numberParameters_,parameters_)].currentOptionAsInteger()>=kType) ? 1 : 0);
    3436     useDIVING |= 16*((parameters_[whichParam(DIVINGL,numberParameters_,parameters_)].currentOptionAsInteger()>=kType) ? 1 : 0);
    3437     useDIVING |= 32*((parameters_[whichParam(DIVINGP,numberParameters_,parameters_)].currentOptionAsInteger()>=kType) ? 1 : 0);
     3406    int useD;
     3407    useD = parameters_[whichParam(DIVINGV,numberParameters_,parameters_)].currentOptionAsInteger();
     3408    useDIVING |= 1*((useD>=kType) ? 1 : 0);
     3409    useD = parameters_[whichParam(DIVINGG,numberParameters_,parameters_)].currentOptionAsInteger();
     3410    useDIVING |= 2*((useD>=kType) ? 1 : 0);
     3411    useD = parameters_[whichParam(DIVINGF,numberParameters_,parameters_)].currentOptionAsInteger();
     3412    useDIVING |= 4*((useD>=kType) ? 1 : 0);
     3413    useD = parameters_[whichParam(DIVINGC,numberParameters_,parameters_)].currentOptionAsInteger();
     3414    useDIVING |= 8*((useD>=kType) ? 1 : 0);
     3415    useD = parameters_[whichParam(DIVINGL,numberParameters_,parameters_)].currentOptionAsInteger();
     3416    useDIVING |= 16*((useD>=kType) ? 1 : 0);
     3417    useD = parameters_[whichParam(DIVINGP,numberParameters_,parameters_)].currentOptionAsInteger();
     3418    useDIVING |= 32*((useD>=kType) ? 1 : 0);
    34383419  }
    3439   if (useDIVING2>=kType) {
     3420  if (useDIVING2>=kType&&useDIVING2<=kType+1) {
    34403421    int diveOptions=parameters_[whichParam(DIVEOPT,numberParameters_,parameters_)].intValue();
    34413422    if (diveOptions<0||diveOptions>10)
     
    35103491    anyToDo=true;
    35113492  }
    3512   if (usePivot>=type) {
     3493  if (usePivot>=type&&usePivot<=kType+1) {
    35133494    CbcHeuristicPivotAndFix heuristic(*model);
    35143495    heuristic.setHeuristicName("pivot and fix");
     
    35173498    anyToDo=true;
    35183499  }
    3519   if (useRand>=type) {
     3500  if (useRand>=type&&useRand<=kType+1) {
    35203501    CbcHeuristicRandRound heuristic(*model);
    35213502    heuristic.setHeuristicName("randomized rounding");
     
    35233504    model->addHeuristic(&heuristic);
    35243505    anyToDo=true;
     3506  }
     3507  if (useDINS>=kType&&useDINS<=kType+1) {
     3508    CbcHeuristicDINS heuristic5a(*model);
     3509    heuristic5a.setHeuristicName("DINS");
     3510    heuristic5a.setFractionSmall(0.6);
     3511    if (useDINS<4)
     3512      heuristic5a.setDecayFactor(5.0);
     3513    else
     3514      heuristic5a.setDecayFactor(1.5);
     3515    heuristic5a.setNumberNodes(1000);
     3516    model->addHeuristic(&heuristic5a) ;
     3517    anyToDo=true;
     3518  }
     3519  if (useRINS>=kType&&useRINS<=kType+1) {
     3520    CbcHeuristicRINS heuristic5(*model);
     3521    heuristic5.setHeuristicName("RINS");
     3522    if (useRINS<4) {
     3523      heuristic5.setFractionSmall(0.5);
     3524      heuristic5.setDecayFactor(5.0);
     3525    } else {
     3526      heuristic5.setFractionSmall(0.6);
     3527      heuristic5.setDecayFactor(1.5);
     3528    }
     3529    model->addHeuristic(&heuristic5) ;
     3530    anyToDo=true;
     3531  }
     3532  int heurSwitches=parameters_[whichParam(HOPTIONS,numberParameters_,parameters_)].intValue()/10;
     3533  if (heurSwitches) {
     3534    for (int iHeur=0;iHeur<model->numberHeuristics();iHeur++) {
     3535      CbcHeuristic * heuristic = model->heuristic(iHeur);
     3536      heuristic->setSwitches(heurSwitches);
     3537    }
    35253538  }
    35263539  if (type==2&&anyToDo) {
     
    35413554    bool cleanModel = !model2.numberIntegers()&&!model2.numberObjects();
    35423555    model2.findIntegers(false);
    3543     model2.doHeuristicsAtRoot(1);
     3556    int heurOptions=parameters_[whichParam(HOPTIONS,numberParameters_,parameters_)].intValue()%10;
     3557    if (heurOptions==0||heurOptions==2) {
     3558      model2.doHeuristicsAtRoot(1);
     3559    } else if (heurOptions==1||heurOptions==3) {
     3560      model2.setMaximumNodes(-1);
     3561      CbcStrategyDefault strategy(false,5,5);
     3562      strategy.setupPreProcessing(1,0);
     3563      model2.setStrategy(strategy);
     3564      model2.branchAndBound();
     3565    }
    35443566    if (cleanModel)
    35453567      model2.zapIntegerInformation(false);
     
    37363758    bool goodModel=(originalSolver->getNumCols()) ? true : false;
    37373759
    3738     CoinSighandler_t saveSignal=SIG_DFL;
    37393760    // register signal handler
    3740     saveSignal = signal(SIGINT,signal_handler);
     3761    //CoinSighandler_t saveSignal=signal(SIGINT,signal_handler);
     3762    signal(SIGINT,signal_handler);
    37413763    // Set up all non-standard stuff
    37423764    int cutPass=-1234567;
     
    41214143    // set default action (0=off,1=on,2=root)
    41224144    int residualCapacityAction=0;
     4145
     4146#ifdef ZERO_HALF_CUTS
     4147    CglZeroHalf zerohalfGen;
     4148    //zerohalfGen.switchOnExpensive();
     4149#endif
     4150    // set default action (0=off,1=on,2=root)
     4151    int zerohalfAction=0;
     4152
    41234153    // Stored cuts
    41244154    bool storedCuts = false;
     
    47904820              residualCapacityAction = action;
    47914821              break;
     4822            case ZEROHALFCUTS:
     4823              defaultSettings=false; // user knows what she is doing
     4824              zerohalfAction = action;
     4825              break;
    47924826            case ROUNDING:
    47934827              defaultSettings=false; // user knows what she is doing
     
    48064840              probingAction = action;
    48074841              knapsackAction = action;
     4842              zerohalfAction = action;
    48084843              cliqueAction = action;
    48094844              flowAction = action;
     
    48184853              parameters_[whichParam(MIXEDCUTS,numberParameters_,parameters_)].setCurrentOption(action);
    48194854              parameters_[whichParam(TWOMIRCUTS,numberParameters_,parameters_)].setCurrentOption(action);
     4855              parameters_[whichParam(ZEROHALFCUTS,numberParameters_,parameters_)].setCurrentOption(action);
    48204856              if (!action) {
    48214857                redsplitAction = action;
     
    49304966                }
    49314967                if (tryIt) {
    4932                   model2 = ((ClpSimplexOther *) model2)->dualOfModel(fractionRow,fractionColumn);
     4968                  model2 = static_cast<ClpSimplexOther *> (model2)->dualOfModel(fractionRow,fractionColumn);
    49334969                  if (model2) {
    49344970                    sprintf(generalPrint,"Dual of model has %d rows and %d columns",
     
    51815217              basisHasValues=1;
    51825218              if (dualize) {
    5183                 int returnCode=((ClpSimplexOther *) lpSolver)->restoreFromDual(model2);
     5219                int returnCode=static_cast<ClpSimplexOther *> (lpSolver)->restoreFromDual(model2);
    51845220                if (model2->status()==3)
    51855221                  returnCode=0;
     
    55335569                    si->setBiLinearPriority(10000);
    55345570                    si->setSpecialOptions2(2+4+8);
    5535                     CoinModel * model2 = (CoinModel *) coinModel;
     5571                    CoinModel * model2 = coinModel;
    55365572                    si->load(*model2,true, parameters_[log].intValue());
    55375573                    // redo
     
    57975833                      value = 10;
    57985834                      value *= columnLength[i];
    5799                       int iValue = ((int) value)/10;
     5835                      int iValue = static_cast<int> (value)/10;
    58005836                      //iValue=1;
    58015837                      clpSolver->setObjCoeff(i,iValue);
     
    60026038                      int k=which[j];
    60036039                      sosIndices[j+base]=k;
    6004                       sosReference[j+base] = weights ? weights[j] : (double) j;
     6040                      sosReference[j+base] = weights ? weights[j] : static_cast<double> (j);
    60056041                    }
    60066042                  }
     
    60576093                    delete [] prohibited;
    60586094                  }
     6095                  if (!model_.numberObjects()&&true) {
     6096                    /* model may not have created objects
     6097                       If none then create
     6098                    */
     6099                    model_.findIntegers(true);
     6100                  }
    60596101                  if (model_.numberObjects()) {
    60606102                    OsiObject ** oldObjects = babModel_->objects();
     
    60646106                    char * prohibited = new char[numberColumns];
    60656107                    memset(prohibited,0,numberColumns);
     6108                    int numberProhibited=0;
    60666109                    for (int iObj = 0;iObj<numberOldObjects;iObj++) {
    60676110                      CbcSOS * obj =
     
    60736116                          int iColumn = which[i];
    60746117                          prohibited[iColumn]=1;
     6118                          numberProhibited++;
    60756119                        }
    60766120                      }
     
    60806124                        int iColumn = obj2->columnNumber();
    60816125                        prohibited[iColumn]=1;
     6126                        numberProhibited++;
    60826127                      }
    60836128                    }
    6084                     process.passInProhibited(prohibited,numberColumns);
     6129                    if (numberProhibited)
     6130                      process.passInProhibited(prohibited,numberColumns);
    60856131                    delete [] prohibited;
    60866132                  }
     
    61136159                    osiclp->getModelPtr()->setInfeasibilityCost(1.0e11);
    61146160                  }
    6115                   solver2 = process.preProcessNonDefault(*saveSolver,translate[preProcess],numberPasses,
     6161                  {
     6162                    OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (saveSolver);
     6163                    int savePerturbation = osiclp->getModelPtr()->perturbation();
     6164                    //#define CBC_TEMP1
     6165#ifdef CBC_TEMP1
     6166                    if (savePerturbation==50)
     6167                      osiclp->getModelPtr()->setPerturbation(52); // try less
     6168#endif
     6169                    solver2 = process.preProcessNonDefault(*saveSolver,translate[preProcess],numberPasses,
    61166170                                                         tunePreProcess);
     6171                    osiclp->getModelPtr()->setPerturbation(savePerturbation);
     6172                  }
    61176173                  integersOK=false; // We need to redo if CbcObjects exist
    61186174                  // Tell solver we are not in Branch and Cut
     
    63416397              }
    63426398              // Set up heuristics
    6343               doHeuristics(babModel_,(!miplib) ? 1 : 3);
     6399              doHeuristics(babModel_,(!miplib) ? 1 : 10);
    63446400              if (!miplib) {
    63456401                if(parameters_[whichParam(LOCALTREE,numberParameters_,parameters_)].currentOptionAsInteger()) {
     
    63606416              int switches[20];
    63616417              int numberGenerators=0;
    6362               int translate[]={-100,-1,-99,-98,1,1,1,1,-1};
     6418              int translate[]={-100,-1,-99,-98,1,-1001,-1099,1,1,1,-1};
    63636419              if (probingAction) {
    63646420                probingGen.setMaxProbeRoot(CoinMin(2000,babModel_->solver()->getNumCols()));
     
    63666422                probingGen.setMaxProbe(123);
    63676423                probingGen.setMaxLookRoot(20);
    6368                 if (probingAction==5||probingAction==7)
     6424                if (probingAction==7||probingAction==9)
    63696425                  probingGen.setRowCuts(-3); // strengthening etc just at root
    6370                 if (probingAction==6||probingAction==7) {
     6426                if (probingAction==8||probingAction==9) {
    63716427                  // Number of unsatisfied variables to look at
    63726428                  probingGen.setMaxProbeRoot(babModel_->solver()->getNumCols());
     
    63766432                  probingGen.setMaxLookRoot(50);
    63776433                }
    6378                 if (probingAction==8) {
     6434                if (probingAction==10) {
    63796435                  probingGen.setMaxPassRoot(2);
    63806436                  probingGen.setMaxProbeRoot(babModel_->solver()->getNumCols());
    63816437                  probingGen.setMaxLookRoot(100);
    63826438                }
    6383                 babModel_->addCutGenerator(&probingGen,translate[probingAction],"Probing");
     6439                // If 5 then force on
     6440                int iAction = translate[probingAction];
     6441                if (probingAction==5)
     6442                  iAction=1;
     6443                babModel_->addCutGenerator(&probingGen,iAction,"Probing");
    63846444                switches[numberGenerators++]=0;
    63856445              }
     
    63886448                // try larger limit
    63896449                int numberColumns = babModel_->getNumCols();
    6390                 if (gomoryAction==5) {
     6450                if (gomoryAction==7) {
    63916451                  gomoryAction=4;
    63926452                  gomoryGen.setLimitAtRoot(numberColumns);
    63936453                  gomoryGen.setLimit(numberColumns);
    6394                 } else if (gomoryAction==6) {
     6454                } else if (gomoryAction==8) {
    63956455                  gomoryAction=3;
    63966456                  gomoryGen.setLimitAtRoot(numberColumns);
     
    64466506                // try larger limit
    64476507                int numberColumns = babModel_->getNumCols();
    6448                 if (twomirAction==5) {
     6508                if (twomirAction==7) {
    64496509                  twomirAction=4;
    64506510                  twomirGen.setMaxElements(numberColumns);
     
    64656525                switches[numberGenerators++]=1;
    64666526              }
     6527#ifdef ZERO_HALF_CUTS
     6528              if (zerohalfAction) {
     6529                if (zerohalfAction>4) {
     6530                  //zerohalfAction -=4;
     6531                  zerohalfGen.setFlags(1);
     6532                }
     6533                babModel_->addCutGenerator(&zerohalfGen,translate[zerohalfAction],"ZeroHalf");
     6534                switches[numberGenerators++]=0;
     6535              }
     6536#endif
    64676537              if (storedCuts)
    64686538                babModel_->setSpecialOptions(babModel_->specialOptions()|64);
     
    66586728                      int numberColumns = originalCoinModel_ ? originalCoinModel_->numberColumns() :
    66596729                        lpSolver->getNumCols();
    6660                       prioritiesIn = (int *) malloc(numberColumns*sizeof(int));
     6730                      prioritiesIn = reinterpret_cast<int *> (malloc(numberColumns*sizeof(int)));
    66616731                      memcpy(prioritiesIn,info.priorities_,numberColumns*sizeof(int));
    66626732                    }
     
    66956765                      n = babModel_->getNumCols();
    66966766                    }
    6697                     prioritiesIn = (int *) malloc(n*sizeof(int));
     6767                    prioritiesIn = reinterpret_cast<int *> (malloc(n*sizeof(int)));
    66986768                    for (int i=0;i<n;i++)
    66996769                      prioritiesIn[i]=100;
     
    73347404                      int extra2 = parameters_[whichParam(EXTRA2,numberParameters_,parameters_)].intValue();
    73357405                      double saveDefault = solver3->defaultBound();
    7336                       solver3->setDefaultBound((double) extra2);
     7406                      solver3->setDefaultBound(static_cast<double> (extra2));
    73377407                      double * solution = solver3->heuristicSolution(slpValue>0 ? slpValue : 40 ,1.0e-5,testOsiOptions-10);
    73387408                      solver3->setDefaultBound(saveDefault);
     
    76127682                    babModel_->setFastNodeDepth(-9);
    76137683                }
     7684                int heurOptions=parameters_[whichParam(HOPTIONS,numberParameters_,parameters_)].intValue();
     7685                if (heurOptions>1)
     7686                  babModel_->setSpecialOptions(babModel_->specialOptions()|8192);
     7687               
    76147688#ifdef CLP_MULTIPLE_FACTORIZATIONS   
    76157689                int denseCode = parameters_[whichParam(DENSE,numberParameters_,parameters_)].intValue();
     
    76437717                if (logLevel<=1)
    76447718                  babModel_->solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry);
     7719#ifdef CBC_TEMP1
     7720                if (osiclp->getModelPtr()->perturbation()==50)
     7721                  osiclp->getModelPtr()->setPerturbation(52); // try less
     7722#endif
    76457723#if 0
    76467724                if (osiclp->getNumCols()==29404) {
     
    78887966                  int numberChanged=0;
    78897967                  for (int i=0;i<n;i++) {
    7890                     if (lower2[i]!=COIN_DBL_MAX) {
    7891                       if (lower2[i]!=columnLower[i]||
    7892                           upper2[i]!=columnUpper[i]) {
    7893                         if (lower2[i]<columnLower[i]||
    7894                             upper2[i]>columnUpper[i]) {
     7968                    if (saveSolver->isInteger(i)) {
     7969                      if (lower2[i]!=COIN_DBL_MAX) {
     7970                        if (lower2[i]!=columnLower[i]||
     7971                            upper2[i]!=columnUpper[i]) {
     7972                          if (lower2[i]<columnLower[i]||
     7973                              upper2[i]>columnUpper[i]) {
    78957974#ifdef COIN_DEVELOP
    7896                           printf("odd bounds tighter");
    7897                           printf("%d bab bounds %g %g now %g %g\n",
    7898                                  i,lower2[i],upper2[i],columnLower[i],
    7899                                  columnUpper[i]);
    7900 #endif
    7901                         } else {
     7975                            printf("odd bounds tighter");
     7976                            printf("%d bab bounds %g %g now %g %g\n",
     7977                                   i,lower2[i],upper2[i],columnLower[i],
     7978                                   columnUpper[i]);
     7979#endif
     7980                          } else {
    79027981#ifdef COIN_DEVELOP
    7903                           printf("%d bab bounds %g %g now %g %g\n",
    7904                                  i,lower2[i],upper2[i],columnLower[i],
    7905                                  columnUpper[i]);
    7906 #endif
    7907                           numberChanged++;
    7908                           saveSolver->setColLower(i,lower2[i]);
    7909                           saveSolver->setColUpper(i,upper2[i]);
     7982                            printf("%d bab bounds %g %g now %g %g\n",
     7983                                   i,lower2[i],upper2[i],columnLower[i],
     7984                                   columnUpper[i]);
     7985#endif
     7986                            numberChanged++;
     7987                            saveSolver->setColLower(i,lower2[i]);
     7988                            saveSolver->setColUpper(i,upper2[i]);
     7989                          }
    79107990                        }
    79117991                      }
     
    79218001                      << generalPrint
    79228002                      <<CoinMessageEol;
    7923                     saveSolver->resolve();
    7924                     assert (saveSolver->isProvenOptimal());
    79258003                  }
     8004                  saveSolver->resolve();
     8005                  if (!saveSolver->isProvenOptimal()) {
     8006                    // try all slack
     8007                    CoinWarmStartBasis * basis = dynamic_cast<CoinWarmStartBasis *> (babModel_->solver()->getEmptyWarmStart());
     8008                    saveSolver->setWarmStart(basis);
     8009                    delete basis;
     8010                    saveSolver->initialSolve();
     8011#ifdef COIN_DEVELOP
     8012                    saveSolver->writeMps("inf2");
     8013#endif
     8014                  }
     8015                  assert (saveSolver->isProvenOptimal());
    79268016#if NEW_STYLE_SOLVER==0
    79278017                  // and original solver
    7928                   assert (n==originalSolver->getNumCols());
     8018                  assert (n>=originalSolver->getNumCols());
     8019                  n=originalSolver->getNumCols();
    79298020                  originalSolver->setColLower(saveSolver->getColLower());
    79308021                  originalSolver->setColUpper(saveSolver->getColUpper());
     
    79348025                  delete basis;
    79358026                  originalSolver->resolve();
     8027                  if (!originalSolver->isProvenOptimal()) {
     8028                    // try all slack
     8029                    CoinWarmStartBasis * basis = dynamic_cast<CoinWarmStartBasis *> (babModel_->solver()->getEmptyWarmStart());
     8030                    originalSolver->setBasis(*basis);
     8031                    delete basis;
     8032                    originalSolver->initialSolve();
     8033                  }
    79368034                  assert (originalSolver->isProvenOptimal());
    79378035#endif
     
    83478445                  if (CbcOrClpRead_mode==2&&argc==2) {
    83488446                    // only if ends .mps
    8349                     char * find = (char *)strstr(fileName.c_str(),".mps");
     8447                    char * find = reinterpret_cast<char *>(strstr(fileName.c_str(),".mps"));
    83508448                    if (find&&find[4]=='\0') {
    83518449                      find[1]='p'; find[2]='a';find[3]='r';
     
    84378535                si->setIntegerPriority(1000);
    84388536                si->setBiLinearPriority(10000);
    8439                 CoinModel * model2 = (CoinModel *) &coinModel;
     8537                CoinModel * model2 = &coinModel;
    84408538                si->load(*model2);
    84418539                // redo
     
    84918589                ClpSimplex * model2 = lpSolver;
    84928590                if (dualize&&dualize<3) {
    8493                   model2 = ((ClpSimplexOther *) model2)->dualOfModel();
     8591                  model2 = static_cast<ClpSimplexOther *> (model2)->dualOfModel();
    84948592                  sprintf(generalPrint,"Dual of model has %d rows and %d columns",
    84958593                         model2->numberRows(),model2->numberColumns());
     
    87088806                    if (comma)
    87098807                      *comma='\0';
    8710                     for (i=0;i<(int) (sizeof(got)/sizeof(int));i++) {
     8808                    for (i=0;i<static_cast<int> (sizeof(got)/sizeof(int));i++) {
    87118809                      if (headings[i]==pos) {
    87128810                        if (got[i]<0) {
     
    87208818                      }
    87218819                    }
    8722                     if (i==(int) (sizeof(got)/sizeof(int)))
     8820                    if (i==static_cast<int> (sizeof(got)/sizeof(int)))
    87238821                      good=false;
    87248822                    if (comma) {
     
    87388836                  if (good&&(strstr(fileName.c_str(),".mst")||strstr(fileName.c_str(),".MST")||strstr(fileName.c_str(),".csv"))) {
    87398837                    numberFields=0;
    8740                     for (i=2;i<(int) (sizeof(got)/sizeof(int));i++) {
     8838                    for (i=2;i<static_cast<int> (sizeof(got)/sizeof(int));i++) {
    87418839                      if (got[i]>=0)
    87428840                        numberFields++;
     
    87508848                  if (good) {
    87518849                    char ** columnNames = new char * [numberColumns];
    8752                     pseudoDown= (double *) malloc(numberColumns*sizeof(double));
    8753                     pseudoUp = (double *) malloc(numberColumns*sizeof(double));
    8754                     branchDirection = (int *) malloc(numberColumns*sizeof(int));
    8755                     priorities= (int *) malloc(numberColumns*sizeof(int));
     8850                    pseudoDown= reinterpret_cast<double *> (malloc(numberColumns*sizeof(double)));
     8851                    pseudoUp = reinterpret_cast<double *> (malloc(numberColumns*sizeof(double)));
     8852                    branchDirection = reinterpret_cast<int *> (malloc(numberColumns*sizeof(int)));
     8853                    priorities= reinterpret_cast<int *> (malloc(numberColumns*sizeof(int)));
    87568854                    free(solutionIn);
    87578855                    solutionIn=NULL;
     
    87608858                    int iColumn;
    87618859                    if (got[6]>=0) {
    8762                       solutionIn = (double *) malloc(numberColumns*sizeof(double));
     8860                      solutionIn = reinterpret_cast<double *> (malloc(numberColumns*sizeof(double)));
    87638861                      for (iColumn=0;iColumn<numberColumns;iColumn++)
    87648862                        solutionIn[iColumn]=-COIN_DBL_MAX;
    87658863                    }
    87668864                    if (got[7]>=0||!numberFields) {
    8767                       prioritiesIn = (int *) malloc(numberColumns*sizeof(int));
     8865                      prioritiesIn = reinterpret_cast<int *> (malloc(numberColumns*sizeof(int)));
    87688866                      for (iColumn=0;iColumn<numberColumns;iColumn++)
    87698867                        prioritiesIn[iColumn]=10000;
     
    95509648                strcpy(buffer,argv[1]);
    95519649                char * slash=buffer;
    9552                 for (int i=0;i<(int)strlen(buffer);i++) {
     9650                for (int i=0;i<static_cast<int>(strlen(buffer));i++) {
    95539651                  if (buffer[i]=='/'||buffer[i]=='\\')
    95549652                    slash=buffer+i+1;
     
    98679965                      if (newLine)
    98689966                        fprintf(fp,"\n");
    9869                       int value = (int) (primalColumnSolution[iColumn]+0.5);
     9967                      int value = static_cast<int> (primalColumnSolution[iColumn]+0.5);
    98709968                      fprintf(fp,"%d. ",value);
    98719969                      comma=true;
     
    1002810126    1.0e1,1.0e2,1.0e3,1.0e4,1.0e5,1.0e8,1.0e11,1.0e15,
    1002910127    COIN_DBL_MAX};
    10030   int nRanges = (int) (sizeof(range)/sizeof(double));
     10128  int nRanges = static_cast<int> (sizeof(range)/sizeof(double));
    1003110129  int * number = new int[nRanges];
    1003210130  memset(number,0,nRanges*sizeof(int));
     
    1020710305  printf("Column breakdown:\n");
    1020810306  int k;
    10209   for (k=0;k<(int) (sizeof(cType)/sizeof(int));k++) {
     10307  for (k=0;k<static_cast<int> (sizeof(cType)/sizeof(int));k++) {
    1021010308    printf("%d of type %s ",cType[k],cName[k].c_str());
    1021110309    if (((k+1)%3)==0)
     
    1021510313    printf("\n");
    1021610314  printf("Row breakdown:\n");
    10217   for (k=0;k<(int) (sizeof(rType)/sizeof(int));k++) {
     10315  for (k=0;k<static_cast<int> (sizeof(rType)/sizeof(int));k++) {
    1021810316    printf("%d of type %s ",rType[k],rName[k].c_str());
    1021910317    if (((k+1)%3)==0)
  • trunk/Cbc/src/CbcStrategy.cpp

    r1087 r1121  
    366366              numberInt++;
    367367          } else {
    368             int iValue = (int)( 100*(value+0.005));
     368            int iValue = static_cast<int>( 100*(value+0.005));
    369369            double value2 = iValue;
    370370            if (value2==100.0*value) {
     
    388388            double value = fabs(value1);
    389389            if (value<1.0e7) {
    390               int iValue = (int)( 100*(value+0.005));
     390              int iValue = static_cast<int>( 100*(value+0.005));
    391391              double value2 = iValue;
    392392              if (value2!=100.0*value) {
  • trunk/Cbc/src/CbcTree.cpp

    r1053 r1121  
    9696        if (numberBranching_==maximumBranching_)
    9797          increaseSpace();
    98         newBound_[numberBranching_]=(int) newBounds[i];
     98        newBound_[numberBranching_]=static_cast<int> (newBounds[i]);
    9999        branched_[numberBranching_++]=jColumn;
    100100      }
     
    111111      int jColumn=iColumn|0x40000000;
    112112      if (newLower[iColumn]==up[0]) {
    113         newBound_[numberBranching_]=(int) up[0];
     113        newBound_[numberBranching_]=static_cast<int> (up[0]);
    114114      } else {
    115         newBound_[numberBranching_]=(int) down[1];
     115        newBound_[numberBranching_]=static_cast<int> (down[1]);
    116116        jColumn|= 0x80000000;
    117117      }
     
    135135            if (numberBranching_==maximumBranching_)
    136136              increaseSpace();
    137             newBound_[numberBranching_]=(int) value;
     137            newBound_[numberBranching_]=static_cast<int> (value);
    138138            branched_[numberBranching_++]=jColumn;
    139139          }
     
    327327CbcTree::getBestPossibleObjective(){
    328328  double r_val = 1e100;
    329   for(int i = 0 ; i < (int) nodes_.size() ; i++){
     329  for(int i = 0 ; i < static_cast<int> (nodes_.size()) ; i++){
    330330    if(nodes_[i] && nodes_[i]->objectiveValue() < r_val){
    331331      r_val = nodes_[i]->objectiveValue();
  • trunk/Cbc/src/CbcTreeLocal.cpp

    r1067 r1121  
    374374      searchType_=0;
    375375    }
    376     startTime_ = (int) CoinCpuTime();
     376    startTime_ = static_cast<int> (CoinCpuTime());
    377377    saveNumberSolutions_ = model_->getSolutionCount();
    378378  }
     
    442442           state,
    443443           model_->getNodeCount()-startNode_,
    444            (int) CoinCpuTime()-startTime_,
     444           static_cast<int> (CoinCpuTime())-startTime_,
    445445           model_->getCutoff()+increment,bestCutoff_+increment,rhs_);
    446446  saveNumberSolutions_ = model_->getSolutionCount();
     
    649649    }
    650650    // put back node
    651     startTime_ = (int) CoinCpuTime();
     651    startTime_ = static_cast<int> (CoinCpuTime());
    652652    startNode_=model_->getNodeCount();
    653653    if (localNode_) {
  • trunk/Cbc/src/Makefile.am

    r1057 r1121  
    278278        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglLandP` \
    279279        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglResidualCapacity` \
     280        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglZeroHalf` \
    280281        -I`$(CYGPATH_W) $(COINUTILSSRCDIR)/src` \
    281282        -I`$(CYGPATH_W) $(COINUTILSOBJDIR)/inc` \
  • trunk/Cbc/src/Makefile.in

    r1069 r1121  
    576576        $(CGLSRCDIR)/src/CglLandP` -I`$(CYGPATH_W) \
    577577        $(CGLSRCDIR)/src/CglResidualCapacity` -I`$(CYGPATH_W) \
     578        $(CGLSRCDIR)/src/CglZeroHalf` -I`$(CYGPATH_W) \
    578579        $(COINUTILSSRCDIR)/src` -I`$(CYGPATH_W) \
    579580        $(COINUTILSOBJDIR)/inc` -I`$(CYGPATH_W) $(OSISRCDIR)/src` \
  • trunk/Cbc/src/unitTestClp.cpp

    r1087 r1121  
    99#include "CbcModel.hpp"
    1010#include "CbcCutGenerator.hpp"
     11#include "CbcBranchCut.hpp"
    1112#include "CglProbing.hpp"
    1213#include "OsiClpSolverInterface.hpp"
     
    482483    setCutAndHeuristicOptions(*model);
    483484#ifdef CLP_MULTIPLE_FACTORIZATIONS   
    484     int denseCode = stuff ? (int) stuff[4] : -1;
    485     int smallCode = stuff ? (int) stuff[10] : -1;
     485    int denseCode = stuff ? static_cast<int> (stuff[4]) : -1;
     486    int smallCode = stuff ? static_cast<int> (stuff[10]) : -1;
    486487    if (stuff&&stuff[8]>=1) {
    487488      if (denseCode<0)
     
    504505      &n