14#ifndef OR_TOOLS_GLOP_VARIABLE_VALUES_H_
15#define OR_TOOLS_GLOP_VARIABLE_VALUES_H_
21#include "absl/types/span.h"
24#include "ortools/glop/parameters.pb.h"
115 bool update_basic_variables);
141 template <
typename Rows>
148 std::string
StatString()
const {
return stats_.StatString(); }
158 return std::max(variable_values[col] - upper_bounds[col],
159 lower_bounds[col] - variable_values[col]);
163 const GlopParameters& parameters_;
164 const CompactSparseMatrix& matrix_;
166 const VariablesInfo& variables_info_;
167 const BasisFactorization& basis_factorization_;
171 bool put_more_importance_on_norm_ =
false;
174 DualEdgeNorms* dual_edge_norms_;
175 DynamicMaximum<RowIndex>* dual_prices_;
181 mutable ScatteredColumn scratchpad_;
184 ScatteredColumn initially_all_zero_scratchpad_;
187template <
typename Rows>
191 bool changed =
false;
192 const Fractional tolerance = parameters_.primal_feasibility_tolerance();
195 variables_info_.GetVariableLowerBounds().const_view();
197 variables_info_.GetVariableUpperBounds().const_view();
198 for (
const RowIndex row : rows) {
199 const ColIndex col = basis_[row];
201 if (variable_values[col] - upper_bounds[col] > tolerance) {
203 }
else if (lower_bounds[col] - variable_values[col] > tolerance) {
206 if (new_cost != (*objective)[col]) {
208 (*objective)[col] = new_cost;
Base class to print a nice summary of a group of statistics.
StrictITISpan< ColIndex, const Fractional > ConstView
Fractional ComputeSumOfPrimalInfeasibilities() const
bool UpdatePrimalPhaseICosts(const Rows &rows, DenseRow *objective)
VariableValues(const VariableValues &)=delete
This type is neither copyable nor movable.
void Set(ColIndex col, Fractional value)
Sets the variable value of a given column.
std::string StatString() const
Parameters and stats functions.
void UpdateOnPivoting(const ScatteredColumn &direction, ColIndex entering_col, Fractional step)
void UpdateGivenNonBasicVariables(absl::Span< const ColIndex > cols_to_update, bool update_basic_variables)
Fractional ComputeMaximumPrimalInfeasibility() const
void RecomputeBasicVariableValues()
const DenseRow & GetDenseRow() const
VariableValues(const GlopParameters ¶meters, const CompactSparseMatrix &matrix, const RowToColMapping &basis, const VariablesInfo &variables_info, const BasisFactorization &basis_factorization, DualEdgeNorms *dual_edge_norms, DynamicMaximum< RowIndex > *dual_prices)
void ResetAllNonBasicVariableValues(const DenseRow &free_initial_values)
VariableValues & operator=(const VariableValues &)=delete
Fractional ComputeMaximumPrimalResidual() const
void RecomputeDualPrices(bool put_more_importance_on_norm=false)
void UpdateDualPrices(absl::Span< const RowIndex > row)
Fractional Get(ColIndex col) const
Getters for the variable values.
void SetNonBasicVariableValueFromStatus(ColIndex col)
StrictITIVector< RowIndex, ColIndex > RowToColMapping
StrictITIVector< ColIndex, Fractional > DenseRow
Row-vector types. Row-vector types are indexed by a column index.
In SWIG mode, we don't want anything besides these top-level includes.
#define SCOPED_TIME_STAT(stats)