22 : basis_factorization_(basis_factorization),
23 recompute_edge_squared_norms_(true) {}
26 return recompute_edge_squared_norms_;
32 edge_squared_norms_.
resize(new_size, 1.0);
36 if (recompute_edge_squared_norms_) ComputeEdgeSquaredNorms();
37 return edge_squared_norms_;
42 if (recompute_edge_squared_norms_)
return;
47 ColIndex entering_col, RowIndex leaving_row,
51 if (recompute_edge_squared_norms_)
return;
63 const Fractional old_squared_norm = edge_squared_norms_[leaving_row];
64 const Fractional estimated_edge_norms_accuracy =
65 (sqrt(leaving_squared_norm) - sqrt(old_squared_norm)) /
66 sqrt(leaving_squared_norm);
67 stats_.edge_norms_accuracy.Add(estimated_edge_norms_accuracy);
68 if (std::abs(estimated_edge_norms_accuracy) >
69 parameters_.recompute_edges_norm_threshold()) {
70 VLOG(1) <<
"Recomputing edge norms: " << sqrt(leaving_squared_norm)
71 <<
" vs " << sqrt(old_squared_norm);
72 recompute_edge_squared_norms_ =
true;
76 const Fractional pivot = direction[leaving_row];
78 leaving_squared_norm /
Square(pivot);
81 int stat_lower_bounded_norms = 0;
82 for (
const auto e : direction) {
85 edge_squared_norms_[e.row()] +=
86 e.coefficient() * (e.coefficient() * new_leaving_squared_norm -
87 2.0 / pivot * tau[e.row()]);
94 if (edge_squared_norms_[e.row()] < kLowerBound) {
95 if (e.row() == leaving_row)
continue;
96 edge_squared_norms_[e.row()] = kLowerBound;
97 ++stat_lower_bounded_norms;
100 edge_squared_norms_[leaving_row] = new_leaving_squared_norm;
104 void DualEdgeNorms::ComputeEdgeSquaredNorms() {
111 edge_squared_norms_.
resize(num_rows, 0.0);
112 for (RowIndex
row(0);
row < num_rows; ++
row) {
115 recompute_edge_squared_norms_ =
false;
119 const ScatteredColumn& unit_row_left_inverse) {
#define DCHECK(condition)
#define VLOG(verboselevel)
const DenseColumn & RightSolveForTau(const ScatteredColumn &a) const
bool IsRefactorized() const
Fractional DualEdgeSquaredNorm(RowIndex row) const
RowIndex GetNumberOfRows() const
void UpdateBeforeBasisPivot(ColIndex entering_col, RowIndex leaving_row, const ScatteredColumn &direction, const ScatteredRow &unit_row_left_inverse)
void UpdateDataOnBasisPermutation(const ColumnPermutation &col_perm)
const DenseColumn & GetEdgeSquaredNorms()
bool NeedsBasisRefactorization()
void ResizeOnNewRows(RowIndex new_size)
DualEdgeNorms(const BasisFactorization &basis_factorization)
void resize(IntType size)
Fractional Square(Fractional f)
Fractional PreciseSquaredNorm(const SparseColumn &v)
double Density(const DenseRow &row)
const DenseRow & Transpose(const DenseColumn &col)
void ApplyColumnPermutationToRowIndexedVector(const Permutation< ColIndex > &col_perm, RowIndexedVector *v)
StrictITIVector< RowIndex, Fractional > DenseColumn
const ScatteredRow & TransposedView(const ScatteredColumn &c)
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
#define IF_STATS_ENABLED(instructions)
#define SCOPED_TIME_STAT(stats)