141 const GlopParameters&
GetParameters()
const {
return parameters_; }
255 total(
"total",
this),
256 normal(
"normal",
this),
257 bound_flip(
"bound_flip",
this),
258 refactorize(
"refactorize",
this),
259 degenerate(
"degenerate",
this),
260 num_dual_flips(
"num_dual_flips",
this),
261 degenerate_run_size(
"degenerate_run_size",
this) {}
274 bound_shift(
"bound_shift", this),
275 abs_used_pivot(
"abs_used_pivot", this),
276 abs_tested_pivot(
"abs_tested_pivot", this),
277 abs_skipped_pivot(
"abs_skipped_pivot", this),
278 direction_density(
"direction_density", this),
279 leaving_choices(
"leaving_choices", this),
280 num_perfect_ties(
"num_perfect_ties", this) {}
290 enum class Phase { FEASIBILITY, OPTIMIZATION, PUSH };
292 enum class RefactorizationReason {
307 void PropagateParameters();
321 std::string GetPrettySolverStats()
const;
325 std::string SimpleVariableInfo(ColIndex
col)
const;
328 void DisplayIterationInfo(
bool primal, RefactorizationReason reason =
329 RefactorizationReason::DEFAULT);
332 void DisplayErrors();
335 void DisplayInfoOnVariables()
const;
338 void DisplayVariableBounds();
354 void DisplayRevisedSimplexDebugInfo();
357 void DisplayProblem()
const;
366 Fractional ComputeInitialProblemObjectiveValue()
const;
370 void SetVariableNames();
376 void SetNonBasicVariableStatusAndDeriveValue(ColIndex
col,
382 bool BasisIsConsistent()
const;
387 void UpdateBasis(ColIndex entering_col, RowIndex basis_row,
397 bool InitializeMatrixAndTestIfUnchanged(
const LinearProgram& lp,
398 bool lp_is_in_equation_form,
399 bool* only_change_is_new_rows,
400 bool* only_change_is_new_cols,
401 ColIndex* num_new_cols);
405 bool OldBoundsAreUnchangedAndNewVariablesHaveOneBoundAtZero(
406 const LinearProgram& lp,
bool lp_is_in_equation_form,
407 ColIndex num_new_cols);
410 bool InitializeObjectiveAndTestIfUnchanged(
const LinearProgram& lp);
413 void InitializeObjectiveLimit(
const LinearProgram& lp);
417 ABSL_MUST_USE_RESULT Status CreateInitialBasis();
421 ABSL_MUST_USE_RESULT Status
425 ABSL_MUST_USE_RESULT Status Initialize(
const LinearProgram& lp);
431 void DisplayBasicVariableStatistics();
440 RowIndex ComputeNumberOfEmptyRows();
444 ColIndex ComputeNumberOfEmptyColumns();
449 int ComputeNumberOfSuperBasicVariables()
const;
461 void CorrectErrorsOnVariableValues();
464 void ComputeVariableValuesError();
469 void ComputeDirection(ColIndex
col);
479 template <
bool is_entering_reduced_cost_positive>
487 template <
bool is_entering_reduced_cost_positive>
488 Fractional ComputeHarrisRatioAndLeavingCandidates(
496 Status ChooseLeavingVariableRow(ColIndex entering_col,
498 RowIndex* leaving_row,
507 void PrimalPhaseIChooseLeavingVariableRow(ColIndex entering_col,
510 RowIndex* leaving_row,
522 ABSL_MUST_USE_RESULT Status DualChooseLeavingVariableRow(
523 RowIndex* leaving_row,
Fractional* cost_variation,
531 void DualPhaseIUpdatePrice(RowIndex leaving_row, ColIndex entering_col);
535 template <
bool use_dense_update = false>
541 template <
typename Cols>
542 void DualPhaseIUpdatePriceOnReducedCostChange(
const Cols& cols);
551 ABSL_MUST_USE_RESULT Status DualPhaseIChooseLeavingVariableRow(
552 RowIndex* leaving_row,
Fractional* cost_variation,
563 template <
typename BoxedVariableCols>
564 void MakeBoxedVariableDualFeasible(
const BoxedVariableCols& cols,
565 bool update_basic_values);
569 Fractional ComputeStepToMoveBasicVariableToBound(RowIndex leaving_row,
573 bool TestPivot(ColIndex entering_col, RowIndex leaving_row);
584 ABSL_MUST_USE_RESULT Status UpdateAndPivot(ColIndex entering_col,
585 RowIndex leaving_row,
589 void DisplayAllStats();
598 Status RefactorizeBasisIfNeeded(
bool* refactorize);
601 ABSL_MUST_USE_RESULT Status PrimalMinimize(TimeLimit*
time_limit);
604 ABSL_MUST_USE_RESULT Status DualMinimize(
bool feasibility_phase,
612 ABSL_MUST_USE_RESULT Status PrimalPush(TimeLimit*
time_limit);
622 ABSL_MUST_USE_RESULT Status Polish(TimeLimit*
time_limit);
627 ColIndex SlackColIndex(RowIndex
row)
const;
634 void AdvanceDeterministicTime(TimeLimit*
time_limit);
640 RowIndex num_rows_ = RowIndex(0);
643 ColIndex num_cols_ = ColIndex(0);
648 ColIndex first_slack_col_ = ColIndex(0);
655 CompactSparseMatrix compact_matrix_;
658 CompactSparseMatrix transposed_matrix_;
683 DenseRow dual_infeasibility_improvement_direction_;
684 int num_dual_infeasible_positions_;
687 ScatteredColumn initially_all_zero_scratchpad_;
696 StrictITIVector<ColIndex, std::string> variable_name_;
699 RefactorizationReason last_refactorization_reason_;
707 DenseRow solution_dual_ray_row_combination_;
708 BasisState solution_state_;
709 bool solution_state_has_been_set_externally_;
716 bool notify_that_matrix_is_unchanged_ =
false;
722 ScatteredColumn direction_;
732 absl::BitGen absl_random_;
735 absl::BitGenRef random_;
738 SolverLogger default_logger_;
739 SolverLogger* logger_ = &default_logger_;
742 BasisFactorization basis_factorization_;
745 VariablesInfo variables_info_;
746 PrimalEdgeNorms primal_edge_norms_;
747 DualEdgeNorms dual_edge_norms_;
748 DynamicMaximum<RowIndex> dual_prices_;
749 VariableValues variable_values_;
750 UpdateRow update_row_;
752 EnteringVariable entering_variable_;
753 PrimalPrices primal_prices_;
760 std::vector<ColIndex> bound_flip_candidates_;
763 uint64_t num_iterations_ = 0;
766 uint64_t num_feasibility_iterations_ = 0;
769 uint64_t num_optimization_iterations_ = 0;
772 uint64_t num_push_iterations_ = 0;
775 int64_t num_update_price_operations_ = 0;
778 double total_time_ = 0.0;
781 double feasibility_time_ = 0.0;
784 double optimization_time_ = 0.0;
787 double push_time_ = 0.0;
791 double last_deterministic_time_update_ = 0.0;
794 IterationStats iteration_stats_;
796 mutable RatioTestStats ratio_test_stats_;
800 mutable StatsGroup function_stats_;
808 GlopParameters parameters_;
809 GlopParameters initial_parameters_;
813 LuFactorization test_lu_;
816 int num_consecutive_degenerate_iterations_;
819 Phase phase_ = Phase::FEASIBILITY;
826 bool objective_limit_reached_;
835 std::vector<RowIndex> equivalent_leaving_choices_;