diff --git a/ortools/glop/lu_factorization.cc b/ortools/glop/lu_factorization.cc index c71dd312fc..8860e8c464 100644 --- a/ortools/glop/lu_factorization.cc +++ b/ortools/glop/lu_factorization.cc @@ -18,6 +18,7 @@ #include #include +#include "absl/log/check.h" #include "ortools/lp_data/lp_types.h" #include "ortools/lp_data/lp_utils.h" @@ -65,9 +66,11 @@ Status LuFactorization::ComputeFactorization( 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))); + // Note(user): This might fail on badly scaled matrices. I still prefer to + // keep it as a DCHECK() for tests though, but I only test it for small + // matrices. + DCHECK(matrix.num_rows() > 100 || + CheckFactorization(matrix, Fractional(1e-6))); return Status::OK(); } diff --git a/ortools/glop/pricing.h b/ortools/glop/pricing.h index 8d5312cdaf..215e659f4c 100644 --- a/ortools/glop/pricing.h +++ b/ortools/glop/pricing.h @@ -14,9 +14,11 @@ #ifndef OR_TOOLS_GLOP_PRICING_H_ #define OR_TOOLS_GLOP_PRICING_H_ +#include #include #include +#include "absl/log/check.h" #include "absl/random/bit_gen_ref.h" #include "absl/random/random.h" #include "ortools/lp_data/lp_types.h" @@ -178,7 +180,7 @@ inline void DynamicMaximum::StartDenseUpdates() { template inline void DynamicMaximum::DenseAddOrUpdate(Index position, Fractional value) { - DCHECK(IsFinite(value)); + DCHECK(!std::isnan(value)); DCHECK(tops_.empty()); is_candidate_.Set(position); values_[position] = value; @@ -187,7 +189,7 @@ inline void DynamicMaximum::DenseAddOrUpdate(Index position, template inline void DynamicMaximum::AddOrUpdate(Index position, Fractional value) { - DCHECK(IsFinite(value)); + DCHECK(!std::isnan(value)); is_candidate_.Set(position); values_[position] = value; if (value >= threshold_) UpdateTopK(position, value);