Changeset 276


Ignore:
Timestamp:
Dec 16, 2003 2:51:48 PM (16 years ago)
Author:
forrest
Message:

Stuff for gub

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpPrimalColumnSteepest.cpp

    r259 r276  
    240240        numberWanted = 1000;
    241241        numberWanted = max(numberWanted,numberLook/10);
    242       } else {
     242      } else if (mode_!=5) {
    243243        switchType=4;
    244244        // initialize
     
    367367      numberWanted = max(2000,number/10);
    368368      numberWanted = max(numberWanted,numberColumns/30);
    369     } else {
     369    } else if (mode_!=5) {
    370370      switchType=4;
    371371      // initialize
     
    23882388      numberWanted = max(2000,number/10);
    23892389      numberWanted = max(numberWanted,numberColumns/30);
    2390     } else {
     2390    } else if (mode_!=5) {
    23912391      switchType=4;
    23922392      // initialize
     
    27352735{
    27362736  model_ = model;
    2737   if (mode_==4) {
     2737  if (mode_==4||mode_==5) {
    27382738    if (mode==1&&!weights_)
    27392739      numberSwitched_=0; // Reset
     
    27602760    if (!weights_||state_==-1||mode==5) {
    27612761      // Partial is only allowed with certain types of matrix
    2762       if (mode_!=4||numberSwitched_||!model_->clpMatrix()->canDoPartialPricing()) {
     2762      if ((mode_!=4&&mode_!=5)||numberSwitched_||!model_->clpMatrix()->canDoPartialPricing()) {
    27632763        // initialize weights
    27642764        delete [] weights_;
     
    29512951ClpPrimalColumnSteepest::unrollWeights()
    29522952{
    2953   if (mode_==4&&!numberSwitched_)
     2953  if ((mode_==4||mode_==5)&&!numberSwitched_)
    29542954    return;
    29552955  double * saved = alternateWeights_->denseVector();
     
    29832983  if (mode_==4&&numberSwitched_)
    29842984    switchType=3;
    2985   else if (mode_==4)
     2985  else if (mode_==4||mode_==5)
    29862986    return;
    29872987  int number=input->getNumElements();
     
    30153015        alternateWeights_->setNumElements(number);
    30163016      } else {
    3017         if (mode_!=4||numberSwitched_>1) {
     3017        if ((mode_!=4&&mode_!=5)||numberSwitched_>1) {
    30183018          for (i=0;i<number;i++) {
    30193019            int iRow = which[i];
     
    30813081        alternateWeights_->setNumElements(number);
    30823082      } else {
    3083         if (mode_!=4||numberSwitched_>1) {
     3083        if ((mode_!=4&&mode_!=5)||numberSwitched_>1) {
    30843084          for (i=0;i<number;i++) {
    30853085            int iRow = which[i];
     
    31753175                                       CoinIndexedVector * rowArray2)
    31763176{
    3177   if (mode_==4&&!numberSwitched_)
     3177  if ((mode_==4||mode_==5)&&!numberSwitched_)
    31783178    return;
    31793179  model_->unpack(rowArray1,sequence);
  • trunk/ClpSimplex.cpp

    r275 r276  
    375375  int iRow;
    376376  // order is this way for scaling
    377   // Use whole matrix every time to make it easier for ClpMatrixBase
    378   // So zero out basic
    379377  if (columnActivities!=columnActivityWork_)
    380378    ClpDisjointCopyN(columnActivities,numberColumns_,columnActivityWork_);
    381379  if (rowActivities!=rowActivityWork_)
    382380    ClpDisjointCopyN(rowActivities,numberRows_,rowActivityWork_);
    383   for (iRow=0;iRow<numberRows_;iRow++) {
    384     int iPivot=pivotVariable_[iRow];
    385     solution_[iPivot] = 0.0;
    386   }
    387   // Extended solution before "update"
    388   matrix_->primalExpanded(this,0);
    389381  double * array = arrayVector.denseVector();
    390   times(-1.0,columnActivityWork_,array);
    391 
     382  if (!matrix_->effectiveRhs(this)) {
     383    // Use whole matrix every time to make it easier for ClpMatrixBase
     384    // So zero out basic
     385    for (iRow=0;iRow<numberRows_;iRow++) {
     386      int iPivot=pivotVariable_[iRow];
     387      solution_[iPivot] = 0.0;
     388    }
     389    // Extended solution before "update"
     390    matrix_->primalExpanded(this,0);
     391    times(-1.0,columnActivityWork_,array);
     392  } else {
     393    // we have an effective rhs lying around
     394    CoinCopyN(matrix_->effectiveRhs(this),numberRows_,array);
     395  }
    392396  int * index = arrayVector.getIndices();
    393397  int number=0;
     
    11541158ClpSimplex::housekeeping(double objectiveChange)
    11551159{
     1160  // save value of incoming
     1161  double oldIn = solution_[sequenceIn_];
    11561162  numberIterations_++;
    11571163  changeMade_++; // something has happened
     
    12041210      // as if from lower bound
    12051211      setStatus(sequenceIn_, atUpperBound);
     1212    }
     1213  }
     1214  if (matrix_->effectiveRhs(this)) {
     1215    // update effective rhs
     1216    if (sequenceIn_==sequenceOut_) {
     1217      matrix_->add(this,matrix_->effectiveRhs(this),sequenceIn_,solution_[sequenceIn_]-oldIn);
     1218    } else {
     1219      matrix_->add(this,matrix_->effectiveRhs(this),sequenceIn_,-oldIn);
     1220      matrix_->add(this,matrix_->effectiveRhs(this),sequenceOut_,solution_[sequenceOut_]);
    12061221    }
    12071222  }
     
    17171732  matrix_->primalExpanded(this,2);
    17181733  solution = columnActivityWork_;
    1719   for (iColumn=0;iColumn<numberColumns_;iColumn++) {
    1720     //assert (fabs(solution[iColumn])<1.0e15||getColumnStatus(iColumn) == basic);
    1721     double infeasibility=0.0;
    1722     objectiveValue_ += objectiveWork_[iColumn]*solution[iColumn];
    1723     if (solution[iColumn]>columnUpperWork_[iColumn]) {
    1724       infeasibility=solution[iColumn]-columnUpperWork_[iColumn];
    1725     } else if (solution[iColumn]<columnLowerWork_[iColumn]) {
    1726       infeasibility=columnLowerWork_[iColumn]-solution[iColumn];
    1727     }
    1728     if (infeasibility>columnPrimalInfeasibility_) {
    1729       columnPrimalInfeasibility_=infeasibility;
    1730       columnPrimalSequence_=iColumn;
    1731     }
    1732     if (infeasibility>primalTolerance) {
    1733       sumPrimalInfeasibilities_ += infeasibility-primalTolerance_;
    1734       if (infeasibility>relaxedTolerance)
    1735         sumOfRelaxedPrimalInfeasibilities_ += infeasibility-relaxedTolerance;
    1736       numberPrimalInfeasibilities_ ++;
    1737     }
    1738     infeasibility = fabs(columnActivities[iColumn]-solution[iColumn]);
    1739     if (infeasibility>largestSolutionError_)
    1740       largestSolutionError_=infeasibility;
     1734  if (!matrix_->effectiveRhs(this)) {
     1735    for (iColumn=0;iColumn<numberColumns_;iColumn++) {
     1736      //assert (fabs(solution[iColumn])<1.0e15||getColumnStatus(iColumn) == basic);
     1737      double infeasibility=0.0;
     1738      objectiveValue_ += objectiveWork_[iColumn]*solution[iColumn];
     1739      if (solution[iColumn]>columnUpperWork_[iColumn]) {
     1740        infeasibility=solution[iColumn]-columnUpperWork_[iColumn];
     1741      } else if (solution[iColumn]<columnLowerWork_[iColumn]) {
     1742        infeasibility=columnLowerWork_[iColumn]-solution[iColumn];
     1743      }
     1744      if (infeasibility>columnPrimalInfeasibility_) {
     1745        columnPrimalInfeasibility_=infeasibility;
     1746        columnPrimalSequence_=iColumn;
     1747      }
     1748      if (infeasibility>primalTolerance) {
     1749        sumPrimalInfeasibilities_ += infeasibility-primalTolerance_;
     1750        if (infeasibility>relaxedTolerance)
     1751          sumOfRelaxedPrimalInfeasibilities_ += infeasibility-relaxedTolerance;
     1752        numberPrimalInfeasibilities_ ++;
     1753      }
     1754      infeasibility = fabs(columnActivities[iColumn]-solution[iColumn]);
     1755      if (infeasibility>largestSolutionError_)
     1756        largestSolutionError_=infeasibility;
     1757    }
     1758  } else {
     1759    // as we are using effective rhs we only check basics
     1760    for (int j=0;j<numberRows_;j++) {
     1761      int iColumn = pivotVariable_[j];
     1762      //assert (fabs(solution[iColumn])<1.0e15||getColumnStatus(iColumn) == basic);
     1763      double infeasibility=0.0;
     1764      objectiveValue_ += objectiveWork_[iColumn]*solution[iColumn];
     1765      if (solution[iColumn]>columnUpperWork_[iColumn]) {
     1766        infeasibility=solution[iColumn]-columnUpperWork_[iColumn];
     1767      } else if (solution[iColumn]<columnLowerWork_[iColumn]) {
     1768        infeasibility=columnLowerWork_[iColumn]-solution[iColumn];
     1769      }
     1770      if (infeasibility>columnPrimalInfeasibility_) {
     1771        columnPrimalInfeasibility_=infeasibility;
     1772        columnPrimalSequence_=iColumn;
     1773      }
     1774      if (infeasibility>primalTolerance) {
     1775        sumPrimalInfeasibilities_ += infeasibility-primalTolerance_;
     1776        if (infeasibility>relaxedTolerance)
     1777          sumOfRelaxedPrimalInfeasibilities_ += infeasibility-relaxedTolerance;
     1778        numberPrimalInfeasibilities_ ++;
     1779      }
     1780      infeasibility = fabs(columnActivities[iColumn]-solution[iColumn]);
     1781      if (infeasibility>largestSolutionError_)
     1782        largestSolutionError_=infeasibility;
     1783    }
    17411784  }
    17421785}
     
    17511794  columnDualInfeasibility_=0.0;
    17521795  columnDualSequence_=-1;
     1796  if (matrix_->skipDualCheck()&&algorithm_>0&&problemStatus_==-2) {
     1797    // pretend we found dual infeasibilities
     1798    sumOfRelaxedDualInfeasibilities_ = 1.0;
     1799    sumDualInfeasibilities_=1.0;
     1800    numberDualInfeasibilities_=1;
     1801    return;
     1802  }
    17531803  rowDualInfeasibility_=0.0;
    17541804  rowDualSequence_=-1;
  • trunk/include/ClpPrimalColumnSteepest.hpp

    r256 r276  
    194194      3 switches between 0 and 2 depending on factorization
    195195      4 starts as partial dantzig/devex but then may switch between 0 and 2.
     196      5 is always partial dantzig
    196197      By partial exact devex is meant that the weights are updated as normal
    197198      but only part of the nonbasic variables are scanned. 
     
    199200
    200201      New dubious option is >=10 which does mini-sprint
     202
    201203  */
    202204  int mode_;
Note: See TracChangeset for help on using the changeset viewer.