| 28 | } |
| 29 | |
| 30 | HighsInt HFactor::rebuild(HighsTimerClock* factor_timer_clock_pointer) { |
| 31 | const bool report_lu = false; |
| 32 | // Check that the refactorization information should be used |
| 33 | assert(refactor_info_.use); |
| 34 | /** |
| 35 | * 0. Clear L and U factor |
| 36 | */ |
| 37 | luClear(); |
| 38 | |
| 39 | nwork = 0; |
| 40 | basis_matrix_num_el = 0; |
| 41 | HighsInt stage = num_row; |
| 42 | HighsInt rank_deficiency = 0; |
| 43 | vector<bool> has_pivot; |
| 44 | has_pivot.assign(num_row, false); |
| 45 | const bool report_unit = false; |
| 46 | const bool report_singletons = false; |
| 47 | const bool report_markowitz = false; |
| 48 | const bool report_anything = |
| 49 | report_unit || report_singletons || report_markowitz; |
| 50 | if (report_anything) printf("\nRefactor\n"); |
| 51 | // Take build_synthetic_tick from the refactor info so that this |
| 52 | // refactorization doesn't look unrealistically cheap. |
| 53 | this->build_synthetic_tick = this->refactor_info_.build_synthetic_tick; |
| 54 | // Check that the refactorization info has been set up |
| 55 | assert((int)this->refactor_info_.pivot_row.size() >= num_row); |
| 56 | assert((int)this->refactor_info_.pivot_var.size() >= num_row); |
| 57 | assert((int)this->refactor_info_.pivot_type.size() >= num_row); |
| 58 | for (HighsInt iK = 0; iK < num_row; iK++) { |
| 59 | HighsInt iRow = this->refactor_info_.pivot_row[iK]; |
| 60 | HighsInt iVar = this->refactor_info_.pivot_var[iK]; |
| 61 | int8_t pivot_type = this->refactor_info_.pivot_type[iK]; |
| 62 | assert(!has_pivot[iRow]); |
| 63 | |
| 64 | if (pivot_type == kPivotLogical || pivot_type == kPivotUnit) { |
| 65 | if (pivot_type == kPivotLogical) { |
| 66 | // |
| 67 | // 1.1 Logical column |
| 68 | if (report_unit) printf("Stage %d: Logical\n", (int)iK); |
| 69 | assert(iVar >= num_col); |
| 70 | basis_matrix_num_el++; |
| 71 | } else if (pivot_type == kPivotUnit) { |
| 72 | // |
| 73 | // 1.2 (Structural) unit column |
| 74 | if (report_unit) printf("Stage %d: Unit\n", (int)iK); |
| 75 | assert(iVar < num_col); |
| 76 | HighsInt start = a_start[iVar]; |
| 77 | HighsInt count = a_start[iVar + 1] - start; |
| 78 | assert(a_index[start] == iRow); |
| 79 | assert(count == 1 && a_value[start] == 1); |
| 80 | basis_matrix_num_el++; |
| 81 | } |
| 82 | // 1.3 Record unit column |
| 83 | l_start.push_back(l_index.size()); |
| 84 | u_pivot_index.push_back(iRow); |
| 85 | u_pivot_value.push_back(1); |
| 86 | u_start.push_back(u_index.size()); |
| 87 | } else if (pivot_type == kPivotRowSingleton || |