| 75 | } |
| 76 | |
| 77 | bool HEkk::switchToDevex() { |
| 78 | // Parameters controlling switch from DSE to Devex on cost |
| 79 | const double kCostlyDseMeasureLimit = 1000.0; |
| 80 | const double kCostlyDseMinimumDensity = 0.01; |
| 81 | const double kCostlyDseFractionNumTotalIterationBeforeSwitch = 0.1; |
| 82 | const double kCostlyDseFractionNumCostlyDseIterationBeforeSwitch = 0.05; |
| 83 | bool switch_to_devex = false; |
| 84 | // Firstly consider switching on the basis of NLA cost |
| 85 | double costly_DSE_measure_denominator; |
| 86 | costly_DSE_measure_denominator = max( |
| 87 | max(info_.row_ep_density, info_.col_aq_density), info_.row_ap_density); |
| 88 | if (costly_DSE_measure_denominator > 0) { |
| 89 | info_.costly_DSE_measure = |
| 90 | info_.row_DSE_density / costly_DSE_measure_denominator; |
| 91 | info_.costly_DSE_measure = |
| 92 | info_.costly_DSE_measure * info_.costly_DSE_measure; |
| 93 | } else { |
| 94 | info_.costly_DSE_measure = 0; |
| 95 | } |
| 96 | bool costly_DSE_iteration = |
| 97 | info_.costly_DSE_measure > kCostlyDseMeasureLimit && |
| 98 | info_.row_DSE_density > kCostlyDseMinimumDensity; |
| 99 | info_.costly_DSE_frequency = |
| 100 | (1 - kRunningAverageMultiplier) * info_.costly_DSE_frequency; |
| 101 | if (costly_DSE_iteration) { |
| 102 | info_.num_costly_DSE_iteration++; |
| 103 | info_.costly_DSE_frequency += kRunningAverageMultiplier * 1.0; |
| 104 | // What if non-dual iterations have been performed: need to think about this |
| 105 | HighsInt local_iteration_count = |
| 106 | iteration_count_ - info_.control_iteration_count0; |
| 107 | HighsInt local_num_tot = lp_.num_col_ + lp_.num_row_; |
| 108 | // Switch to Devex if at least 5% of the (at least) 0.1NumTot iterations |
| 109 | // have been costly |
| 110 | switch_to_devex = |
| 111 | info_.allow_dual_steepest_edge_to_devex_switch && |
| 112 | (info_.num_costly_DSE_iteration > |
| 113 | local_iteration_count * |
| 114 | kCostlyDseFractionNumCostlyDseIterationBeforeSwitch) && |
| 115 | (local_iteration_count > |
| 116 | kCostlyDseFractionNumTotalIterationBeforeSwitch * local_num_tot); |
| 117 | |
| 118 | if (switch_to_devex) { |
| 119 | highsLogDev(options_->log_options, HighsLogType::kInfo, |
| 120 | "Switch from DSE to Devex after %" HIGHSINT_FORMAT |
| 121 | " costly DSE iterations of %" HIGHSINT_FORMAT |
| 122 | " with " |
| 123 | "densities C_Aq = %11.4g; R_Ep = %11.4g; R_Ap = " |
| 124 | "%11.4g; DSE = %11.4g\n", |
| 125 | info_.num_costly_DSE_iteration, local_iteration_count, |
| 126 | info_.col_aq_density, info_.row_ep_density, |
| 127 | info_.row_ap_density, info_.row_DSE_density); |
| 128 | } |
| 129 | } |
| 130 | if (!switch_to_devex) { |
| 131 | // Secondly consider switching on the basis of weight accuracy |
| 132 | double local_measure = info_.average_log_low_DSE_weight_error + |
| 133 | info_.average_log_high_DSE_weight_error; |
| 134 | double local_threshold = |
no test coverage detected