update deterministic time computation in glop

This commit is contained in:
Laurent Perron
2021-03-23 17:55:40 +01:00
parent c38a637910
commit e26ce9c3de
4 changed files with 20 additions and 2 deletions

View File

@@ -111,6 +111,7 @@ Status EnteringVariable::DualChooseEnteringColumn(
reduced_costs_->GetDualFeasibilityTolerance();
Fractional harris_ratio = std::numeric_limits<Fractional>::max();
num_operations_ += 10 * update_row.GetNonZeroPositions().size();
for (const ColIndex col : update_row.GetNonZeroPositions()) {
// We will add ratio * coeff to this column with a ratio positive or zero.
// cost_variation makes sure the leaving variable will be dual-feasible
@@ -286,6 +287,7 @@ Status EnteringVariable::DualPhaseIChooseEnteringColumn(
const DenseBitRow& can_decrease = variables_info_.GetCanDecreaseBitRow();
const DenseBitRow& can_increase = variables_info_.GetCanIncreaseBitRow();
const VariableTypeRow& variable_type = variables_info_.GetTypeRow();
num_operations_ += 10 * update_row.GetNonZeroPositions().size();
for (const ColIndex col : update_row.GetNonZeroPositions()) {
// Boxed variables shouldn't be in the update position list because they
// will be dealt with afterwards by MakeBoxedVariableDualFeasible().

View File

@@ -91,6 +91,13 @@ class EnteringVariable {
// Stats related functions.
std::string StatString() const { return stats_.StatString(); }
// Deterministic time used by some of the functions of this class.
//
// TODO(user): Be exhausitive and more precise.
double DeterministicTime() const {
return DeterministicTimeForFpOperations(num_operations_);
}
// Recomputes the set of unused columns used during nested pricing.
// Visible for testing (the returns value is also there for testing).
DenseBitRow* ResetUnusedColumns();
@@ -164,6 +171,9 @@ class EnteringVariable {
// Temporary vector used to hold breakpoints.
std::vector<ColWithRatio> breakpoints_;
// Counter for the deterministic time.
int64 num_operations_ = 0;
DISALLOW_COPY_AND_ASSIGN(EnteringVariable);
};

View File

@@ -601,7 +601,9 @@ double RevisedSimplex::DeterministicTime() const {
// TODO(user): Count what is missing.
return DeterministicTimeForFpOperations(num_update_price_operations_) +
basis_factorization_.DeterministicTime() +
update_row_.DeterministicTime() + reduced_costs_.DeterministicTime() +
update_row_.DeterministicTime() +
entering_variable_.DeterministicTime() +
reduced_costs_.DeterministicTime() +
primal_edge_norms_.DeterministicTime();
}

View File

@@ -127,7 +127,11 @@ void UpdateRow::ComputeUpdateRow(RowIndex leaving_row) {
if (row_wise < 0.5 * static_cast<double>(num_col_wise_entries.value())) {
if (row_wise < 1.1 * static_cast<double>(matrix_.num_cols().value())) {
ComputeUpdatesRowWiseHypersparse();
num_operations_ += num_row_wise_entries.value();
// We use a multiplicative factor because these entries are often widely
// spread in memory. There is also some overhead to each fp operations.
num_operations_ +=
5 * num_row_wise_entries.value() + matrix_.num_cols().value() / 64;
} else {
ComputeUpdatesRowWise();
num_operations_ +=