diff --git a/cpp/src/dual_simplex/phase2.cpp b/cpp/src/dual_simplex/phase2.cpp index 76f4768abd..7383f42216 100644 --- a/cpp/src/dual_simplex/phase2.cpp +++ b/cpp/src/dual_simplex/phase2.cpp @@ -752,10 +752,9 @@ void clean_up_infeasibilities(std::vector& squared_infeasibilities, const f_t squared_infeas = squared_infeasibilities[j]; if (squared_infeas == 0.0) { // Set to the last element - const i_t sz = infeasibility_indices.size(); - infeasibility_indices[k] = infeasibility_indices[sz - 1]; + const i_t new_j = infeasibility_indices.back(); + infeasibility_indices[k] = new_j; infeasibility_indices.pop_back(); - i_t new_j = infeasibility_indices[k]; if (squared_infeasibilities[new_j] == 0.0) { k--; } } }