Changeset 1878 for trunk/Clp/src/ClpSimplexDual.cpp
 Timestamp:
 Aug 30, 2012 11:43:19 AM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/ClpSimplexDual.cpp
r1868 r1878 569 569 ClpSimplexDual::dual(int ifValuesPass, int startFinishOptions) 570 570 { 571 //handler_>setLogLevel(63); 572 //yprintf("STARTing dual %d rows\n",numberRows_); 571 573 bestObjectiveValue_ = COIN_DBL_MAX; 572 574 algorithm_ = 1; … … 2628 2630 } 2629 2631 #endif 2630 double freeAlpha = 0.0;2632 //double freeAlpha = 0.0; 2631 2633 if (alreadyChosen < 0) { 2632 2634 // first see if any free variables and put them in basis … … 2678 2680 if (chosenRow >= 0) { 2679 2681 pivotRow_ = chosenRow; 2680 freeAlpha = work[chosenRow];2682 //freeAlpha = work[chosenRow]; 2681 2683 } 2682 2684 rowArray_[1]>clear(); … … 5195 5197 } else if (largestPrimalError_ > 1.0e5) { 5196 5198 { 5197 5199 //int iBigB = 1; 5198 5200 double bigB = 0.0; 5199 int iBigN = 1;5201 //int iBigN = 1; 5200 5202 double bigN = 0.0; 5201 5203 for (int i = 0; i < numberRows_ + numberColumns_; i++) { … … 5204 5206 if (value > bigB) { 5205 5207 bigB = value; 5206 iBigB = i;5208 //iBigB = i; 5207 5209 } 5208 5210 } else { 5209 5211 if (value > bigN) { 5210 5212 bigN = value; 5211 iBigN = i;5213 //iBigN = i; 5212 5214 } 5213 5215 } … … 5428 5430 return modified; 5429 5431 } 5432 #if ABC_NORMAL_DEBUG>0 5433 //#define PERT_STATISTICS 5434 #endif 5435 #ifdef PERT_STATISTICS 5436 static void breakdown(const char * name, int numberLook, const double * region) 5437 { 5438 double range[] = { 5439 COIN_DBL_MAX, 5440 1.0e15, 1.0e11, 1.0e8, 1.0e5, 1.0e4, 1.0e3, 1.0e2, 1.0e1, 5441 1.0, 5442 1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5, 1.0e8, 1.0e11, 1.0e15, 5443 0.0, 5444 1.0e15, 1.0e11, 1.0e8, 1.0e5, 1.0e4, 1.0e3, 1.0e2, 1.0e1, 5445 1.0, 5446 1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5, 1.0e8, 1.0e11, 1.0e15, 5447 COIN_DBL_MAX 5448 }; 5449 int nRanges = static_cast<int> (sizeof(range) / sizeof(double)); 5450 int * number = new int[nRanges]; 5451 memset(number, 0, nRanges * sizeof(int)); 5452 int * numberExact = new int[nRanges]; 5453 memset(numberExact, 0, nRanges * sizeof(int)); 5454 int i; 5455 for ( i = 0; i < numberLook; i++) { 5456 double value = region[i]; 5457 for (int j = 0; j < nRanges; j++) { 5458 if (value == range[j]) { 5459 numberExact[j]++; 5460 break; 5461 } else if (value < range[j]) { 5462 number[j]++; 5463 break; 5464 } 5465 } 5466 } 5467 printf("\n%s has %d entries\n", name, numberLook); 5468 for (i = 0; i < nRanges; i++) { 5469 if (number[i]) 5470 printf("%d between %g and %g", number[i], range[i1], range[i]); 5471 if (numberExact[i]) { 5472 if (number[i]) 5473 printf(", "); 5474 printf("%d exactly at %g", numberExact[i], range[i]); 5475 } 5476 if (number[i] + numberExact[i]) 5477 printf("\n"); 5478 } 5479 delete [] number; 5480 delete [] numberExact; 5481 } 5482 #endif 5430 5483 // Perturbs problem 5431 5484 int … … 5680 5733 double weight[] = {1.0e4, 1.0e2, 5.0e1, 1.0, 2.0, 5.0, 10.0, 20.0, 30.0, 40.0, 100.0}; 5681 5734 //double weight[]={1.0e4,1.0e2,5.0e1,1.0,20.0,50.0,100.0,120.0,130.0,140.0,200.0}; 5682 double extraWeight = 10.0;5735 //double extraWeight = 10.0; 5683 5736 // Scale back if wanted 5684 5737 double weight2[] = {1.0e4, 1.0e2, 5.0e1, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; 5685 5738 if (constantPerturbation < 99.0 * dualTolerance_) { 5686 5739 perturbation *= 0.1; 5687 extraWeight = 0.5;5740 //extraWeight = 0.5; 5688 5741 memcpy(weight, weight2, sizeof(weight2)); 5689 5742 } … … 5808 5861 //CoinZeroN(cost_+nTotal,nTotal); 5809 5862 // say perturbed 5863 #ifdef PERT_STATISTICS 5864 { 5865 double averageCost = 0.0; 5866 int numberNonZero = 0; 5867 double * COIN_RESTRICT sort = new double[numberColumns_]; 5868 for (int i = 0; i < numberColumns_; i++) { 5869 double value = fabs(cost_[i]); 5870 sort[i] = value; 5871 averageCost += value; 5872 if (value) 5873 numberNonZero++; 5874 } 5875 if (numberNonZero) 5876 averageCost /= static_cast<double> (numberNonZero); 5877 else 5878 averageCost = 1.0; 5879 std::sort(sort, sort + numberColumns_); 5880 int number = 1; 5881 double last = sort[0]; 5882 for (int i = 1; i < numberColumns_; i++) { 5883 if (last != sort[i]) 5884 number++; 5885 last = sort[i]; 5886 } 5887 printf("nnz %d percent %d", number, (number * 100) / numberColumns_); 5888 delete [] sort; 5889 breakdown("Objective", numberColumns_+numberRows_, cost_); 5890 } 5891 #endif 5810 5892 perturbation_ = 101; 5811 5893 return 0;
Note: See TracChangeset
for help on using the changeset viewer.