Changeset 34 for branches


Ignore:
Timestamp:
Oct 9, 2002 3:32:58 PM (17 years ago)
Author:
forrest
Message:

Allow Presolve to work with gaps

Location:
branches/devel-1
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-1/ClpPackedMatrix.cpp

    r25 r34  
    838838         j<columnStart[iColumn]+columnLength[iColumn];j++) {
    839839      double value = fabs(elementByColumn[j]);
     840      //printf("%d %d %d %g\n",iColumn,j,row[j],elementByColumn[j]);
    840841      if (value<smallest) {
    841842        numberSmall++;
  • branches/devel-1/Presolve.cpp

    r33 r34  
    7474                         si,
    7575                         nrows_, nelems_,false);
     76  prob.originalModel_ = originalModel_;
    7677
    7778  paction_ = presolve(&prob);
     
    114115                            sol, acts,
    115116                         colstat, rowstat);
     117    prob.originalModel_ = originalModel_;
    116118
    117119    postsolve(prob);
     
    179181  originalColumn_ = new int[ncols_];
    180182
     183  // Check matrix
     184  if (!si.clpMatrix()->allElementsInRange(&si,1.0e-20,1.0e20))
     185    return NULL;
     186
    181187  // result is 0 - okay, 1 infeasible, -1 go round again
    182188  int result = -1;
     
    197203                        *presolvedModel_,
    198204                        nrows_, nelems_,true);
     205    prob.originalModel_ = originalModel_;
    199206
    200207    // move across feasibility tolerance
     
    346353                       sol, acts,
    347354                       colstat, rowstat);
     355  prob.originalModel_ = originalModel_;
    348356   
    349357  postsolve(prob);
  • branches/devel-1/PresolveMatrix.cpp

    r33 r34  
    265265                                             int nrows_in,
    266266                                             int nelems_in) :
    267   originalModel_(&si),
    268267  ncols_(si.getNumCols()),
    269268  ncols0_(ncols_in),
     
    441440  // Do the copy here to try to avoid running out of memory.
    442441
    443   if (! isGapFree(*m)) {
    444     PresolveAction::throwCoinError("getMatrixByCol not gap free",
    445                                       "PrePostsolveMatrix");
    446   }
    447 
    448   CoinDisjointCopyN<int>(m->getVectorStarts(), ncols_, mcstrt_);
    449   mcstrt_[ncols_] = nelems_;
     442  const int * start = m->getVectorStarts();
     443  const int * length = m->getVectorLengths();
     444  const int * row = m->getIndices();
     445  const double * element = m->getElements();
     446  int icol,nel=0;
     447  mcstrt_[0]=0;
     448  for (icol=0;icol<ncols_;icol++) {
     449    int j;
     450    for (j=start[icol];j<start[icol]+length[icol];j++) {
     451      hrow_[nel]=row[j];
     452      colels_[nel++]=element[j];
     453    }
     454    mcstrt_[icol+1]=nel;
     455  }
     456  assert(mcstrt_[ncols_] == nelems_);
    450457  CoinDisjointCopyN(m->getVectorLengths(),ncols_,  hincol_);
    451   CoinDisjointCopyN(m->getIndices(),      nelems_, hrow_);
    452   CoinDisjointCopyN(m->getElements(),     nelems_, colels_);
    453458
    454459  // same thing for row rep
     
    495500
    496501#if 0
    497   for (int i=0; i<nrows; ++i)
     502  for (i=0; i<nrows; ++i)
    498503    printf("NR: %6d\n", hinrow[i]);
    499504  for (int i=0; i<ncols; ++i)
  • branches/devel-1/Test/ClpMain.cpp

    r33 r34  
    7474  DUALTOLERANCE=1,PRIMALTOLERANCE,DUALBOUND,PRIMALWEIGHT,
    7575
    76   LOGLEVEL=101,MAXFACTOR,PERTURBATION,MAXITERATION,PRESOLVE,
     76  LOGLEVEL=101,MAXFACTOR,PERTURBATION,MAXITERATION,PRESOLVEPASS,
    7777 
    7878  DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
    79   PRIMALPIVOT,
     79  PRIMALPIVOT,PRESOLVE,
    8080 
    8181  DIRECTORY=301,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,BAB,
     
    796796    parameters[numberParameters-1].append("off");
    797797    parameters[numberParameters++]=
    798       ClpItem("presolve","Whether to presolve problem - how many passes",
    799               0,100,PRESOLVE);
     798      ClpItem("presolve","Whether to presolve problem",
     799              "off",PRESOLVE);
     800    parameters[numberParameters-1].append("on");
     801    parameters[numberParameters++]=
     802      ClpItem("passP!resolve","How many passes in presolve",
     803              0,100,PRESOLVEPASS);
    800804    parameters[numberParameters++]=
    801805      ClpItem("spars!eFactor","Whether factorization treated as sparse",
     
    993997          int value = getIntField(argc,argv,&valid);
    994998          if (!valid) {
    995             if (parameters[iParam].type()==PRESOLVE)
     999            if (parameters[iParam].type()==PRESOLVEPASS)
    9961000              preSolve = value;
    9971001            else
     
    10581062            case KEEPNAMES:
    10591063              keepImportNames = 1-action;
     1064              break;
     1065            case PRESOLVE:
     1066              preSolve = action*5;
    10601067              break;
    10611068            default:
Note: See TracChangeset for help on using the changeset viewer.