14#ifndef OR_TOOLS_GLOP_BASIS_REPRESENTATION_H_
15#define OR_TOOLS_GLOP_BASIS_REPRESENTATION_H_
22#include "ortools/glop/parameters.pb.h"
60 EtaMatrix(
const EtaMatrix&) =
delete;
61 EtaMatrix& operator=(
const EtaMatrix&) =
delete;
89 void LeftSolveWithDenseEta(
DenseRow*
y)
const;
90 void LeftSolveWithSparseEta(
DenseRow*
y)
const;
101 const ColIndex eta_col_;
130 void Update(ColIndex entering_col, RowIndex leaving_variable_row,
146 std::vector<EtaMatrix*> eta_matrix_;
173 max_num_updates_ =
parameters.basis_refactorization_period();
174 use_middle_product_form_update_ =
235 ABSL_MUST_USE_RESULT
Status Update(ColIndex entering_col,
236 RowIndex leaving_variable_row,
315 Status ComputeFactorization();
319 bool IsIdentityBasis()
const;
324 ABSL_MUST_USE_RESULT
Status
325 MiddleProductFormUpdate(ColIndex entering_col, RowIndex leaving_variable_row);
329 void BumpDeterministicTimeForSolve(
int num_entries)
const;
335 refactorization_interval(
"refactorization_interval", this) {}
341 mutable Stats stats_;
342 GlopParameters parameters_;
345 const CompactSparseMatrix& compact_matrix_;
350 RankOneUpdateFactorization rank_one_factorization_;
352 mutable std::vector<RowIndex> scratchpad_non_zeros_;
357 mutable ScatteredColumn tau_;
375 mutable bool tau_computation_can_be_optimized_;
376 mutable bool tau_is_computed_;
382 mutable CompactSparseMatrix storage_;
383 mutable CompactSparseMatrix right_storage_;
387 bool use_middle_product_form_update_;
388 int max_num_updates_;
390 EtaFactorization eta_factorization_;
391 LuFactorization lu_factorization_;
394 double last_factorization_deterministic_time_ = 0.0;
395 mutable double deterministic_time_;
Statistic on the distribution of a sequence of integers.
Base class to print a nice summary of a group of statistics.
std::string StatString() const
void Reset()
Calls Reset() on all the statistics registered with this group.
Fractional ComputeInfinityNorm() const
std::string StatString() const
double DeterministicTime() const
Fractional ComputeInverseInfinityNorm() const
Computes the infinity-norm of the inverse of B.
Fractional ComputeOneNormConditionNumber() const
ABSL_MUST_USE_RESULT Status ForceRefactorization()
ABSL_MUST_USE_RESULT Status Update(ColIndex entering_col, RowIndex leaving_variable_row, const ScatteredColumn &direction)
const DenseColumn & RightSolveForTau(const ScatteredColumn &a) const
void SetParameters(const GlopParameters ¶meters)
Sets the parameters for this component.
const ColumnPermutation & GetColumnPermutation() const
int NumUpdates() const
Returns the number of updates since last refactorization.
void RightSolve(ScatteredColumn *d) const
Right solves the system B.d = a where the input is the initial value of d.
void LeftSolveForUnitRow(ColIndex j, ScatteredRow *y) const
RowToColMapping ComputeInitialBasis(const std::vector< ColIndex > &candidates)
void TemporaryLeftSolveForUnitRow(ColIndex j, ScatteredRow *y) const
Same as LeftSolveForUnitRow() but does not update any internal data.
ABSL_MUST_USE_RESULT Status Initialize()
bool IsRefactorized() const
Returns true if the factorization was just recomputed.
BasisFactorization(const CompactSparseMatrix *compact_matrix, const RowToColMapping *basis)
Fractional RightSolveSquaredNorm(const ColumnView &a) const
Fractional ComputeInfinityNormConditionNumberUpperBound() const
RowIndex GetNumberOfRows() const
Return the number of rows in the basis.
BasisFactorization(const BasisFactorization &)=delete
This type is neither copyable nor movable.
void RightSolveForProblemColumn(ColIndex col, ScatteredColumn *d) const
Fractional ComputeOneNorm() const
BasisFactorization & operator=(const BasisFactorization &)=delete
ABSL_MUST_USE_RESULT Status Refactorize()
Fractional ComputeInfinityNormConditionNumber() const
void LeftSolve(ScatteredRow *y) const
Left solves the system y.B = rhs, where y initially contains rhs.
Fractional DualEdgeSquaredNorm(RowIndex row) const
void SetColumnPermutationToIdentity()
virtual ~BasisFactorization()
Fractional ComputeInverseOneNorm() const
RowIndex num_rows() const
virtual ~EtaFactorization()
void RightSolve(DenseColumn *d) const
Right solves all systems from left to right, i.e. E_i.d_{i+1} = d_i.
EtaFactorization & operator=(const EtaFactorization &)=delete
void SparseLeftSolve(DenseRow *y, ColIndexVector *pos) const
void LeftSolve(DenseRow *y) const
Left solves all systems from right to left, i.e. y_i = y_{i+1}.(E_i)^{-1}.
void Update(ColIndex entering_col, RowIndex leaving_variable_row, const ScatteredColumn &direction)
void Clear()
Deletes all eta matrices.
EtaFactorization(const EtaFactorization &)=delete
This type is neither copyable nor movable.
void SetParameters(const GlopParameters ¶meters)
Sets the current parameters.
std::string StatString() const
Returns a string containing the statistics for this class.
void SetColumnPermutationToIdentity()
const ColumnPermutation & GetColumnPermutation() const
Returns the column permutation used by the LU factorization.
StrictITIVector< RowIndex, ColIndex > RowToColMapping
std::vector< ColIndex > ColIndexVector
Vector of row or column indices. Useful to list the non-zero positions.
StrictITIVector< ColIndex, ColIndex > ColMapping
Row of column indices. Used to represent mappings between columns.
StrictITIVector< RowIndex, Fractional > DenseColumn
Column-vector types. Column-vector types are indexed by a row index.
In SWIG mode, we don't want anything besides these top-level includes.