Ignore:
Timestamp:
Sep 17, 2002 9:15:14 AM (18 years ago)
Author:
forrest
Message:

Synchronizing

File:
1 edited

Legend:

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

    r19 r20  
    290290  numberTimesOptimal_=0;
    291291
     292  // Progress indicator
     293  ClpSimplexProgress progress(this);
     294
    292295  // This says whether to restore things etc
    293296  int factorType=0;
     
    322325#endif
    323326    // may factorize, checks if problem finished
    324     statusOfProblemInDual(lastCleaned,factorType);
     327    statusOfProblemInDual(lastCleaned,factorType,progress);
    325328
    326329    // Say good factorization
     
    336339  }
    337340
    338   assert(!numberFake_||problemStatus_); // all bounds should be okay
     341  //assert(!numberFake_||problemStatus_); // all bounds should be okay
    339342  // at present we are leaving factorization around
    340343  // maybe we should empty it
     
    15261529      oldValue = dj_[sequenceIn_];
    15271530      theta_ = oldValue/alpha;
     1531#if 0
     1532      if (numberIterations_>2000)
     1533        exit(99);
     1534      if (numberIterations_>2000-20)
     1535        handler_->setLogLevel(63);
     1536      if (numberIterations_>2000-20)
     1537        printf("theta %g oldValue %g tol %g %g\n",theta_,oldValue,dualTolerance_,
     1538               newTolerance);
     1539#endif
    15281540      if (theta_<MINIMUMTHETA) {
    15291541        // can't pivot to zero
     
    15521564            alpha=workColumn[iSequence];
    15531565          double value = dj_[iSequence]-theta_*alpha;
     1566#if 0
     1567          if (numberIterations_>2000-20)
     1568            printf("%d alpha %g value %g\n",iSequence,alpha,value);
     1569#endif
    15541570           
    15551571          // can't be free here
     
    15681584              dj_[iSequence] += modification;
    15691585              cost_[iSequence] +=  modification;
     1586#if 0
     1587              if (numberIterations_>2000-20)
     1588                printf("%d acost %g mod %g\n",iSequence,cost_[iSequence],
     1589                       modification);
     1590#endif
    15701591#endif
    15711592            }
     
    15821603              dj_[iSequence] += modification;
    15831604              cost_[iSequence] +=  modification;
     1605#if 0
     1606              if (numberIterations_>2000-20)
     1607                printf("%d bcost %g mod %g\n",iSequence,cost_[iSequence],
     1608                       modification);
     1609#endif
    15841610#endif
    15851611            }
     
    17081734/* Checks if finished.  Updates status */
    17091735void
    1710 ClpSimplexDual::statusOfProblemInDual(int & lastCleaned,int type)
     1736ClpSimplexDual::statusOfProblemInDual(int & lastCleaned,int type,
     1737                               ClpSimplexProgress &progress)
    17111738{
    17121739  if (type==2) {
     
    17551782  // get primal and dual solutions
    17561783  gutsOfSolution(rowActivityWork_,columnActivityWork_);
     1784  // Check if looping
     1785  int loop = progress.looping();
     1786  bool situationChanged=false;
     1787  if (loop>=0) {
     1788    problemStatus_ = loop; //exit if in loop
     1789    return;
     1790  } else if (loop<-1) {
     1791    // something may have changed
     1792    gutsOfSolution(rowActivityWork_,columnActivityWork_);
     1793    situationChanged=true;
     1794  }
     1795  progressFlag_ = 0; //reset progress flag
    17571796#ifdef CLP_DEBUG
    17581797  if (!rowScale_&&(handler_->logLevel()&32)) {
     
    17931832    numberDualInfeasibilitiesWithoutFree_;
    17941833  handler_->message()<<CoinMessageEol;
     1834
    17951835  while (problemStatus_<=-3) {
    17961836    bool cleanDuals=false;
     
    18001840      doOriginalTolerance=1;
    18011841    // check optimal
     1842    // give code benefit of doubt
     1843    if (sumOfRelaxedDualInfeasibilities_ == 0.0&&
     1844        sumOfRelaxedPrimalInfeasibilities_ == 0.0) {
     1845      // say optimal (with these bounds etc)
     1846      numberDualInfeasibilities_ = 0;
     1847      sumDualInfeasibilities_ = 0.0;
     1848      numberPrimalInfeasibilities_ = 0;
     1849      sumPrimalInfeasibilities_ = 0.0;
     1850    }
    18021851    if (dualFeasible()||problemStatus_==-4) {
    18031852      if (primalFeasible()) {
     
    18231872              factorization_->zeroTolerance(1.0e-15);
    18241873            }
     1874            cleanDuals=true;
    18251875          } else {
    18261876            problemStatus_=0; // optimal
     
    18571907        CoinFillN(columnArray_[0]->denseVector(),numberColumns_,0.0);
    18581908        CoinFillN(rowArray_[2]->denseVector(),numberRows_,0.0);
    1859       }
     1909      } 
    18601910      if (problemStatus_==-4) {
    18611911        // may be infeasible - or may be bounds are wrong
     
    21672217  int i;
    21682218  int returnCode=0;
    2169   double saveObjective = objectiveValue_;
     2219  double saveObjectiveValue = objectiveValue_;
    21702220#if 1
    21712221  algorithm_ = -1;
     
    22202270  memcpy(saveUpper,upper_,
    22212271         (numberRows_+numberColumns_)*sizeof(double));
     2272  double * saveObjective = new double[numberRows_+numberColumns_];
     2273  memcpy(saveObjective,cost_,
     2274         (numberRows_+numberColumns_)*sizeof(double));
    22222275  int * savePivot = new int [numberRows_];
    22232276  memcpy(savePivot, pivotVariable_, numberRows_*sizeof(int));
     
    22492302    memcpy(upper_,saveUpper,
    22502303           (numberRows_+numberColumns_)*sizeof(double));
     2304    memcpy(cost_,saveObjective,
     2305         (numberRows_+numberColumns_)*sizeof(double));
    22512306    columnUpper_[iColumn] = saveBound;
    22522307    memcpy(pivotVariable_, savePivot, numberRows_*sizeof(int));
     
    22552310
    22562311    if (status||(problemStatus_==0&&!isDualObjectiveLimitReached())) {
    2257       objectiveChange = objectiveValue_-saveObjective;
     2312      objectiveChange = objectiveValue_-saveObjectiveValue;
    22582313    } else {
    22592314      objectiveChange = 1.0e100;
     
    22842339    memcpy(upper_,saveUpper,
    22852340           (numberRows_+numberColumns_)*sizeof(double));
     2341    memcpy(cost_,saveObjective,
     2342         (numberRows_+numberColumns_)*sizeof(double));
    22862343    columnLower_[iColumn] = saveBound;
    22872344    memcpy(pivotVariable_, savePivot, numberRows_*sizeof(int));
     
    22902347
    22912348    if (status||(problemStatus_==0&&!isDualObjectiveLimitReached())) {
    2292       objectiveChange = objectiveValue_-saveObjective;
     2349      objectiveChange = objectiveValue_-saveObjectiveValue;
    22932350    } else {
    22942351      objectiveChange = 1.0e100;
     
    23292386  delete [] saveLower;
    23302387  delete [] saveUpper;
     2388  delete [] saveObjective;
    23312389  delete [] saveStatus;
    23322390  delete [] savePivot;
     
    23672425
    23682426    if (problemStatus_==0&&!isDualObjectiveLimitReached()) {
    2369       objectiveChange = objectiveValue_-saveObjective;
     2427      objectiveChange = objectiveValue_-saveObjectiveValue;
    23702428    } else {
    23712429      objectiveChange = 1.0e100;
     
    23892447
    23902448    if (problemStatus_==0&&!isDualObjectiveLimitReached()) {
    2391       objectiveChange = objectiveValue_-saveObjective;
     2449      objectiveChange = objectiveValue_-saveObjectiveValue;
    23922450    } else {
    23932451      objectiveChange = 1.0e100;
     
    24292487  delete [] saveStatus;
    24302488#endif
    2431   objectiveValue_ = saveObjective;
     2489  objectiveValue_ = saveObjectiveValue;
    24322490  return returnCode;
    24332491}
     
    24562514  // number of times we have declared optimality
    24572515  numberTimesOptimal_=0;
     2516
     2517  // Progress indicator
     2518  ClpSimplexProgress progress(this);
    24582519
    24592520  // This says whether to restore things etc
     
    24982559    // may factorize, checks if problem finished
    24992560    // should be able to speed this up on first time
    2500     statusOfProblemInDual(lastCleaned,factorType);
     2561    statusOfProblemInDual(lastCleaned,factorType,progress);
    25012562
    25022563    // Say good factorization
     
    25052566    // Do iterations
    25062567    if (problemStatus_<0) {
    2507 #if 1
    25082568      returnCode = whileIterating();
    25092569      if (!alwaysFinish&&returnCode<1) {
     
    25222582      }
    25232583      returnCode=0;
    2524 #else
    2525       whileIterating();
    2526 #endif
    25272584    }
    25282585  }
     
    25592616    }
    25602617  }
     2618  numberFake_ = numberFake;
    25612619  return numberFake;
    25622620}
Note: See TracChangeset for help on using the changeset viewer.