#include <ClpPrimalColumnDantzig.hpp>
Inheritance diagram for ClpPrimalColumnDantzig:
Public Member Functions | |
Algorithmic methods | |
virtual int | pivotColumn (CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2) |
virtual void | saveWeights (ClpSimplex *model, int mode) |
Just sets model. | |
Constructors and destructors | |
ClpPrimalColumnDantzig () | |
Default Constructor. | |
ClpPrimalColumnDantzig (const ClpPrimalColumnDantzig &) | |
Copy constructor. | |
ClpPrimalColumnDantzig & | operator= (const ClpPrimalColumnDantzig &rhs) |
Assignment operator. | |
virtual | ~ClpPrimalColumnDantzig () |
Destructor. | |
virtual ClpPrimalColumnPivot * | clone (bool copyData=true) const |
Clone. |
This is simplest choice - choose largest infeasibility
Definition at line 16 of file ClpPrimalColumnDantzig.hpp.
|
Returns pivot column, -1 if none. Lumbers over all columns - slow The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row Can just do full price if you really want to be slow Implements ClpPrimalColumnPivot. Definition at line 59 of file ClpPrimalColumnDantzig.cpp. References ClpModel::clpMatrix(), ClpSimplex::currentPrimalTolerance(), CoinIndexedVector::denseVector(), ClpSimplex::djRegion(), ClpModel::dualTolerance(), ClpSimplex::factorization(), ClpSimplex::flagged(), CoinIndexedVector::getIndices(), CoinIndexedVector::getNumElements(), ClpSimplex::getStatus(), ClpSimplex::largestDualError(), ClpModel::numberColumns(), ClpModel::numberRows(), CoinIndexedVector::setNumElements(), and ClpMatrixBase::transposeTimes().
00064 { 00065 assert(model_); 00066 int iSection,j; 00067 int number; 00068 int * index; 00069 double * updateBy; 00070 double * reducedCost; 00071 00072 bool anyUpdates; 00073 00074 if (updates->getNumElements()) { 00075 anyUpdates=true; 00076 } else { 00077 // sub flip - nothing to do 00078 anyUpdates=false; 00079 } 00080 if (anyUpdates) { 00081 model_->factorization()->updateColumnTranspose(spareRow2,updates); 00082 // put row of tableau in rowArray and columnArray 00083 model_->clpMatrix()->transposeTimes(model_,-1.0, 00084 updates,spareColumn2,spareColumn1); 00085 for (iSection=0;iSection<2;iSection++) { 00086 00087 reducedCost=model_->djRegion(iSection); 00088 00089 if (!iSection) { 00090 number = updates->getNumElements(); 00091 index = updates->getIndices(); 00092 updateBy = updates->denseVector(); 00093 } else { 00094 number = spareColumn1->getNumElements(); 00095 index = spareColumn1->getIndices(); 00096 updateBy = spareColumn1->denseVector(); 00097 } 00098 00099 for (j=0;j<number;j++) { 00100 int iSequence = index[j]; 00101 double value = reducedCost[iSequence]; 00102 value -= updateBy[j]; 00103 updateBy[j]=0.0; 00104 reducedCost[iSequence] = value; 00105 } 00106 00107 } 00108 updates->setNumElements(0); 00109 spareColumn1->setNumElements(0); 00110 } 00111 00112 00113 // update of duals finished - now do pricing 00114 00115 double largest=model_->currentPrimalTolerance(); 00116 // we can't really trust infeasibilities if there is primal error 00117 if (model_->largestDualError()>1.0e-8) 00118 largest *= model_->largestDualError()/1.0e-8; 00119 00120 00121 00122 double bestDj = model_->dualTolerance(); 00123 int bestSequence=-1; 00124 00125 double bestFreeDj = model_->dualTolerance(); 00126 int bestFreeSequence=-1; 00127 00128 number = model_->numberRows()+model_->numberColumns(); 00129 int iSequence; 00130 reducedCost=model_->djRegion(); 00131 00132 for (iSequence=0;iSequence<number;iSequence++) { 00133 // check flagged variable 00134 if (!model_->flagged(iSequence)) { 00135 double value = reducedCost[iSequence]; 00136 ClpSimplex::Status status = model_->getStatus(iSequence); 00137 00138 switch(status) { 00139 00140 case ClpSimplex::basic: 00141 case ClpSimplex::isFixed: 00142 break; 00143 case ClpSimplex::isFree: 00144 case ClpSimplex::superBasic: 00145 if (fabs(value)>bestFreeDj) { 00146 bestFreeDj = fabs(value); 00147 bestFreeSequence = iSequence; 00148 } 00149 break; 00150 case ClpSimplex::atUpperBound: 00151 if (value>bestDj) { 00152 bestDj = value; 00153 bestSequence = iSequence; 00154 } 00155 break; 00156 case ClpSimplex::atLowerBound: 00157 if (value<-bestDj) { 00158 bestDj = -value; 00159 bestSequence = iSequence; 00160 } 00161 } 00162 } 00163 } 00164 // bias towards free 00165 if (bestFreeSequence>=0&&bestFreeDj > 0.1*bestDj) 00166 bestSequence = bestFreeSequence; 00167 return bestSequence; 00168 } |