fix crash in glop

This commit is contained in:
Laurent Perron
2023-12-04 13:42:21 +01:00
parent 2b561533ac
commit f6b18c3a5c
2 changed files with 14 additions and 0 deletions

View File

@@ -64,6 +64,9 @@ Status LuFactorization::ComputeFactorization(
stats_.lu_fill_in.Add(GetFillInPercentage(matrix));
stats_.basis_num_entries.Add(matrix.num_entries().value());
});
// TODO(user): This might fail on badly scaled matrices.
// I still prefer to keep it as a DCHECK for tests though.
DCHECK(CheckFactorization(matrix, Fractional(1e-6)));
return Status::OK();
}

View File

@@ -3304,6 +3304,17 @@ Status RevisedSimplex::DualMinimize(bool feasibility_phase,
}
}
// This is to avoid crashes below. It seems to happen rarely on a few miplib
// problem like rmine11.pb.gz in multithread.
//
// TODO(user): Try to recover instead.
if (std::abs(direction_[leaving_row]) <= 1e-20) {
const std::string error_message = absl::StrCat(
"trying to pivot with number too small: ", direction_[leaving_row]);
SOLVER_LOG(logger_, error_message);
return Status(Status::ERROR_LU, error_message);
}
// This test takes place after the check for optimality/feasibility because
// when running with 0 iterations, we still want to report
// ProblemStatus::OPTIMAL or ProblemStatus::PRIMAL_FEASIBLE if it is the