|
16 | 16 |
|
17 | 17 | #include <vector> |
18 | 18 |
|
| 19 | +#include "HighsLpRelaxation.h" |
19 | 20 | #include "lp_data/HConst.h" |
20 | 21 | #include "mip/HighsImplications.h" |
21 | 22 | #include "util/HighsCDouble.h" |
@@ -52,6 +53,30 @@ class HighsTransformedLp { |
52 | 53 |
|
53 | 54 | double boundDistance(HighsInt col) const { return boundDist[col]; } |
54 | 55 |
|
| 56 | + // TODO: Should this simple be calculated when we initialise the transLp? |
| 57 | + double getFracVbEstimate(HighsInt col) const { |
| 58 | + HighsInt vbCol = -1; |
| 59 | + double vbCoef = 0.0; |
| 60 | + if (ubDist[col] <= lbDist[col] && bestVlb[col].first != -1) { |
| 61 | + vbCol = bestVlb[col].first; |
| 62 | + vbCoef = bestVlb[col].second.coef; |
| 63 | + } else if (lbDist[col] <= ubDist[col] && bestVub[col].first != -1) { |
| 64 | + vbCol = bestVub[col].first; |
| 65 | + vbCoef = bestVub[col].second.coef; |
| 66 | + } else if (bestVlb[col].first != -1) { |
| 67 | + vbCol = bestVlb[col].first; |
| 68 | + vbCoef = bestVlb[col].second.coef; |
| 69 | + } else if (bestVub[col].first != -1) { |
| 70 | + vbCol = bestVub[col].first; |
| 71 | + vbCoef = bestVub[col].second.coef; |
| 72 | + } |
| 73 | + if (vbCol == -1) return 0; |
| 74 | + // TODO: This differs from the SCIP definition? Their frac can be > 1? |
| 75 | + double val = vbCoef * lprelaxation.solutionValue(col); |
| 76 | + double frac = std::max(val - std::floor(val), 0.0); |
| 77 | + return std::min(frac, 1 - frac); |
| 78 | + } |
| 79 | + |
55 | 80 | bool transform(std::vector<double>& vals, std::vector<double>& upper, |
56 | 81 | std::vector<double>& solval, std::vector<HighsInt>& inds, |
57 | 82 | double& rhs, bool& integralPositive, bool preferVbds = false); |
|
0 commit comments