| 21 | const double kSolveExcessiveError = sqrt(kSolveLargeError); |
| 22 | |
| 23 | HighsDebugStatus HSimplexNla::debugCheckInvert( |
| 24 | const std::string message, const HighsInt alt_debug_level) const { |
| 25 | // Sometimes a value other than highs_debug_level is passed as |
| 26 | // alt_debug_level, either to force debugging, or to limit |
| 27 | // debugging. If no value is passed, then alt_debug_level = -1, and |
| 28 | // highs_debug_level is used |
| 29 | const HighsInt use_debug_level = alt_debug_level >= 0 |
| 30 | ? alt_debug_level |
| 31 | : this->options_->highs_debug_level; |
| 32 | if (use_debug_level < kHighsDebugLevelCostly) |
| 33 | return HighsDebugStatus::kNotChecked; |
| 34 | // If highs_debug_level isn't being used, then indicate that it's |
| 35 | // being forced, and also force reporting of OK errors |
| 36 | const bool force = alt_debug_level > this->options_->highs_debug_level; |
| 37 | if (force) |
| 38 | highsLogDev(this->options_->log_options, HighsLogType::kInfo, |
| 39 | "CheckNlaINVERT: Forcing debug\n"); |
| 40 | |
| 41 | HighsDebugStatus return_status = HighsDebugStatus::kNotChecked; |
| 42 | return_status = HighsDebugStatus::kOk; |
| 43 | |
| 44 | const HighsInt num_row = this->lp_->num_row_; |
| 45 | const HighsInt num_col = this->lp_->num_col_; |
| 46 | const vector<HighsInt>& a_matrix_start = this->lp_->a_matrix_.start_; |
| 47 | const vector<HighsInt>& a_matrix_index = this->lp_->a_matrix_.index_; |
| 48 | const vector<double>& a_matrix_value = this->lp_->a_matrix_.value_; |
| 49 | const HighsInt* basic_index = this->basic_index_; |
| 50 | const HighsOptions* options = this->options_; |
| 51 | // Make sure that this isn't called between the matrix and LP resizing |
| 52 | assert(num_row == this->lp_->a_matrix_.num_row_); |
| 53 | assert(num_col == this->lp_->a_matrix_.num_col_); |
| 54 | const bool report = (options->log_dev_level != 0); |
| 55 | |
| 56 | highsLogDev(options->log_options, HighsLogType::kInfo, "\nCheckINVERT: %s\n", |
| 57 | message.c_str()); |
| 58 | |
| 59 | HVector column; |
| 60 | HVector rhs; |
| 61 | column.setup(num_row); |
| 62 | rhs.setup(num_row); |
| 63 | HVector residual; |
| 64 | double expected_density = 1; |
| 65 | |
| 66 | const bool random_ftran_test = true; |
| 67 | const bool report_basis = options->log_dev_level > 1 && num_row < 20; |
| 68 | if (random_ftran_test) { |
| 69 | // Solve for a random solution |
| 70 | HighsRandom random(1); |
| 71 | // Solve Bx=b |
| 72 | column.clear(); |
| 73 | rhs.clear(); |
| 74 | column.count = -1; |
| 75 | if (report_basis) |
| 76 | highsLogDev(options_->log_options, HighsLogType::kInfo, "Basis:"); |
| 77 | for (HighsInt iRow = 0; iRow < num_row; iRow++) { |
| 78 | rhs.index[rhs.count++] = iRow; |
| 79 | double value = random.fraction(); |
| 80 | column.array[iRow] = value; |
no test coverage detected