Changeset 1276 for trunk/Clp


Ignore:
Timestamp:
Sep 16, 2008 5:31:36 PM (11 years ago)
Author:
ladanyi
Message:

changed max/min to CoinMax/CoinMin?

Location:
trunk/Clp
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/examples/decompose.cpp

    r778 r1276  
    340340            if (fabs(value)>1.0e-15) {
    341341              dj -= dual[i]*value;
    342               smallest = min(smallest,fabs(value));
    343               largest = max(largest,fabs(value));
     342              smallest = CoinMin(smallest,fabs(value));
     343              largest = CoinMax(largest,fabs(value));
    344344              rowAdd[number]=i;
    345345              elementAdd[number++]=value;
     
    376376            if (fabs(value)>1.0e-15) {
    377377              dj -= dual[i]*value;
    378               smallest = min(smallest,fabs(value));
    379               largest = max(largest,fabs(value));
     378              smallest = CoinMin(smallest,fabs(value));
     379              largest = CoinMax(largest,fabs(value));
    380380              rowAdd[number]=i;
    381381              elementAdd[number++]=value;
  • trunk/Clp/examples/dualCuts.cpp

    r1265 r1276  
    8686  // Just add this number of rows each time in small problem
    8787  int smallNumberRows = 2*numberColumns;
    88   smallNumberRows=min(smallNumberRows,originalNumberRows/20);
     88  smallNumberRows=CoinMin(smallNumberRows,originalNumberRows/20);
    8989  // and pad out with random rows
    9090  double ratio = ((double)(smallNumberRows-numberSort))/((double) originalNumberRows);
     
    104104  double * columnUpper = model2->columnUpper();
    105105  for (iColumn=0;iColumn<numberColumns;iColumn++) {
    106     columnLower[iColumn]=max(-1.0e6,columnLower[iColumn]);
    107     columnUpper[iColumn]=min(1.0e6,columnUpper[iColumn]);
     106    columnLower[iColumn]=CoinMax(-1.0e6,columnLower[iColumn]);
     107    columnUpper[iColumn]=CoinMin(1.0e6,columnUpper[iColumn]);
    108108  }
    109109#endif
     
    183183          if (iPass<takeOutPass&&!dualInfeasible) {
    184184            // may have hit max iterations so check
    185             double infeasibility = max(fullSolution[iRow]-rowUpper[iRow],
     185            double infeasibility = CoinMax(fullSolution[iRow]-rowUpper[iRow],
    186186                                       rowLower[iRow]-fullSolution[iRow]);
    187187            weight[iRow]=-infeasibility;
     
    210210        if (weight[iRow]==1.123e50) {
    211211          // not looked at yet
    212           double infeasibility = max(fullSolution[iRow]-rowUpper[iRow],
     212          double infeasibility = CoinMax(fullSolution[iRow]-rowUpper[iRow],
    213213                                     rowLower[iRow]-fullSolution[iRow]);
    214214          weight[iRow]=-infeasibility;
     
    221221      // sort
    222222      CoinSort_2(weight,weight+originalNumberRows,sort);
    223       numberSort = min(originalNumberRows,smallNumberRows+numberKept);
     223      numberSort = CoinMin(originalNumberRows,smallNumberRows+numberKept);
    224224      memset(take,0,originalNumberRows);
    225225      for (iRow=0;iRow<numberSort;iRow++)
  • trunk/Clp/examples/myPdco.cpp

    r1171 r1276  
    232232    ir[nonzpt++] = *ifrom;
    233233    ir[nonzpt++] = *ito;
    234     imax = max(imax, *ifrom);
    235     imax = max(imax, *ito);
    236     imin = min(imin, *ifrom);
    237     imin = min(imin, *ito);
     234    imax = CoinMax(imax, *ifrom);
     235    imax = CoinMax(imax, *ito);
     236    imin = CoinMin(imin, *ifrom);
     237    imin = CoinMin(imin, *ito);
    238238  }
    239239  fclose(fpData);
     
    294294  model.dj_=dj;
    295295  model.xsize_ = 50/ncol;
    296   model.xsize_ = min(model.xsize_, 1.0);
     296  model.xsize_ = CoinMin(model.xsize_, 1.0);
    297297  model.zsize_ = 1;
    298298}
  • trunk/Clp/examples/pdco.cpp

    r1171 r1276  
    5656  // These are already set?
    5757  model.xsize_ = 50.0/(model.numberColumns());
    58   model.xsize_ = min( 1.0, model.xsize_);
     58  model.xsize_ = CoinMin( 1.0, model.xsize_);
    5959
    6060  /*
  • trunk/Clp/examples/sprint.cpp

    r230 r1276  
    117117
    118118  // Just take this number of columns in small problem
    119   int smallNumberColumns = min(3*numberRows,numberColumns);
    120   smallNumberColumns = max(smallNumberColumns,3000);
     119  int smallNumberColumns = CoinMin(3*numberRows,numberColumns);
     120  smallNumberColumns = CoinMax(smallNumberColumns,3000);
    121121  // We will be using all rows
    122122  int * whichRows = new int [numberRows];
  • trunk/Clp/examples/testGub.cpp

    r778 r1276  
    9090          break;
    9191        } else {
    92           last=max(last,iColumn);
    93           first = min(first,iColumn);
     92          last=CoinMax(last,iColumn);
     93          first = CoinMin(first,iColumn);
    9494        }
    9595      }
  • trunk/Clp/examples/testGub2.cpp

    r778 r1276  
    108108          break;
    109109        } else {
    110           last=max(last,iColumn);
    111           first = min(first,iColumn);
     110          last=CoinMax(last,iColumn);
     111          first = CoinMin(first,iColumn);
    112112        }
    113113      }
  • trunk/Clp/src/ClpNode.cpp

    r1202 r1276  
    208208    if (integerType[iColumn]) {
    209209      double value = solution[iColumn];
    210       value = max(value,(double) lower[iColumn]);
    211       value = min(value,(double) upper[iColumn]);
     210      value = CoinMax(value,(double) lower[iColumn]);
     211      value = CoinMin(value,(double) upper[iColumn]);
    212212      double nearest = floor(value+0.5);
    213213      if (fabs(value-nearest)>integerTolerance) {
  • trunk/Clp/src/ClpPdco.cpp

    r1197 r1276  
    253253  int  LSproblem = options.LSproblem;  // See below
    254254  int  LSmethod  = options.LSmethod;   // 1=Cholesky    2=QR    3=LSQR
    255   int  itnlim    = options.LSQRMaxIter * min(m,n);
     255  int  itnlim    = options.LSQRMaxIter * CoinMin(m,n);
    256256  double atol1     = options.LSQRatol1;  // Initial  atol
    257257  double atol2     = options.LSQRatol2;  // Smallest atol,unless atol1 is smaller
     
    431431
    432432  for (int k=0; k<nlow; k++){
    433     x_elts[low[k]]  = max( x_elts[low[k]], bl[low[k]]);
    434     x1_elts[low[k]] = max( x_elts[low[k]] - bl[low[k]], x0min  );
    435     z1_elts[low[k]] = max( z_elts[low[k]], z0min  );
     433    x_elts[low[k]]  = CoinMax( x_elts[low[k]], bl[low[k]]);
     434    x1_elts[low[k]] = CoinMax( x_elts[low[k]] - bl[low[k]], x0min  );
     435    z1_elts[low[k]] = CoinMax( z_elts[low[k]], z0min  );
    436436  }
    437437  for (int k=0; k<nupp; k++){
    438     x_elts[upp[k]]  = min( x_elts[upp[k]], bu[upp[k]]);
    439     x2_elts[upp[k]] = max(bu[upp[k]] -  x_elts[upp[k]], x0min  );
    440     z2_elts[upp[k]] = max(-z_elts[upp[k]], z0min  );
     438    x_elts[upp[k]]  = CoinMin( x_elts[upp[k]], bu[upp[k]]);
     439    x2_elts[upp[k]] = CoinMax(bu[upp[k]] -  x_elts[upp[k]], x0min  );
     440    z2_elts[upp[k]] = CoinMax(-z_elts[upp[k]], z0min  );
    441441  }
    442442  //////////////////// Assume hessian is diagonal. //////////////////////
     
    488488  double mufirst = mu0;   // revert to absolute value
    489489  double mulast  = 0.1 * opttol;
    490   mulast  = min( mulast, mufirst );
     490  mulast  = CoinMin( mulast, mufirst );
    491491  double mu      = mufirst;
    492492  double center,  fmerit;
     
    501501  bool converged = false;
    502502  double atol      = atol1;
    503   atol2     = max( atol2, atolmin );
     503  atol2     = CoinMax( atol2, atolmin );
    504504  atolmin   = atol2;
    505505  //  pdDDD2    = d2;    // Global vector for diagonal matrix D2
     
    552552    //              Now that starting conditions are better, go back to 0.1.
    553553
    554     double r3norm = max(Pinf,   max(Dinf,  Cinf));
    555     atol   = min(atol,  r3norm*0.1);
    556     atol   = max(atol,  atolmin   );
     554    double r3norm = CoinMax(Pinf,   CoinMax(Dinf,  Cinf));
     555    atol   = CoinMin(atol,  r3norm*0.1);
     556    atol   = CoinMax(atol,  atolmin   );
    557557    info.r3norm = r3norm;
    558558
     
    682682    if (nupp > 0)
    683683      stepz2 = pdxxxstep( z2     , dz2      );
    684     double stepx  = min( stepx1, stepx2 );
    685     double stepz  = min( stepz1, stepz2 );
    686     stepx  = min( steptol*stepx, 1.0 );
    687     stepz  = min( steptol*stepz, 1.0 );
     684    double stepx  = CoinMin( stepx1, stepx2 );
     685    double stepz  = CoinMin( stepz1, stepz2 );
     686    stepx  = CoinMin( steptol*stepx, 1.0 );
     687    stepz  = CoinMin( steptol*stepz, 1.0 );
    688688    if (stepSame){                   // For NLPs, force same step
    689       stepx = min( stepx, stepz );   // (true Newton method)
     689      stepx = CoinMin( stepx, stepz );   // (true Newton method)
    690690      stepz = stepx;
    691691    }
     
    729729                               &center, &Cinf, &Cinf0);
    730730      double fmeritnew = pdxxxmerit(nlow, nupp, low,upp,r1,r2,rL,rU,cL,cU );
    731       double step      = min( stepx, stepz );
     731      double step      = CoinMin( stepx, stepz );
    732732
    733733      if (fmeritnew <= (1 - eta*step)*fmerit){
     
    829829      // Reduce mu, and reset certain residuals.
    830830
    831       double stepmu  = min( stepx , stepz   );
    832       stepmu  = min( stepmu, steptol );
     831      double stepmu  = CoinMin( stepx , stepz   );
     832      stepmu  = CoinMin( stepmu, steptol );
    833833      double muold   = mu;
    834834      mu      = mu   -  stepmu * mu;
     
    837837
    838838      // mutrad = mu0*(sum(Xz)/n); // 24 May 1998: Traditional value, but
    839       // mu     = min(mu,mutrad ); // it seemed to decrease mu too much.
    840 
    841       mu      = max(mu,mulast);  // 13 Jun 1998: No need for smaller mu.
     839      // mu     = CoinMin(mu,mutrad ); // it seemed to decrease mu too much.
     840
     841      mu      = CoinMax(mu,mulast);  // 13 Jun 1998: No need for smaller mu.
    842842      //      [cL,cU,center,Cinf,Cinf0] = ...
    843843      pdxxxresid2( mu, nlow, nupp, low, upp, cL, cU, x1, x2, z1, z2,
     
    851851      // if atol > atol2
    852852      //   atolfac = (mu/mufirst)^0.25;
    853       //   atol    = max( atol*atolfac, atol2 );
     853      //   atol    = CoinMax( atol*atolfac, atol2 );
    854854      // end
    855855
    856       // atol = min( atol, mu );     // 22 Jan 2001: a la Inexact Newton.
    857       // atol = min( atol, 0.5*mu ); // 30 Jan 2001: A bit tighter
     856      // atol = CoinMin( atol, mu );     // 22 Jan 2001: a la Inexact Newton.
     857      // atol = CoinMin( atol, 0.5*mu ); // 30 Jan 2001: A bit tighter
    858858
    859859      // If the linesearch took more than one function (nf > 1),
     
    865865      // 06 Feb 2001: Not necessarily.  Reinstated tests in next line.
    866866
    867       if (nf > 2  ||  min( stepx, stepz ) <= 0.01)
     867      if (nf > 2  ||  CoinMin( stepx, stepz ) <= 0.01)
    868868        atol = atolold*0.1;
    869869    }
  • trunk/Clp/src/ClpQuadraticObjective.cpp

    r1197 r1276  
    4040  numberColumns_ = numberColumns;
    4141  if (numberExtendedColumns>=0)
    42     numberExtendedColumns_= max(numberColumns_,numberExtendedColumns);
     42    numberExtendedColumns_= CoinMax(numberColumns_,numberExtendedColumns);
    4343  else
    4444    numberExtendedColumns_= numberColumns_;
  • trunk/Clp/src/ClpSimplexNonlinear.cpp

    r1271 r1276  
    13461346        if (solutionError<0.0) {
    13471347          solutionError=largest;
    1348         } else if (largest>max(1.0e-8,1.0e2*solutionError)&&
     1348        } else if (largest>CoinMax(1.0e-8,1.0e2*solutionError)&&
    13491349                   factorization_->pivots()) {
    13501350          longArray->clear();
Note: See TracChangeset for help on using the changeset viewer.