Changeset 828


Ignore:
Timestamp:
Oct 21, 2007 1:04:00 PM (12 years ago)
Author:
forrest
Message:

fix maximize bug and possible memory leak

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/2.0/Cbc/src/CbcHeuristicFPump.cpp

    r776 r828  
    310310  double saveBestObjective = model_->getMinimizationObjValue();
    311311  int numberSolutions=0;
     312  OsiSolverInterface * solver = NULL;
    312313  while (!exitAll) {
    313314    int numberPasses=0;
    314315    numberTries++;
    315316    // Clone solver - otherwise annoys root node computations
    316     OsiSolverInterface * solver = model_->solver()->clone();
     317    solver = model_->solver()->clone();
    317318    if (CoinMin(fakeCutoff_,cutoff)<1.0e50) {
    318319      // Fix on djs
     
    358359        printf("CbcHeuristicFPump obj offset %g\n",offset);
    359360#endif
    360       solver->addRow(nel,which,els,-COIN_DBL_MAX,cutoff+offset);
     361      solver->addRow(nel,which,els,-COIN_DBL_MAX,cutoff+offset*direction);
    361362      delete [] which;
    362363      delete [] els;
     
    935936    }
    936937    delete solver;
     938    solver=NULL;
    937939    for ( j=0;j<NUMBER_OLD;j++)
    938940      delete [] oldSolution[j];
     
    11271129    }
    11281130  }
     1131  delete solver; // probably NULL but do anyway
    11291132  if (!finalReturnCode&&closestSolution&&closestObjectiveValue <= 10.0&&usedColumn) {
    11301133    // try a bit of branch and bound
Note: See TracChangeset for help on using the changeset viewer.