Skip to content

Commit

Permalink
Added model and dimensions for LPStats; formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
jajhall committed Dec 19, 2024
1 parent bda37c4 commit 93f664e
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 54 deletions.
18 changes: 9 additions & 9 deletions src/ipm/IpxWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/lp_data/HStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};

Expand Down
63 changes: 30 additions & 33 deletions src/lp_data/HighsLp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 == "") {
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
18 changes: 9 additions & 9 deletions src/simplex/HEkk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/util/HighsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,9 @@ std::vector<std::pair<double, HighsInt>> 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)
Expand Down

0 comments on commit 93f664e

Please sign in to comment.