Changeset 80
 Timestamp:
 Jan 2, 2003 10:14:57 AM (18 years ago)
 Location:
 trunk
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

trunk/ClpSimplex.cpp
r69 r80 1814 1814 // these are "indexed" arrays so we always know where nonzeros are 1815 1815 /********************************************************** 1816 rowArray_[3] is long enough for columns as well1816 rowArray_[3] is long enough for rows+columns 1817 1817 *********************************************************/ 1818 1818 for (iRow=0;iRow<4;iRow++) { … … 1821 1821 int length =numberRows_+factorization_>maximumPivots(); 1822 1822 if (iRow==3) 1823 length = max(length,numberColumns_);1823 length += numberColumns_; 1824 1824 rowArray_[iRow]>reserve(length); 1825 1825 } … … 3137 3137 deleteRim(false); 3138 3138 } 3139 /* Crash  at present just aimed at dual, returns 3140 2 if dual preferred and crash basis created 3141 1 if dual preferred and all slack basis preferred 3142 0 if basis going in was not all slack 3143 1 if primal preferred and all slack basis preferred 3144 2 if primal preferred and crash basis created. 3145 3146 if gap between bounds <="gap" variables can be flipped 3147 3148 If "pivot" is 3149 0 No pivoting (so will just be choice of algorithm) 3150 1 Simple pivoting e.g. gub 3151 2 Mini iterations 3152 */ 3153 int 3154 ClpSimplex::crash(double gap,int pivot) 3155 { 3156 assert(!pivot); // rest not coded yet 3157 assert(!rowObjective_); // not coded 3158 int i; 3159 int numberBad=0; 3160 int numberBasic=0; 3161 3162 // If no basis then make all slack one 3163 if (!status_) 3164 createStatus(); 3165 3166 for (i=0;i<numberColumns_;i++) { 3167 if (getColumnStatus(i)==basic) 3168 numberBasic++; 3169 } 3170 if (numberBasic) { 3171 // not all slack 3172 return 0; 3173 } else { 3174 for (i=0;i<numberColumns_;i++) { 3175 // assume natural place is closest to zero 3176 double lowerBound = columnLower_[i]; 3177 double upperBound = columnUpper_[i]; 3178 if (lowerBound>1.0e20upperBound<1.0e20) { 3179 bool atLower; 3180 if (fabs(upperBound)<fabs(lowerBound)) { 3181 atLower=false; 3182 setColumnStatus(i,atUpperBound); 3183 } else { 3184 atLower=true; 3185 setColumnStatus(i,atLowerBound); 3186 } 3187 if (optimizationDirection_*objective_[i]<0.0) { 3188 // should be at upper bound 3189 if (atLower) { 3190 // can we flip 3191 if (upperBoundlowerBound<=gap) { 3192 columnActivity_[i]=upperBound; 3193 setColumnStatus(i,atUpperBound); 3194 } else { 3195 numberBad++; 3196 } 3197 } 3198 } else if (optimizationDirection_*objective_[i]>0.0) { 3199 // should be at lower bound 3200 if (!atLower) { 3201 // can we flip 3202 if (upperBoundlowerBound<=gap) { 3203 columnActivity_[i]=lowerBound; 3204 setColumnStatus(i,atLowerBound); 3205 } else { 3206 numberBad++; 3207 } 3208 } 3209 } 3210 } else { 3211 // free 3212 setColumnStatus(i,isFree); 3213 if (objective_[i]) 3214 numberBad++; 3215 } 3216 } 3217 if (numberBad) { 3218 if (!pivot) { 3219 return 1; 3220 } else { 3221 // see if can be made dual feasible with gubs etc 3222 // steal coding from tightenPrimalBounds 3223 // Get column copy 3224 CoinPackedMatrix * columnCopy = matrix(); 3225 // Get a row copy in standard format 3226 CoinPackedMatrix copy; 3227 copy.reverseOrderedCopyOf(*columnCopy); 3228 // get matrix data pointers 3229 #if 0 3230 const int * column = copy.getIndices(); 3231 const CoinBigIndex * rowStart = copy.getVectorStarts(); 3232 const int * rowLength = copy.getVectorLengths(); 3233 const double * elementByRow = copy.getElements(); 3234 const int * row = columnCopy>getIndices(); 3235 const CoinBigIndex * columnStart = columnCopy>getVectorStarts(); 3236 const int * columnLength = columnCopy>getVectorLengths(); 3237 const double * element = columnCopy>getElements(); 3238 // if equality row and bounds mean artificial in basis bad 3239 // then do anyway 3240 #endif 3241 abort(); 3242 return 1; 3243 } 3244 } else { 3245 return 1; 3246 } 3247 } 3248 } 
trunk/ClpSimplexDual.cpp
r75 r80 1845 1845 ClpDisjointCopyN(rowActivityWork_,numberRows_, 1846 1846 rowArray_[2]>denseVector()); 1847 numberChangedBounds=changeBounds(false,rowArray_[ 0],changeCost);1847 numberChangedBounds=changeBounds(false,rowArray_[3],changeCost); 1848 1848 if (numberChangedBounds<=0) { 1849 1849 //looks optimal  do we need to reset tolerance 
trunk/include/ClpSimplex.hpp
r78 r80 146 146 */ 147 147 int tightenPrimalBounds(); 148 /** Crash  at present just aimed at dual, returns 149 2 if dual preferred and crash basis created 150 1 if dual preferred and all slack basis preferred 151 0 if basis going in was not all slack 152 1 if primal preferred and all slack basis preferred 153 2 if primal preferred and crash basis created. 154 155 if gap between bounds <="gap" variables can be flipped 156 157 If "pivot" is 158 0 No pivoting (so will just be choice of algorithm) 159 1 Simple pivoting e.g. gub 160 2 Mini iterations 161 */ 162 int crash(double gap,int pivot); 148 163 /// Sets row pivot choice algorithm in dual 149 164 void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
Note: See TracChangeset
for help on using the changeset viewer.