| 23 | #include "util/HighsSort.h" |
| 24 | |
| 25 | void Highs::reportModelStats() const { |
| 26 | const HighsLp& lp = this->model_.lp_; |
| 27 | const HighsHessian& hessian = this->model_.hessian_; |
| 28 | const HighsLogOptions& log_options = this->options_.log_options; |
| 29 | if (!*log_options.output_flag) return; |
| 30 | HighsInt num_integer = 0; |
| 31 | HighsInt num_binary = 0; |
| 32 | HighsInt num_semi_continuous = 0; |
| 33 | HighsInt num_semi_integer = 0; |
| 34 | for (HighsInt iCol = 0; iCol < static_cast<HighsInt>(lp.integrality_.size()); |
| 35 | iCol++) { |
| 36 | switch (lp.integrality_[iCol]) { |
| 37 | case HighsVarType::kInteger: |
| 38 | num_integer++; |
| 39 | if (lp.col_lower_[iCol] == 0 && lp.col_upper_[iCol] == 1) num_binary++; |
| 40 | break; |
| 41 | case HighsVarType::kSemiContinuous: |
| 42 | num_semi_continuous++; |
| 43 | break; |
| 44 | case HighsVarType::kSemiInteger: |
| 45 | num_semi_integer++; |
| 46 | break; |
| 47 | default: |
| 48 | break; |
| 49 | } |
| 50 | } |
| 51 | std::string problem_type; |
| 52 | const bool non_continuous = |
| 53 | num_integer + num_semi_continuous + num_semi_integer; |
| 54 | if (hessian.dim_) { |
| 55 | if (non_continuous) { |
| 56 | problem_type = "MIQP"; |
| 57 | } else { |
| 58 | problem_type = "QP"; |
| 59 | } |
| 60 | } else { |
| 61 | if (non_continuous) { |
| 62 | problem_type = "MIP"; |
| 63 | } else { |
| 64 | problem_type = "LP"; |
| 65 | } |
| 66 | } |
| 67 | const HighsInt a_num_nz = lp.a_matrix_.numNz(); |
| 68 | const HighsInt q_num_nz = hessian.dim_ > 0 ? hessian.numNz() : 0; |
| 69 | if (*log_options.log_dev_level) { |
| 70 | highsLogDev(log_options, HighsLogType::kInfo, "%4s : %s\n", |
| 71 | problem_type.c_str(), lp.model_name_.c_str()); |
| 72 | highsLogDev(log_options, HighsLogType::kInfo, |
| 73 | "Row%s : %" HIGHSINT_FORMAT "\n", |
| 74 | lp.num_row_ == 1 ? "" : "s", lp.num_row_); |
| 75 | highsLogDev(log_options, HighsLogType::kInfo, |
| 76 | "Col%s : %" HIGHSINT_FORMAT "\n", |
| 77 | lp.num_col_ == 1 ? "" : "s", lp.num_col_); |
| 78 | if (q_num_nz) { |
| 79 | highsLogDev(log_options, HighsLogType::kInfo, |
| 80 | "Matrix Nz : %" HIGHSINT_FORMAT "\n", a_num_nz); |
| 81 | highsLogDev(log_options, HighsLogType::kInfo, |
| 82 | "Hessian Nz: %" HIGHSINT_FORMAT "\n", q_num_nz); |
no test coverage detected