| 273 | // Methods below are not called externally |
| 274 | |
| 275 | HighsDebugStatus debugAnalysePrimalDualErrors( |
| 276 | const HighsOptions& options, HighsPrimalDualErrors& primal_dual_errors) { |
| 277 | std::string value_adjective; |
| 278 | HighsLogType report_level; |
| 279 | HighsDebugStatus return_status = HighsDebugStatus::kOk; |
| 280 | const bool force_report = options.highs_debug_level >= kHighsDebugLevelCostly; |
| 281 | if (primal_dual_errors.num_nonzero_basic_duals >= 0) { |
| 282 | if (primal_dual_errors.num_nonzero_basic_duals > 0) { |
| 283 | value_adjective = "Error"; |
| 284 | report_level = HighsLogType::kError; |
| 285 | return_status = HighsDebugStatus::kLogicalError; |
| 286 | } else { |
| 287 | value_adjective = ""; |
| 288 | report_level = HighsLogType::kVerbose; |
| 289 | return_status = HighsDebugStatus::kOk; |
| 290 | } |
| 291 | if (force_report) report_level = HighsLogType::kInfo; |
| 292 | highsLogDev( |
| 293 | options.log_options, report_level, |
| 294 | "PrDuErrors : %-9s Nonzero basic duals: num = %7" HIGHSINT_FORMAT |
| 295 | "; " |
| 296 | "max = %9.4g; sum = %9.4g\n", |
| 297 | value_adjective.c_str(), primal_dual_errors.num_nonzero_basic_duals, |
| 298 | primal_dual_errors.max_nonzero_basic_dual, |
| 299 | primal_dual_errors.sum_nonzero_basic_duals); |
| 300 | } |
| 301 | if (primal_dual_errors.num_off_bound_nonbasic >= 0) { |
| 302 | if (primal_dual_errors.num_off_bound_nonbasic > 0) { |
| 303 | value_adjective = "Error"; |
| 304 | report_level = HighsLogType::kError; |
| 305 | return_status = HighsDebugStatus::kLogicalError; |
| 306 | } else { |
| 307 | value_adjective = ""; |
| 308 | report_level = HighsLogType::kVerbose; |
| 309 | return_status = HighsDebugStatus::kOk; |
| 310 | } |
| 311 | if (force_report) report_level = HighsLogType::kInfo; |
| 312 | highsLogDev( |
| 313 | options.log_options, report_level, |
| 314 | "PrDuErrors : %-9s Off-bound nonbasic values: num = %7" HIGHSINT_FORMAT |
| 315 | "; " |
| 316 | "max = %9.4g; sum = %9.4g\n", |
| 317 | value_adjective.c_str(), primal_dual_errors.num_off_bound_nonbasic, |
| 318 | primal_dual_errors.max_off_bound_nonbasic, |
| 319 | primal_dual_errors.sum_off_bound_nonbasic); |
| 320 | } |
| 321 | if (primal_dual_errors.glpsol_num_primal_residual_errors >= 0) { |
| 322 | if (primal_dual_errors.glpsol_max_primal_residual.absolute_value > |
| 323 | excessive_residual_error) { |
| 324 | value_adjective = "Excessive"; |
| 325 | report_level = HighsLogType::kError; |
| 326 | return_status = HighsDebugStatus::kError; |
| 327 | } else if (primal_dual_errors.glpsol_max_primal_residual.absolute_value > |
| 328 | large_residual_error) { |
| 329 | value_adjective = "Large"; |
| 330 | report_level = HighsLogType::kDetailed; |
| 331 | return_status = HighsDebugStatus::kWarning; |
| 332 | } else { |
no test coverage detected