Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <primal_edge_norms.h>
Public Member Functions | |
PrimalEdgeNorms (const CompactSparseMatrix &compact_matrix, const VariablesInfo &variables_info, const BasisFactorization &basis_factorization) | |
PrimalEdgeNorms (const PrimalEdgeNorms &)=delete | |
This type is neither copyable nor movable. | |
PrimalEdgeNorms & | operator= (const PrimalEdgeNorms &)=delete |
void | Clear () |
bool | NeedsBasisRefactorization () const |
DenseRow::ConstView | GetSquaredNorms () |
const DenseRow & | GetEdgeSquaredNorms () |
const DenseRow & | GetDevexWeights () |
const DenseRow & | GetMatrixColumnNorms () |
bool | TestEnteringEdgeNormPrecision (ColIndex entering_col, const ScatteredColumn &direction) |
void | UpdateBeforeBasisPivot (ColIndex entering_col, ColIndex leaving_col, RowIndex leaving_row, const ScatteredColumn &direction, UpdateRow *update_row) |
void | SetParameters (const GlopParameters ¶meters) |
Sets the algorithm parameters. | |
void | SetPricingRule (GlopParameters::PricingRule rule) |
This changes what GetSquaredNorms() returns. | |
void | AddRecomputationWatcher (bool *watcher) |
std::string | StatString () const |
Returns a string with statistics about this class. | |
double | DeterministicTime () const |
Deterministic time used by the scalar product computation of this class. | |
This class maintains the primal edge squared norms (and other variants) to be used in the primal pricing step. Instead of computing the needed values from scractch at each iteration, it is more efficient to update them incrementally for each basis pivot applied to the simplex basis matrix B.
Terminology:
Papers:
Definition at line 59 of file primal_edge_norms.h.
operations_research::glop::PrimalEdgeNorms::PrimalEdgeNorms | ( | const CompactSparseMatrix & | compact_matrix, |
const VariablesInfo & | variables_info, | ||
const BasisFactorization & | basis_factorization ) |
Takes references to the linear program data we need. Note that we assume that the matrix will never change in our back, but the other references are supposed to reflect the correct state.
Definition at line 34 of file primal_edge_norms.cc.
|
delete |
This type is neither copyable nor movable.
|
inline |
Registers a boolean that will be set to true each time the norms are or will be recomputed. This allows anyone that depends on this to know that it cannot just assume an incremental changes and needs to updates its data. Important: UpdateBeforeBasisPivot() will not trigger this.
Definition at line 139 of file primal_edge_norms.h.
void operations_research::glop::PrimalEdgeNorms::Clear | ( | ) |
Clears, i.e. resets the object to its initial value. This will trigger a recomputation for the next Get*() method call.
Definition at line 49 of file primal_edge_norms.cc.
|
inline |
Deterministic time used by the scalar product computation of this class.
Definition at line 145 of file primal_edge_norms.h.
const DenseRow & operations_research::glop::PrimalEdgeNorms::GetDevexWeights | ( | ) |
Returns an approximation of the edges norms "devex". This is only valid if the caller properly called UpdateBeforeBasisPivot() before each basis pivot, or if this is the first call to this function after a Clear().
Definition at line 78 of file primal_edge_norms.cc.
const DenseRow & operations_research::glop::PrimalEdgeNorms::GetEdgeSquaredNorms | ( | ) |
Returns the primal edge squared norms. This is only valid if the caller properly called UpdateBeforeBasisPivot() before each basis pivot, or if this is the first call to this function after a Clear(). Note that only the relevant columns are filled.
Definition at line 73 of file primal_edge_norms.cc.
const DenseRow & operations_research::glop::PrimalEdgeNorms::GetMatrixColumnNorms | ( | ) |
Returns the L2 norms of all the columns of A.
Definition at line 83 of file primal_edge_norms.cc.
DenseRow::ConstView operations_research::glop::PrimalEdgeNorms::GetSquaredNorms | ( | ) |
Depending on the SetPricingRule(), this returns one of the "norms" vector below. Note that all norms are squared.
Definition at line 62 of file primal_edge_norms.cc.
bool operations_research::glop::PrimalEdgeNorms::NeedsBasisRefactorization | ( | ) | const |
If this is true, then the caller must re-factorize the basis before the next call to GetEdgeSquaredNorms(). This is because the latter will recompute the norms from scratch and therefore needs a hightened precision and speed.
Definition at line 57 of file primal_edge_norms.cc.
|
delete |
|
inline |
Sets the algorithm parameters.
Definition at line 126 of file primal_edge_norms.h.
|
inline |
This changes what GetSquaredNorms() returns.
Definition at line 131 of file primal_edge_norms.h.
|
inline |
Returns a string with statistics about this class.
Definition at line 142 of file primal_edge_norms.h.
bool operations_research::glop::PrimalEdgeNorms::TestEnteringEdgeNormPrecision | ( | ColIndex | entering_col, |
const ScatteredColumn & | direction ) |
Compares the current entering edge norm with its precise version (using the direction that wasn't avaible before) and triggers a full recomputation if the precision is not good enough (see recompute_edges_norm_threshold in GlopParameters). As a side effect, this replace the entering_col edge norm with its precise version.
Returns false if the old norm is less that 0.25 the new one. We might want to change the leaving variable if this happens.
Recompute the squared norm of the edge used during this iteration, i.e. the entering edge.
Definition at line 88 of file primal_edge_norms.cc.
void operations_research::glop::PrimalEdgeNorms::UpdateBeforeBasisPivot | ( | ColIndex | entering_col, |
ColIndex | leaving_col, | ||
RowIndex | leaving_row, | ||
const ScatteredColumn & | direction, | ||
UpdateRow * | update_row ) |
Updates any internal data BEFORE the given simplex pivot is applied to B.
Resets devex weights once in a while. If so, no need to update them before.
Definition at line 119 of file primal_edge_norms.cc.