MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / checkDualUnboundednessDirection

Function checkDualUnboundednessDirection

check/TestRays.cpp:54–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54bool checkDualUnboundednessDirection(
55 Highs& highs, const vector<double>& dual_unboundedness_direction_value) {
56 const HighsLp& lp = highs.getLp();
57 HighsInt numCol = lp.num_col_;
58 double dual_unboundedness_direction_error_norm = 0;
59 const vector<double>& colLower = lp.col_lower_;
60 const vector<double>& colUpper = lp.col_upper_;
61 // const vector<double>& rowLower = lp.row_lower_;
62 // const vector<double>& rowUpper = lp.row_upper_;
63 const vector<HighsBasisStatus>& col_status = highs.getBasis().col_status;
64 // const vector<HighsBasisStatus>& row_status = highs.getBasis().row_status;
65 for (HighsInt iCol = 0; iCol < numCol; iCol++) {
66 // Nothing to check if basic or fixed (so value can be anything)
67 if (col_status[iCol] == HighsBasisStatus::kBasic ||
68 colLower[iCol] == colUpper[iCol])
69 continue;
70 if (col_status[iCol] == HighsBasisStatus::kLower) {
71 // At lower bound so value should be non-positive
72 if (dual_unboundedness_direction_value[iCol] > 0) {
73 dual_unboundedness_direction_error_norm +=
74 fabs(dual_unboundedness_direction_value[iCol]);
75 if (dual_unboundedness_direction_value[iCol] >
76 zero_ray_value_tolerance &&
77 dev_run)
78 printf("Col %3" HIGHSINT_FORMAT
79 " is at lower bound so dual step should be "
80 "non-positive, and is %g\n",
81 iCol, dual_unboundedness_direction_value[iCol]);
82 }
83 } else if (col_status[iCol] == HighsBasisStatus::kUpper) {
84 // At upper bound so value should be non-negative
85 if (dual_unboundedness_direction_value[iCol] < 0) {
86 dual_unboundedness_direction_error_norm +=
87 fabs(dual_unboundedness_direction_value[iCol]);
88 if (dual_unboundedness_direction_value[iCol] <
89 -zero_ray_value_tolerance &&
90 dev_run)
91 printf("Col %3" HIGHSINT_FORMAT
92 " is at upper bound so dual step should be "
93 "non-negative, and is %g\n",
94 iCol, dual_unboundedness_direction_value[iCol]);
95 }
96 } else {
97 // Free so value should be zero
98 assert(col_status[iCol] == HighsBasisStatus::kZero);
99 if (fabs(dual_unboundedness_direction_value[iCol]) > 0) {
100 dual_unboundedness_direction_error_norm +=
101 fabs(dual_unboundedness_direction_value[iCol]);
102 if (fabs(dual_unboundedness_direction_value[iCol]) >
103 zero_ray_value_tolerance &&
104 dev_run)
105 printf("Col %3" HIGHSINT_FORMAT
106 " is free so dual step should be zero, and is %g\n",
107 iCol, dual_unboundedness_direction_value[iCol]);
108 }
109 }
110 }
111 if (dev_run)

Callers 4

checkDualRayValueFunction · 0.85
testInfeasibleMpsLpFunction · 0.85
testInfeasibleMpsMipFunction · 0.85
TestRays.cppFile · 0.85

Calls 1

getBasisMethod · 0.80

Tested by

no test coverage detected