91 #ifndef OR_TOOLS_GLOP_REVISED_SIMPLEX_H_
92 #define OR_TOOLS_GLOP_REVISED_SIMPLEX_H_
253 void PropagateParameters();
267 std::string GetPrettySolverStats()
const;
271 std::string SimpleVariableInfo(ColIndex
col)
const;
274 void DisplayIterationInfo()
const;
277 void DisplayErrors()
const;
280 void DisplayInfoOnVariables()
const;
283 void DisplayVariableBounds();
299 void DisplayRevisedSimplexDebugInfo();
302 void DisplayProblem()
const;
311 Fractional ComputeInitialProblemObjectiveValue()
const;
315 void SetVariableNames();
325 void SetNonBasicVariableStatusAndDeriveValue(ColIndex
col,
331 bool BasisIsConsistent()
const;
336 void UpdateBasis(ColIndex entering_col, RowIndex basis_row,
346 bool InitializeMatrixAndTestIfUnchanged(
const LinearProgram& lp,
347 bool* only_change_is_new_rows,
348 bool* only_change_is_new_cols,
349 ColIndex* num_new_cols);
352 bool InitializeBoundsAndTestIfUnchanged(
const LinearProgram& lp);
356 bool OldBoundsAreUnchangedAndNewVariablesHaveOneBoundAtZero(
360 bool InitializeObjectiveAndTestIfUnchanged(
const LinearProgram& lp);
366 void InitializeVariableStatusesForWarmStart(
const BasisState& state,
367 ColIndex num_new_cols);
371 ABSL_MUST_USE_RESULT
Status CreateInitialBasis();
375 ABSL_MUST_USE_RESULT
Status
385 void DisplayBasicVariableStatistics();
394 RowIndex ComputeNumberOfEmptyRows();
398 ColIndex ComputeNumberOfEmptyColumns();
410 void CorrectErrorsOnVariableValues();
413 void ComputeVariableValuesError();
418 void ComputeDirection(ColIndex
col);
428 template <
bool is_entering_reduced_cost_positive>
435 template <
bool is_entering_reduced_cost_positive>
436 Fractional ComputeHarrisRatioAndLeavingCandidates(
444 Status ChooseLeavingVariableRow(ColIndex entering_col,
446 RowIndex* leaving_row,
455 void PrimalPhaseIChooseLeavingVariableRow(ColIndex entering_col,
458 RowIndex* leaving_row,
470 ABSL_MUST_USE_RESULT
Status DualChooseLeavingVariableRow(
471 RowIndex* leaving_row,
Fractional* cost_variation,
479 void DualPhaseIUpdatePrice(RowIndex leaving_row, ColIndex entering_col);
483 template <
typename Cols>
484 void DualPhaseIUpdatePriceOnReducedCostChange(
const Cols& cols);
493 ABSL_MUST_USE_RESULT
Status DualPhaseIChooseLeavingVariableRow(
494 RowIndex* leaving_row,
Fractional* cost_variation,
505 template <
typename BoxedVariableCols>
506 void MakeBoxedVariableDualFeasible(
const BoxedVariableCols& cols,
507 bool update_basic_values);
511 Fractional ComputeStepToMoveBasicVariableToBound(RowIndex leaving_row,
515 bool TestPivot(ColIndex entering_col, RowIndex leaving_row);
526 ABSL_MUST_USE_RESULT
Status UpdateAndPivot(ColIndex entering_col,
527 RowIndex leaving_row,
531 void DisplayAllStats();
538 bool NeedsBasisRefactorization(
bool refactorize);
543 Status RefactorizeBasisIfNeeded(
bool* refactorize);
556 ColIndex SlackColIndex(RowIndex
row)
const;
577 ColIndex first_slack_col_;
621 DenseRow dual_infeasibility_improvement_direction_;
622 int num_dual_infeasible_positions_;
646 DenseRow solution_dual_ray_row_combination_;
648 bool solution_state_has_been_set_externally_;
652 bool notify_that_matrix_is_unchanged_ =
false;
680 std::vector<ColIndex> bound_flip_candidates_;
681 std::vector<std::pair<RowIndex, ColIndex>> pair_to_ignore_;
687 uint64 num_feasibility_iterations_;
690 uint64 num_optimization_iterations_;
696 double feasibility_time_;
699 double optimization_time_;
703 double last_deterministic_time_update_;
709 total(
"total", this),
710 normal(
"normal", this),
711 bound_flip(
"bound_flip", this),
712 degenerate(
"degenerate", this),
713 degenerate_run_size(
"degenerate_run_size", this) {}
720 IterationStats iteration_stats_;
722 struct RatioTestStats :
public StatsGroup {
724 : StatsGroup(
"RatioTestStats"),
725 bound_shift(
"bound_shift", this),
726 abs_used_pivot(
"abs_used_pivot", this),
727 abs_tested_pivot(
"abs_tested_pivot", this),
728 abs_skipped_pivot(
"abs_skipped_pivot", this),
729 direction_density(
"direction_density", this),
730 leaving_choices(
"leaving_choices", this),
731 num_perfect_ties(
"num_perfect_ties", this) {}
732 DoubleDistribution bound_shift;
733 DoubleDistribution abs_used_pivot;
734 DoubleDistribution abs_tested_pivot;
735 DoubleDistribution abs_skipped_pivot;
736 RatioDistribution direction_density;
737 IntegerDistribution leaving_choices;
738 IntegerDistribution num_perfect_ties;
740 mutable RatioTestStats ratio_test_stats_;
744 mutable StatsGroup function_stats_;
752 GlopParameters parameters_;
753 GlopParameters initial_parameters_;
757 LuFactorization test_lu_;
760 int num_consecutive_degenerate_iterations_;
763 bool feasibility_phase_;
770 bool objective_limit_reached_;
773 SparseColumn leaving_candidates_;
779 std::vector<RowIndex> equivalent_leaving_choices_;
826 #endif // OR_TOOLS_GLOP_REVISED_SIMPLEX_H_