Skip to content

Commit 6fa6097

Browse files
committed
In getVariableKktFailures, using the primal residual, trucated so it's not greater than the tolerance when the primal infeasibility is zero
1 parent d3843d0 commit 6fa6097

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

highs/lp_data/HighsSolution.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,10 @@ void getKktFailures(const HighsOptions& options, const bool is_qp,
284284
// one-sided variables. For free variables, fixed variables, or
285285
// variables with small positive bound interval lengths,
286286
// mid_status is returned as kHighsSolutionNo.
287-
const HighsInt index = pass == 0 ? 0 : (is_col ? iVar : -(1+(iVar-lp.num_col_)));
288287
getVariableKktFailures(primal_feasibility_tolerance,
289288
dual_feasibility_tolerance, lower, upper, value,
290289
dual, integrality, primal_infeasibility,
291-
dual_infeasibility, at_status, mid_status,
292-
index);
290+
dual_infeasibility, at_status, mid_status);
293291
if (pass == 0) {
294292
// If the primal value is close to a bound then include the bound
295293
// in the active bound norm
@@ -551,9 +549,11 @@ void getVariableKktFailures(const double primal_feasibility_tolerance,
551549
const HighsVarType integrality,
552550
double& primal_infeasibility,
553551
double& dual_infeasibility, uint8_t& at_status,
554-
uint8_t& mid_status,
555-
const HighsInt index) {
556-
const HighsInt feasibility_tolerance_mu = 0.0;
552+
uint8_t& mid_status, const HighsInt index) {
553+
// Return the primal residual (ie infeasibility with zero tolerance)
554+
// as the primal infeasibility, ensuring (cf #2653) that it doesn't
555+
// exceed the primal feasibility tolerance if the standard primal
556+
// infeasibility (ie infeasibility exceeding the tolerance) is zero
557557
std::pair<double, double> infeasibility_residual =
558558
infeasibility(&lower, &value, &upper, &primal_feasibility_tolerance);
559559
primal_infeasibility = infeasibility_residual.second;

highs/lp_data/HighsSolution.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ void getVariableKktFailures(const double primal_feasibility_tolerance,
9090
const HighsVarType integrality,
9191
double& primal_infeasibility,
9292
double& dual_infeasibility, uint8_t& at_status,
93-
uint8_t& mid_status,
94-
const HighsInt index = 0);
93+
uint8_t& mid_status, const HighsInt index = 0);
9594

9695
void getPrimalDualGlpsolErrors(const HighsOptions& options, const HighsLp& lp,
9796
const std::vector<double>& gradient,

highs/util/HighsUtils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ inline T fractionality(T input, T* intval = nullptr) {
216216
}
217217

218218
inline std::pair<double, double> infeasibility(const double* lower,
219-
const double* value,
220-
const double* upper,
221-
const double* tolerance) {
219+
const double* value,
220+
const double* upper,
221+
const double* tolerance) {
222222
using std::fabs;
223223
using std::min;
224224
double residual = 0;

0 commit comments

Comments
 (0)