Changeset 1721 for trunk/Clp


Ignore:
Timestamp:
Apr 6, 2011 9:28:52 AM (9 years ago)
Author:
forrest
Message:

a bit of debug and try and save memory in OsiClp?

Location:
trunk/Clp/src
Files:
2 edited

Legend:

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

    r1703 r1721  
    442442#ifdef COIN_PRESOLVE_BUG
    443443static int counter=1000000;
     444static int startEmptyRows=0;
     445static int startEmptyColumns=0;
    444446static bool break2(CoinPresolveMatrix *prob)
    445447{
     448  int droppedRows = prob->countEmptyRows() - startEmptyRows ;
     449  int droppedColumns =  prob->countEmptyCols() - startEmptyColumns;
     450  startEmptyRows=prob->countEmptyRows();
     451  startEmptyColumns=prob->countEmptyCols();
     452  printf("Dropped %d rows and %d columns - current empty %d, %d\n",droppedRows,
     453         droppedColumns,startEmptyRows,startEmptyColumns);
    446454  counter--;
    447455  if (!counter) {
     
    464472     CoinMessages messages = CoinMessage(prob->messages().language());
    465473     paction_ = 0;
    466 
     474#ifndef PRESOLVE_DETAIL
     475     if (prob->tuning_) {
     476#endif
     477       int numberEmptyRows=0;
     478       for ( int i=0;i<prob->nrows_;i++) {
     479         if (!prob->hinrow_[i]) {
     480           PRESOLVE_DETAIL_PRINT(printf("pre_empty row %d\n",i));
     481           //printf("pre_empty row %d\n",i);
     482           numberEmptyRows++;
     483         }
     484       }
     485       int numberEmptyCols=0;
     486       for ( int i=0;i<prob->ncols_;i++) {
     487         if (!prob->hincol_[i]) {
     488           PRESOLVE_DETAIL_PRINT(printf("pre_empty col %d\n",i));
     489           //printf("pre_empty col %d\n",i);
     490           numberEmptyCols++;
     491         }
     492       }
     493       printf("CoinPresolve initial state %d empty rows and %d empty columns\n",
     494              numberEmptyRows,numberEmptyCols);
     495#ifndef PRESOLVE_DETAIL
     496     }
     497#endif
    467498     prob->status_ = 0; // say feasible
    468499     paction_ = make_fixed(prob, paction_);
  • trunk/Clp/src/OsiClp/OsiClpSolverInterface.cpp

    r1718 r1721  
    173173    }
    174174  }
     175  ClpPresolve * pinfo = NULL;
    175176  /*
    176177    If basis then do primal (as user could do dual with resolve)
     
    226227    assert (gotHint);
    227228    if (strength!=OsiHintIgnore&&takeHint) {
    228       ClpPresolve pinfo;
    229       ClpSimplex * model2 = pinfo.presolvedModel(*solver,1.0e-8);
     229      pinfo = new ClpPresolve();
     230      ClpSimplex * model2 = pinfo->presolvedModel(*solver,1.0e-8);
    230231      if (!model2) {
    231232        // problem found to be infeasible - whats best?
    232233        model2 = solver;
     234        delete pinfo;
     235        pinfo = NULL;
    233236      } else {
    234237        model2->setSpecialOptions(solver->specialOptions());
     
    488491      if (model2!=solver) {
    489492        int presolvedStatus = model2->status();
    490         pinfo.postsolve(true);
     493        pinfo->postsolve(true);
     494        delete pinfo;
     495        pinfo = NULL;
    491496       
    492497        delete model2;
     498        int oldStatus=solver->status();
     499        solver->setProblemStatus(presolvedStatus);
     500        if (solver->logLevel()==63) // for gcc 4.6 bug
     501          printf("pstat %d stat %d\n",presolvedStatus,oldStatus);
    493502        //printf("Resolving from postsolved model\n");
    494503        // later try without (1) and check duals before solve
    495         if (presolvedStatus!=3) {
     504        if (presolvedStatus!=3
     505            &&(presolvedStatus||oldStatus==-1)) {
    496506          if (!inCbcOrOther||presolvedStatus!=1) {
    497507            disasterHandler_->setOsiModel(this);
     
    769779  modelPtr_->whatsChanged_ |= 0x30000;
    770780  //std::cout<<time1<<" seconds - total "<<totalTime<<std::endl;
     781  delete pinfo;
    771782}
    772783//-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.