Skip to content

Commit 636d639

Browse files
committed
Added code to check that simplex_strategy is restored; added code to compute sum/max basic primal infeasibility in HEkkPrimal
1 parent 76ad3b6 commit 636d639

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

highs/lp_data/Highs.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3983,7 +3983,17 @@ HighsStatus Highs::callSolveLp(HighsLp& lp, const string message) {
39833983
assert(model_.lp_.a_matrix_.isColwise());
39843984

39853985
// Solve the LP
3986+
HighsInt simplex_strategy = options_.simplex_strategy;
39863987
return_status = solveLp(solver_object, message);
3988+
// Ensure that options_.simplex_strategy is reset to its initial
3989+
// value
3990+
const bool restored_simplex_strategy = options_.simplex_strategy == simplex_strategy;
3991+
if (!restored_simplex_strategy) {
3992+
// #2643
3993+
printf("Highs::callSolveLp options_.simplex_strategy = %d, but was %d\n",
3994+
int(options_.simplex_strategy), int(simplex_strategy));
3995+
}
3996+
assert(restored_simplex_strategy);
39873997
// Extract the model status
39883998
model_status_ = solver_object.model_status_;
39893999
return return_status;

highs/simplex/HEkkPrimal.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2773,6 +2773,10 @@ void HEkkPrimal::getBasicPrimalInfeasibility() {
27732773
max_primal_infeasibility = 0;
27742774
sum_primal_infeasibility = 0;
27752775

2776+
// #2643
2777+
HighsInt debug_num_primal_infeasibility = 0;
2778+
double debug_max_primal_infeasibility = 0;
2779+
double debug_sum_primal_infeasibility = 0;
27762780
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
27772781
double value = info.baseValue_[iRow];
27782782
double lower = info.baseLower_[iRow];
@@ -2791,6 +2795,19 @@ void HEkkPrimal::getBasicPrimalInfeasibility() {
27912795
std::max(primal_infeasibility, max_primal_infeasibility);
27922796
sum_primal_infeasibility += primal_infeasibility;
27932797
}
2798+
double debug_primal_infeasibility = 0;
2799+
if (value < lower) {
2800+
debug_primal_infeasibility = lower - value;
2801+
} else if (value > upper) {
2802+
debug_primal_infeasibility = value - upper;
2803+
}
2804+
if (debug_primal_infeasibility > 0) {
2805+
if (debug_primal_infeasibility > primal_feasibility_tolerance)
2806+
debug_num_primal_infeasibility++;
2807+
debug_max_primal_infeasibility =
2808+
std::max(debug_primal_infeasibility, debug_max_primal_infeasibility);
2809+
debug_sum_primal_infeasibility += debug_primal_infeasibility;
2810+
}
27942811
}
27952812
if (updated_num_primal_infeasibility >= 0) {
27962813
// The number of primal infeasibilities should be correct

0 commit comments

Comments
 (0)