glop: Update from google3

This commit is contained in:
Corentin Le Molgat
2023-12-04 18:29:04 +01:00
parent 3383146f31
commit f52401a859
2 changed files with 10 additions and 5 deletions

View File

@@ -18,6 +18,7 @@
#include <cstdlib>
#include <vector>
#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();
}

View File

@@ -14,9 +14,11 @@
#ifndef OR_TOOLS_GLOP_PRICING_H_
#define OR_TOOLS_GLOP_PRICING_H_
#include <cmath>
#include <random>
#include <string>
#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<Index>::StartDenseUpdates() {
template <typename Index>
inline void DynamicMaximum<Index>::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<Index>::DenseAddOrUpdate(Index position,
template <typename Index>
inline void DynamicMaximum<Index>::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);