14 #ifndef OR_TOOLS_GLOP_REDUCED_COSTS_H_
15 #define OR_TOOLS_GLOP_REDUCED_COSTS_H_
17 #include "absl/random/bit_gen_ref.h"
56 absl::BitGenRef random);
111 return recompute_reduced_costs_ || are_reduced_costs_recomputed_;
173 std::string
StatString()
const {
return stats_.StatString(); }
177 return dual_feasibility_tolerance_;
200 basic_objective_left_inverse_density(
201 "basic_objective_left_inverse_density", this),
202 reduced_costs_accuracy(
"reduced_costs_accuracy", this),
203 cost_shift(
"cost_shift", this) {}
211 void ComputeBasicObjective();
212 void ComputeReducedCosts();
213 void ComputeBasicObjectiveLeftInverse();
219 void UpdateReducedCosts(ColIndex entering_col, ColIndex leaving_col,
221 UpdateRow* update_row);
224 void UpdateBasicObjective(ColIndex entering_col, RowIndex leaving_row);
227 void SetRecomputeReducedCostsAndNotifyWatchers();
230 const CompactSparseMatrix& matrix_;
233 const VariablesInfo& variables_info_;
234 const BasisFactorization& basis_factorization_;
235 absl::BitGenRef random_;
238 GlopParameters parameters_;
239 mutable Stats stats_;
242 bool must_refactorize_basis_;
243 bool recompute_basic_objective_left_inverse_;
244 bool recompute_basic_objective_;
245 bool recompute_reduced_costs_;
248 bool are_reduced_costs_precise_;
249 bool are_reduced_costs_recomputed_;
251 bool has_cost_shift_ =
false;
273 ScatteredRow basic_objective_left_inverse_;
282 std::vector<bool*> watchers_;
284 double deterministic_time_ = 0.0;
325 template <
bool from_clean_state,
typename ColumnsToUpdate>
326 void UpdateEnteringCandidates(
const ColumnsToUpdate& cols);
328 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 ComputeMaximumDualResidual() const
void MakeReducedCostsPrecise()
bool AreReducedCostsRecomputed()
bool TestEnteringReducedCostPrecision(ColIndex entering_col, const ScatteredColumn &direction, Fractional *reduced_cost)
bool AreReducedCostsPrecise()
bool IsValidPrimalEnteringCandidate(ColIndex col) const
void SetNonBasicVariableCostToZero(ColIndex col, Fractional *current_cost)
bool HasCostShift() const
bool StepIsDualDegenerate(bool increasing_rc_is_needed, ColIndex col)
Fractional ComputeMaximumDualInfeasibilityOnNonBoxedVariables() const
const DenseRow & GetCostPerturbations() const
const DenseRow & GetFullReducedCosts()
void UpdateBeforeBasisPivot(ColIndex entering_col, RowIndex leaving_row, const ScatteredColumn &direction, UpdateRow *update_row)
const DenseRow & GetReducedCosts()
Fractional GetDualFeasibilityTolerance() const
Fractional ComputeMaximumDualInfeasibility() const
const DenseColumn & GetDualValues()
void ClearAndRemoveCostShifts()
void UpdateDataOnBasisPermutation()
Fractional ComputeSumOfDualInfeasibilities() const
void ShiftCostIfNeeded(bool increasing_rc_is_needed, ColIndex col)
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.