14 #ifndef OR_TOOLS_GLOP_REDUCED_COSTS_H_
15 #define OR_TOOLS_GLOP_REDUCED_COSTS_H_
20 #include "absl/random/bit_gen_ref.h"
22 #include "ortools/glop/parameters.pb.h"
59 absl::BitGenRef random);
115 return recompute_reduced_costs_ || are_reduced_costs_recomputed_;
177 std::string
StatString()
const {
return stats_.StatString(); }
181 return dual_feasibility_tolerance_;
204 basic_objective_left_inverse_density(
205 "basic_objective_left_inverse_density", this),
206 reduced_costs_accuracy(
"reduced_costs_accuracy", this),
207 cost_shift(
"cost_shift", this) {}
215 void ComputeBasicObjective();
216 void ComputeReducedCosts();
217 void ComputeBasicObjectiveLeftInverse();
223 void UpdateReducedCosts(ColIndex entering_col, ColIndex leaving_col,
225 UpdateRow* update_row);
228 void UpdateBasicObjective(ColIndex entering_col, RowIndex leaving_row);
231 void SetRecomputeReducedCostsAndNotifyWatchers();
234 const CompactSparseMatrix& matrix_;
237 const VariablesInfo& variables_info_;
238 const BasisFactorization& basis_factorization_;
239 absl::BitGenRef random_;
242 GlopParameters parameters_;
243 mutable Stats stats_;
246 bool must_refactorize_basis_;
247 bool recompute_basic_objective_left_inverse_;
248 bool recompute_basic_objective_;
249 bool recompute_reduced_costs_;
252 bool are_reduced_costs_precise_;
253 bool are_reduced_costs_recomputed_;
255 bool has_cost_shift_ =
false;
277 ScatteredRow basic_objective_left_inverse_;
286 std::vector<bool*> watchers_;
288 double deterministic_time_ = 0.0;
329 template <
bool from_clean_state,
typename ColumnsToUpdate>
330 void UpdateEnteringCandidates(
const ColumnsToUpdate& cols);
332 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)
const DenseRow & GetCostPerturbations() const
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()
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.