 Timestamp:
 Jul 12, 2007 12:24:52 PM (12 years ago)
 Location:
 branches/devel/Cbc/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

branches/devel/Cbc/src/CbcLinked.cpp
r685 r686 5651 5651 return infeasibility_; 5652 5652 } 5653 5653 // Sets infeasibility and other when pseudo shadow prices 5654 void 5655 OsiBiLinear::getPseudoShadow(const OsiBranchingInformation * info) 5656 { 5657 // order is LxLy, LxUy, UxLy and UxUy 5658 double xB[2]; 5659 double yB[2]; 5660 xB[0]=info>lower_[xColumn_]; 5661 xB[1]=info>upper_[xColumn_]; 5662 yB[0]=info>lower_[yColumn_]; 5663 yB[1]=info>upper_[yColumn_]; 5664 double x = info>solution_[xColumn_]; 5665 x = CoinMax(x,xB[0]); 5666 x = CoinMin(x,xB[1]); 5667 double y = info>solution_[yColumn_]; 5668 y = CoinMax(y,yB[0]); 5669 y = CoinMin(y,yB[1]); 5670 int j; 5671 double xyTrue = x*y; 5672 double xyLambda = 0.0; 5673 if ((branchingStrategy_&4)==0) { 5674 for (j=0;j<4;j++) { 5675 int iX = j>>1; 5676 int iY = j&1; 5677 xyLambda += xB[iX]*yB[iY]*info>solution_[firstLambda_+j]; 5678 } 5679 } else { 5680 if (xyRow_>=0) { 5681 const double * element = info>elementByColumn_; 5682 const int * row = info>row_; 5683 const CoinBigIndex * columnStart = info>columnStart_; 5684 const int * columnLength = info>columnLength_; 5685 for (j=0;j<4;j++) { 5686 int iColumn = firstLambda_+j; 5687 int iStart = columnStart[iColumn]; 5688 int iEnd = iStart + columnLength[iColumn]; 5689 int k=iStart; 5690 double sol = info>solution_[iColumn]; 5691 for (;k<iEnd;k++) { 5692 if (xyRow_==row[k]) 5693 xyLambda += element[k]*sol; 5694 } 5695 } 5696 } else { 5697 // objective 5698 const double * objective = info>objective_; 5699 for (j=0;j<4;j++) { 5700 int iColumn = firstLambda_+j; 5701 double sol = info>solution_[iColumn]; 5702 xyLambda += objective[iColumn]*sol; 5703 } 5704 } 5705 xyLambda /= coefficient_; 5706 } 5707 assert (info>defaultDual_>=0.0); 5708 // If we move to xy then we move by coefficient * (xyTruexyLambda) on row xyRow_ 5709 double movement = xyTruexyLambda; 5710 infeasibility_=0.0; 5711 const double * pi = info>pi_; 5712 const double * activity = info>rowActivity_; 5713 const double * lower = info>rowLower_; 5714 const double * upper = info>rowUpper_; 5715 double tolerance = info>primalTolerance_; 5716 double direction = info>direction_; 5717 if (xyRow_>=0) { 5718 assert (!boundType_); 5719 if (lower[xyRow_]<1.0e20) 5720 assert (pi[xyRow_]<=1.0e3); 5721 if (upper[xyRow_]>1.0e20) 5722 assert (pi[xyRow_]>=1.0e3); 5723 double valueP = pi[xyRow_]*direction; 5724 // if move makes infeasible then make at least default 5725 double newValue = activity[xyRow_] + movement*coefficient_; 5726 if (newValue>upper[xyRow_]+tolerancenewValue<lower[xyRow_]tolerance) 5727 infeasibility_ += fabs(movement*coefficient_)*CoinMax(fabs(valueP),info>defaultDual_); 5728 } else { 5729 // objective 5730 assert (movement>1.0e7); 5731 infeasibility_ += movement; 5732 } 5733 for (int i=0;i<numberExtraRows_;i++) { 5734 int iRow = extraRow_[i]; 5735 if (lower[iRow]<1.0e20) 5736 assert (pi[iRow]<=1.0e3); 5737 if (upper[iRow]>1.0e20) 5738 assert (pi[iRow]>=1.0e3); 5739 double valueP = pi[iRow]*direction; 5740 // if move makes infeasible then make at least default 5741 double newValue = activity[iRow] + movement*multiplier_[i]; 5742 if (newValue>upper[iRow]+tolerancenewValue<lower[iRow]tolerance) 5743 infeasibility_ += fabs(movement*multiplier_[i])*CoinMax(fabs(valueP),info>defaultDual_); 5744 } 5745 if (infeasibility_<1.0e7) 5746 infeasibility_=0.0; 5747 otherInfeasibility_ = CoinMax(1.0e12,infeasibility_*10.0); 5748 } 5654 5749 // This looks at solution and sets bounds to contain solution 5655 5750 double … … 6821 6916 if (newUp>upper[iRow]+tolerancenewUp<lower[iRow]tolerance) 6822 6917 u = CoinMax(u,info>defaultDual_); 6823 upEstimate += u*upMovement ;6918 upEstimate += u*upMovement*fabs(el2); 6824 6919 // if down makes infeasible then make at least default 6825 6920 double newDown = activity[iRow]  downMovement*el2; 6826 6921 if (newDown>upper[iRow]+tolerancenewDown<lower[iRow]tolerance) 6827 6922 d = CoinMax(d,info>defaultDual_); 6828 downEstimate += d*downMovement ;6923 downEstimate += d*downMovement*fabs(el2); 6829 6924 } 6830 6925 if (downEstimate>=upEstimate) { 
branches/devel/Cbc/src/CbcLinked.hpp
r680 r686 851 851 /// Compute lambdas if coefficients not changing 852 852 void computeLambdas(const OsiSolverInterface * solver,double lambda[4]) const; 853 /// Sets infeasibility and other when pseudo shadow prices 854 void getPseudoShadow(const OsiBranchingInformation * info); 853 855 /// data 854 856
Note: See TracChangeset
for help on using the changeset viewer.