 Timestamp:
 Aug 10, 2007 7:09:08 PM (13 years ago)
 Location:
 branches/BSP/trunk/Cbc/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

branches/BSP/trunk/Cbc/src/CbcFathomDynamicProgramming.cpp
r702 r743 259 259 numberActive_=numberActive; 260 260 indices_ = new int [numberActive_]; 261 cost_ = new float[size_];262 CoinFillN(cost_,size_, FLT_MAX);261 cost_ = new double [size_]; 262 CoinFillN(cost_,size_,DBL_MAX); 263 263 // but do nothing is okay 264 264 cost_[0]=0.0; … … 475 475 int i; 476 476 // may be possible 477 double bestAtTarget = FLT_MAX;477 double bestAtTarget = DBL_MAX; 478 478 for (i=0;i<numberColumns;i++) { 479 479 if (size_>10000000&&(i%100)==0) … … 481 481 double lowerValue = lower[i]; 482 482 assert (lowerValue==floor(lowerValue)); 483 floatcost = direction * objective[i];483 double cost = direction * objective[i]; 484 484 fixedObj += lowerValue*cost; 485 485 int gap = (int) (upper[i]lowerValue); … … 494 494 returnCode=1; 495 495 int needed=0; 496 float bestValue=FLT_MAX;496 double bestValue=DBL_MAX; 497 497 int iBest=1; 498 498 if (algorithm_==0) { … … 554 554 delete [] lower; 555 555 } 556 if (bestValue< FLT_MAX) {556 if (bestValue<DBL_MAX) { 557 557 bestValue += fixedObj; 558 558 if (model_>messageHandler()>logLevel()>1) … … 565 565 int n=decodeBitPattern(iBestback_[iBest],indices_,numberRows); 566 566 // Search for cheapest 567 float bestCost=FLT_MAX;567 double bestCost=DBL_MAX; 568 568 int iColumn=1; 569 569 for (i=0;i<numberColumns;i++) { … … 632 632 bool 633 633 CbcFathomDynamicProgramming::tryColumn(int numberElements, const int * rows, 634 const double * coefficients, floatcost,634 const double * coefficients, double cost, 635 635 int upper) 636 636 { … … 693 693 bool 694 694 CbcFathomDynamicProgramming::addOneColumn0(int numberElements, const int * rows, 695 floatcost)695 double cost) 696 696 { 697 697 // build up mask … … 708 708 int kMask = i&mask; 709 709 if (kMask==0) { 710 floatthisCost = cost_[i];711 if (thisCost!= FLT_MAX) {710 double thisCost = cost_[i]; 711 if (thisCost!=DBL_MAX) { 712 712 // possible 713 floatnewCost=thisCost+cost;713 double newCost=thisCost+cost; 714 714 int next = i + mask; 715 715 if (cost_[next]>newCost) { … … 740 740 bool 741 741 CbcFathomDynamicProgramming::addOneColumn1(int numberElements, const int * rows, 742 const int * coefficients, floatcost)742 const int * coefficients, double cost) 743 743 { 744 744 /* build up masks. … … 824 824 if (good) { 825 825 double thisCost = cost_[i]; 826 if (thisCost!= FLT_MAX) {826 if (thisCost!=DBL_MAX) { 827 827 // possible 828 828 double newCost=thisCost+cost; … … 858 858 bool 859 859 CbcFathomDynamicProgramming::addOneColumn1A(int numberElements, const int * rows, 860 const int * coefficients, floatcost)860 const int * coefficients, double cost) 861 861 { 862 862 /* build up masks. … … 899 899 int kMask = i&maskA; 900 900 if (kMask==0) { 901 floatthisCost = cost_[i];902 if (thisCost!= FLT_MAX) {901 double thisCost = cost_[i]; 902 if (thisCost!=DBL_MAX) { 903 903 // possible 904 floatnewCost=thisCost+cost;904 double newCost=thisCost+cost; 905 905 int next = i + maskAdd; 906 906 if (cost_[next]>newCost) { … … 926 926 added &= (~maskD); 927 927 if (added == 0) { 928 floatthisCost = cost_[i];929 if (thisCost!= FLT_MAX) {928 double thisCost = cost_[i]; 929 if (thisCost!=DBL_MAX) { 930 930 // possible 931 floatnewCost=thisCost+cost;931 double newCost=thisCost+cost; 932 932 int next = i + maskAdd; 933 933 if (cost_[next]>newCost) { 
branches/BSP/trunk/Cbc/src/CbcFathomDynamicProgramming.hpp
r706 r743 68 68 */ 69 69 bool tryColumn(int numberElements, const int * rows, 70 const double * coefficients, floatcost,70 const double * coefficients, double cost, 71 71 int upper=COIN_INT_MAX); 72 72 /// Returns cost array 73 inline const float* cost() const73 inline const double * cost() const 74 74 { return cost_;} 75 75 /// Returns back array … … 90 90 */ 91 91 bool addOneColumn0(int numberElements, const int * rows, 92 floatcost);92 double cost); 93 93 /** Adds one attempt of one column of type 1, 94 94 returns true if was used in making any changes. … … 96 96 */ 97 97 bool addOneColumn1(int numberElements, const int * rows, 98 const int * coefficients, floatcost);98 const int * coefficients, double cost); 99 99 /** Adds one attempt of one column of type 1, 100 100 returns true if was used in making any changes. … … 103 103 */ 104 104 bool addOneColumn1A(int numberElements, const int * rows, 105 const int * coefficients, floatcost);105 const int * coefficients, double cost); 106 106 /// Gets bit pattern from original column 107 107 int bitPattern(int numberElements, const int * rows, … … 121 121 */ 122 122 int type_; 123 /// Space for states (float as who cares)124 float* cost_;123 /// Space for states 124 double * cost_; 125 125 /// Which state produced this cheapest one 126 126 int * back_;
Note: See TracChangeset
for help on using the changeset viewer.