From 93f664e3cfd37ffdd5b8a746c4ee0f00eb701658 Mon Sep 17 00:00:00 2001 From: JAJHall Date: Thu, 19 Dec 2024 09:36:49 +0000 Subject: [PATCH] Added model and dimensions for LPStats; formatted --- src/ipm/IpxWrapper.cpp | 18 ++++++------ src/lp_data/HStruct.h | 3 +- src/lp_data/HighsLp.cpp | 63 ++++++++++++++++++++--------------------- src/simplex/HEkk.cpp | 18 ++++++------ src/util/HighsUtils.cpp | 5 ++-- 5 files changed, 53 insertions(+), 54 deletions(-) diff --git a/src/ipm/IpxWrapper.cpp b/src/ipm/IpxWrapper.cpp index b497058604..08f93fb8da 100644 --- a/src/ipm/IpxWrapper.cpp +++ b/src/ipm/IpxWrapper.cpp @@ -1218,15 +1218,15 @@ void HighsIpxStats::report(FILE* file, const std::string message, "ipm_time,crossover_time,solve_time,"); } else if (style == HighsSolverStatsReportCsvData) { this->averages(); - fprintf( - file, "%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%g,%g,%g,%g,%g,%g,", - int(this->valid), this->model.c_str(), - int(this->num_col), int(this->num_row), int(this->num_nz), - int(this->num_type1_iteration), int(this->average_type1_cr_count), - int(this->num_type2_iteration), int(this->average_type2_cr_count), - int(this->average_type2_matrix_nz), int(this->average_type2_invert_nz), - this->type1_time, this->basis0_time, this->type2_time, this->ipm_time, - this->crossover_time, this->solve_time); + fprintf(file, "%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%g,%g,%g,%g,%g,%g,", + int(this->valid), this->model.c_str(), int(this->num_col), + int(this->num_row), int(this->num_nz), + int(this->num_type1_iteration), int(this->average_type1_cr_count), + int(this->num_type2_iteration), int(this->average_type2_cr_count), + int(this->average_type2_matrix_nz), + int(this->average_type2_invert_nz), this->type1_time, + this->basis0_time, this->type2_time, this->ipm_time, + this->crossover_time, this->solve_time); } else { fprintf(file, "Unknown IPX stats report style of %d\n", int(style)); assert(123 == 456); diff --git a/src/lp_data/HStruct.h b/src/lp_data/HStruct.h index ea81e6eb53..dd2157ace5 100644 --- a/src/lp_data/HStruct.h +++ b/src/lp_data/HStruct.h @@ -172,7 +172,8 @@ struct HighsLpStats { double relative_max_matrix_entry; double relative_num_equal_a_matrix_nz; double relative_num_dense_row; - void report(FILE* file, std::string message = "", const HighsInt style = HighsLpStatsReportPretty); + void report(FILE* file, std::string message = "", + const HighsInt style = HighsLpStatsReportPretty); void clear(); }; diff --git a/src/lp_data/HighsLp.cpp b/src/lp_data/HighsLp.cpp index 91e0a564a2..32f27bf6c0 100644 --- a/src/lp_data/HighsLp.cpp +++ b/src/lp_data/HighsLp.cpp @@ -514,10 +514,10 @@ void HighsLp::deleteRows(const HighsIndexCollection& index_collection) { void HighsLpStats::clear() { valid = false; - model = "Not set";// ""; - num_col = -kHighsIInf;// 0; - num_row = -kHighsIInf;// 0; - num_nz = -kHighsIInf;// 0; + model = "Not set"; // ""; + num_col = -kHighsIInf; // 0; + num_row = -kHighsIInf; // 0; + num_nz = -kHighsIInf; // 0; relative_max_cost_entry = -kHighsInf; // 0; relative_num_equal_cost = -kHighsInf; // 0; relative_num_inf_upper = -kHighsInf; // 0; @@ -533,7 +533,7 @@ void HighsLpStats::clear() { } void HighsLpStats::report(FILE* file, std::string message, - const HighsInt style) { + const HighsInt style) { if (style == HighsLpStatsReportPretty) { fprintf(file, "\nLP stats\n"); if (message == "") { @@ -547,49 +547,46 @@ void HighsLpStats::report(FILE* file, std::string message, fprintf(file, " Number of rows = %d\n", num_row); fprintf(file, " Number of entries = %d\n", num_nz); fprintf(file, " Relative maximum cost_entry = %g\n", - relative_max_cost_entry); + relative_max_cost_entry); fprintf(file, " Relative number of identical costs = %g\n", - relative_num_equal_cost); + relative_num_equal_cost); fprintf(file, " Relative number of infinite column upper bounds = %g\n", - relative_num_inf_upper); + relative_num_inf_upper); fprintf(file, " Relative number of equations = %g\n", - relative_num_equations); + relative_num_equations); fprintf(file, " Relative maximum rhs entry = %g\n", - relative_max_rhs_entry); + relative_max_rhs_entry); fprintf(file, " Relative number of identical rhs entries = %g\n", - relative_num_equal_rhs); + relative_num_equal_rhs); fprintf(file, " Constraint matrix stats\n"); fprintf(file, " Density = %g\n", - a_matrix_density); + a_matrix_density); fprintf(file, " Nonzeros per column = %g\n", - a_matrix_nz_per_col); + a_matrix_nz_per_col); fprintf(file, " Nonzeros per row = %g\n", - a_matrix_nz_per_row); + a_matrix_nz_per_row); fprintf(file, " Relative maximum entry = %g\n", - relative_max_matrix_entry); + relative_max_matrix_entry); fprintf(file, " Relative number of almost identical entries = %g\n", - relative_num_equal_a_matrix_nz); + relative_num_equal_a_matrix_nz); fprintf(file, " Relative number of dense rows = %g\n", - relative_num_dense_row); + relative_num_dense_row); } else if (style == HighsLpStatsReportCsvHeader) { fprintf(file, - "valid,model,col,row,nz,relative_max_cost_entry,relative_num_equal_cost,relative_num_inf_upper,relative_num_equations,relative_max_rhs_entry,relative_num_equal_rhs,a_matrix_density,a_matrix_nz_per_col,a_matrix_nz_per_row,relative_max_matrix_entry,relative_num_equal_a_matrix_nz,relative_num_dense_row"); + "valid,model,col,row,nz,relative_max_cost_entry,relative_num_equal_" + "cost,relative_num_inf_upper,relative_num_equations,relative_max_" + "rhs_entry,relative_num_equal_rhs,a_matrix_density,a_matrix_nz_per_" + "col,a_matrix_nz_per_row,relative_max_matrix_entry,relative_num_" + "equal_a_matrix_nz,relative_num_dense_row"); } else if (style == HighsLpStatsReportCsvData) { fprintf(file, "%d,%s,%d,%d,%d,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g", - int(this->valid), this->model.c_str(), - int(this->num_col), int(this->num_row), int(this->num_nz), - relative_max_cost_entry, - relative_num_equal_cost, - relative_num_inf_upper, - relative_num_equations, - relative_max_rhs_entry, - relative_num_equal_rhs, - a_matrix_density, - a_matrix_nz_per_col, - a_matrix_nz_per_row, - relative_max_matrix_entry, - relative_num_equal_a_matrix_nz, - relative_num_dense_row); + int(this->valid), this->model.c_str(), int(this->num_col), + int(this->num_row), int(this->num_nz), relative_max_cost_entry, + relative_num_equal_cost, relative_num_inf_upper, + relative_num_equations, relative_max_rhs_entry, + relative_num_equal_rhs, a_matrix_density, a_matrix_nz_per_col, + a_matrix_nz_per_row, relative_max_matrix_entry, + relative_num_equal_a_matrix_nz, relative_num_dense_row); } else { fprintf(file, "Unknown LP stats report style of %d\n", int(style)); assert(123 == 456); @@ -747,7 +744,7 @@ void HighsLp::stats() { if (row_count[iRow] >= dense_row_count) num_dense_row++; this->stats_.relative_num_dense_row = - this->num_row_ > 0 ? (1.0 * num_dense_row) / this->num_row_ : 0; + this->num_row_ > 0 ? (1.0 * num_dense_row) / this->num_row_ : 0; this->stats_.valid = true; } diff --git a/src/simplex/HEkk.cpp b/src/simplex/HEkk.cpp index ed44cd57a0..fd63ff4e6f 100644 --- a/src/simplex/HEkk.cpp +++ b/src/simplex/HEkk.cpp @@ -4454,17 +4454,17 @@ void HighsSimplexStats::report(FILE* file, std::string message, fprintf(file, " simplex time = = %g\n", this->simplex_time); fprintf(file, " solve time = = %g\n", this->solve_time); } else if (style == HighsSolverStatsReportCsvHeader) { - fprintf(file, - "valid,model,col,row,nz,iteration_count,num_invert,last_factored_basis_" - "num_el,last_invert_num_el," - "col_aq_density,row_ep_density,row_ap_density,row_DSE_" - "density,simplex_time,solve_time,"); + fprintf( + file, + "valid,model,col,row,nz,iteration_count,num_invert,last_factored_basis_" + "num_el,last_invert_num_el," + "col_aq_density,row_ep_density,row_ap_density,row_DSE_" + "density,simplex_time,solve_time,"); } else if (style == HighsSolverStatsReportCsvData) { fprintf(file, "%d,%s,%d,%d,%d,%d,%d,%d,%d,%g,%g,%g,%g,%g,%g,", - int(this->valid), this->model.c_str(), - int(this->num_col), int(this->num_row), int(this->num_nz), - int(this->iteration_count), int(this->num_invert), - int(this->last_factored_basis_num_el), + int(this->valid), this->model.c_str(), int(this->num_col), + int(this->num_row), int(this->num_nz), int(this->iteration_count), + int(this->num_invert), int(this->last_factored_basis_num_el), int(this->last_invert_num_el), this->col_aq_density, this->row_ep_density, this->row_ap_density, this->row_DSE_density, this->simplex_time, this->solve_time); diff --git a/src/util/HighsUtils.cpp b/src/util/HighsUtils.cpp index 566e3477f8..be4c82422e 100644 --- a/src/util/HighsUtils.cpp +++ b/src/util/HighsUtils.cpp @@ -1395,8 +1395,9 @@ std::vector> valueCountSorted( } newCluster(num_distinct_value); if (num_cluster < num_distinct_value) { - printf("grep valueCountSorted: num clusters = %d < %d = num distinct values\n", - int(num_cluster), int(num_distinct_value)) + printf( + "grep valueCountSorted: num clusters = %d < %d = num distinct values\n", + int(num_cluster), int(num_distinct_value)); } value_count.resize(num_cluster); if (!by_value)