14#ifndef OR_TOOLS_GLOP_REDUCED_COSTS_H_
15#define OR_TOOLS_GLOP_REDUCED_COSTS_H_
17#include "absl/random/bit_gen_ref.h"
19#include "ortools/glop/parameters.pb.h"
56 absl::BitGenRef random);
112 return recompute_reduced_costs_ || are_reduced_costs_recomputed_;
174 std::string
StatString()
const {
return stats_.StatString(); }
178 return dual_feasibility_tolerance_;
201 basic_objective_left_inverse_density(
202 "basic_objective_left_inverse_density", this),
203 reduced_costs_accuracy(
"reduced_costs_accuracy", this),
204 cost_shift(
"cost_shift", this) {}
212 void ComputeBasicObjective();
213 void ComputeReducedCosts();
214 void ComputeBasicObjectiveLeftInverse();
220 void UpdateReducedCosts(ColIndex entering_col, ColIndex leaving_col,
222 UpdateRow* update_row);
225 void UpdateBasicObjective(ColIndex entering_col, RowIndex leaving_row);
228 void SetRecomputeReducedCostsAndNotifyWatchers();
231 const CompactSparseMatrix& matrix_;
234 const VariablesInfo& variables_info_;
235 const BasisFactorization& basis_factorization_;
236 absl::BitGenRef random_;
239 GlopParameters parameters_;
240 mutable Stats stats_;
243 bool must_refactorize_basis_;
244 bool recompute_basic_objective_left_inverse_;
245 bool recompute_basic_objective_;
246 bool recompute_reduced_costs_;
249 bool are_reduced_costs_precise_;
250 bool are_reduced_costs_recomputed_;
252 bool has_cost_shift_ =
false;
274 ScatteredRow basic_objective_left_inverse_;
283 std::vector<bool*> watchers_;
285 double deterministic_time_ = 0.0;
326 template <
bool from_clean_state,
typename ColumnsToUpdate>
327 void UpdateEnteringCandidates(
const ColumnsToUpdate& cols);
329 bool recompute_ =
true;
void ForceRecomputation()
void SetAndDebugCheckThatColumnIsDualFeasible(ColIndex col)
void UpdateBeforeBasisPivot(ColIndex entering_col, UpdateRow *update_row)
PrimalPrices(absl::BitGenRef random, const VariablesInfo &variables_info, PrimalEdgeNorms *primal_edge_norms, ReducedCosts *reduced_costs)
void RecomputePriceAt(ColIndex col)
ColIndex GetBestEnteringColumn()
ReducedCosts(const CompactSparseMatrix &matrix_, const DenseRow &objective, const RowToColMapping &basis, const VariablesInfo &variables_info, const BasisFactorization &basis_factorization, absl::BitGenRef random)
void AddRecomputationWatcher(bool *watcher)
void ResetForNewObjective()
Fractional TestEnteringReducedCostPrecision(ColIndex entering_col, const ScatteredColumn &direction)
void MakeReducedCostsPrecise()
bool AreReducedCostsRecomputed()
bool AreReducedCostsPrecise()
bool IsValidPrimalEnteringCandidate(ColIndex col) const
void SetNonBasicVariableCostToZero(ColIndex col, Fractional *current_cost)
bool HasCostShift() const
Fractional ComputeMaximumDualInfeasibilityOnNonBoxedVariables()
bool StepIsDualDegenerate(bool increasing_rc_is_needed, ColIndex col)
Fractional ComputeSumOfDualInfeasibilities()
const DenseRow & GetFullReducedCosts()
void UpdateBeforeBasisPivot(ColIndex entering_col, RowIndex leaving_row, const ScatteredColumn &direction, UpdateRow *update_row)
const DenseRow & GetReducedCosts()
Fractional GetDualFeasibilityTolerance() const
const DenseColumn & GetDualValues()
void ClearAndRemoveCostShifts()
Fractional ComputeMaximumDualResidual()
void UpdateDataOnBasisPermutation()
void ShiftCostIfNeeded(bool increasing_rc_is_needed, ColIndex col)
Fractional ComputeMaximumDualInfeasibility()
const DenseRow & GetCostPerturbations() const
void SetParameters(const GlopParameters ¶meters)
double DeterministicTime() const
bool NeedsBasisRefactorization() const
std::string StatString() const
StrictITIVector< ColIndex, Fractional > DenseRow
StrictITIVector< RowIndex, ColIndex > RowToColMapping
Collection of objects used to extend the Constraint Solver library.