Changeset 888 for branches


Ignore:
Timestamp:
Oct 30, 2006 10:27:06 AM (13 years ago)
Author:
forrest
Message:

modifying sprint

Location:
branches/devel/Clp/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Clp/src/ClpModel.cpp

    r873 r888  
    22522252{
    22532253  double * array = NULL;
    2254   if (problemStatus_==1&&!secondaryStatus_)
     2254  if (problemStatus_==1&&!secondaryStatus_) {
    22552255    array = ClpCopyOfArray(ray_,numberRows_);
     2256#if 0
     2257    // clean up
     2258    double largest=1.0e-30;
     2259    double smallest=COIN_DBL_MAX;
     2260    int i;
     2261    for (i=0;i<numberRows_;i++) {
     2262      double value = fabs(array[i]);
     2263      smallest = CoinMin(smallest,value);
     2264      largest = CoinMax(largest,value);
     2265    }
     2266#endif
     2267  }
    22562268  return array;
    22572269}
  • branches/devel/Clp/src/ClpSimplexOther.cpp

    r861 r888  
    15061506  if (!feasible) {
    15071507    return -1;
    1508   } else {
     1508  } else if (integerType_) {
    15091509    // and tighten
    15101510    for (int iColumn=0;iColumn<numberColumns_;iColumn++) {
  • branches/devel/Clp/src/ClpSolve.cpp

    r863 r888  
    1414#include "ClpFactorization.hpp"
    1515#include "ClpSimplex.hpp"
     16#include "ClpSimplexOther.hpp"
    1617#ifndef SLIM_CLP
    1718#include "ClpQuadraticObjective.hpp"
     
    641642  int numberRows = model2->numberRows();
    642643  // If not all slack basis - switch off all except sprint
    643   int number=0;
     644  int numberRowsBasic=0;
    644645  int iRow;
    645646  for (iRow=0;iRow<numberRows;iRow++)
    646647    if (model2->getRowStatus(iRow)==basic)
    647       number++;
    648   if (number<numberRows) {
     648      numberRowsBasic++;
     649  if (numberRowsBasic<numberRows) {
    649650    doIdiot=0;
    650651    doCrash=0;
     
    13311332    const CoinBigIndex * columnStart = model2->matrix()->getVectorStarts();
    13321333    const int * columnLength = model2->matrix()->getVectorLengths();
     1334    //bool allSlack = (numberRowsBasic==numberRows);
    13331335    for (iColumn=0;iColumn<originalNumberColumns;iColumn++) {
    13341336      if (!columnSolution[iColumn]||fabs(columnSolution[iColumn])>1.0e20) {
     
    13581360    double * rowSolution = model2->primalRowSolution();
    13591361    CoinZeroN (rowSolution,numberRows);
    1360     model2->times(1.0,columnSolution,rowSolution);
     1362    model2->clpMatrix()->times(1.0,columnSolution,rowSolution);
    13611363    // See if we can adjust using costed slacks
    13621364    double penalty=CoinMin(infeasibilityCost_,1.0e10)*optimizationDirection_;
     
    14811483      maxSprintPass=options.getExtraInfo(1);
    14821484    // but if big use to get ratio
    1483     int ratio=3;
     1485    double ratio=3;
    14841486    if (maxSprintPass>1000) {
    1485       ratio = CoinMax(maxSprintPass/1000,2);
     1487      ratio = ((double) maxSprintPass)*0.0001;
     1488      ratio = CoinMax(ratio,1.1);
    14861489      maxSprintPass= maxSprintPass %1000;
    14871490#ifdef COIN_DEVELOP
    1488       printf("%d passes wanted with ratio of %d\n",maxSprintPass,ratio);
     1491      printf("%d passes wanted with ratio of %g\n",maxSprintPass,ratio);
    14891492#endif
    14901493    }
    14911494    // Just take this number of columns in small problem
    1492     int smallNumberColumns = CoinMin(ratio*numberRows,numberColumns);
     1495    int smallNumberColumns = (int) CoinMin(ratio*numberRows,(double) numberColumns);
    14931496    smallNumberColumns = CoinMax(smallNumberColumns,3000);
    14941497    smallNumberColumns = CoinMin(smallNumberColumns,numberColumns);
     
    15641567        offset += fullSolution[iColumn]*objective[iColumn];
    15651568      small.setDblParam(ClpObjOffset,originalOffset-offset);
    1566       model2->times(1.0,fullSolution,sumFixed);
     1569      model2->clpMatrix()->times(1.0,fullSolution,sumFixed);
    15671570     
    15681571      double * lower = small.rowLower();
     
    15891592          clpMatrix->releaseSpecialColumnCopy();
    15901593        } else {
     1594#if 0
    15911595          small.primal(1);
     1596#else
     1597          int numberColumns = small.numberColumns();
     1598          int numberRows = small.numberRows();
     1599          // Use dual region
     1600          double * rhs = small.dualRowSolution();
     1601          int * whichRow = new int[3*numberRows];
     1602          int * whichColumn = new int[2*numberColumns];
     1603          int nBound;
     1604          ClpSimplex * small2 = ((ClpSimplexOther *) (&small))->crunch(rhs,whichRow,whichColumn,
     1605                                                                        nBound,false,false);
     1606          if (small2) {
     1607            small2->primal(1);
     1608            if (small2->problemStatus()==0) {
     1609              small.setProblemStatus(0);
     1610              ((ClpSimplexOther *) (&small))->afterCrunch(*small2,whichRow,whichColumn,nBound);
     1611            } else {
     1612              small2->primal(1);
     1613              if (small2->problemStatus())
     1614                small.primal(1);
     1615            }
     1616            delete small2;
     1617          } else {
     1618            small.primal(1);
     1619          }
     1620          delete [] whichRow;
     1621          delete [] whichColumn;
     1622#endif
    15921623        }
    15931624      } else {
     
    16091640      double * djs = model2->dualColumnSolution();
    16101641      CoinMemcpyN(model2->objective(),numberColumns,djs);
    1611       model2->transposeTimes(-1.0,small.dualRowSolution(),djs);
     1642      model2->clpMatrix()->transposeTimes(-1.0,small.dualRowSolution(),djs);
    16121643      int numberNegative=0;
    16131644      double sumNegative = 0.0;
     
    22612292  numberPasses_=5;
    22622293  int i;
    2263   for (i=0;i<6;i++)
     2294  for (i=0;i<7;i++)
    22642295    options_[i]=0;
    2265   for (i=0;i<6;i++)
     2296  for (i=0;i<7;i++)
    22662297    extraInfo_[i]=-1;
    2267   for (i=0;i<2;i++)
    2268     independentOptions_[i]=0;
     2298  independentOptions_[0]=0;
    22692299  // But switch off slacks
    22702300  independentOptions_[1]=512;
     
    22842314  for (i=0;i<6;i++)
    22852315    options_[i]=options[i];
     2316  options_[6]=0;
    22862317  for (i=0;i<6;i++)
    22872318    extraInfo_[i]=extraInfo[i];
     2319  extraInfo_[6]=0;
    22882320  for (i=0;i<3;i++)
    22892321    independentOptions_[i]=independentOptions[i];
     
    22972329  numberPasses_=rhs.numberPasses_;
    22982330  int i;
    2299   for ( i=0;i<6;i++)
     2331  for ( i=0;i<7;i++)
    23002332    options_[i]=rhs.options_[i];
    2301   for ( i=0;i<6;i++)
     2333  for ( i=0;i<7;i++)
    23022334    extraInfo_[i]=rhs.extraInfo_[i];
    23032335  for (i=0;i<3;i++)
     
    23132345    numberPasses_=rhs.numberPasses_;
    23142346    int i;
    2315     for (i=0;i<6;i++)
     2347    for (i=0;i<7;i++)
    23162348      options_[i]=rhs.options_[i];
    2317     for (i=0;i<6;i++)
     2349    for (i=0;i<7;i++)
    23182350      extraInfo_[i]=rhs.extraInfo_[i];
    23192351    for (i=0;i<3;i++)
  • branches/devel/Clp/src/ClpSolve.hpp

    r800 r888  
    192192  /// Amount of presolve
    193193  int numberPasses_;
    194   /// Options
    195   int options_[6];
     194  /// Options - last is switch for OsiClp
     195  int options_[7];
    196196  /// Extra information
    197   int extraInfo_[6];
     197  int extraInfo_[7];
    198198  /** Extra algorithm dependent options
    199199      0 - if set return from clpsolve if infeasible
Note: See TracChangeset for help on using the changeset viewer.