| 11 | #include "lp_data/HighsInfoDebug.h" |
| 12 | |
| 13 | HighsDebugStatus debugInfo(const HighsOptions& options, const HighsLp& lp, |
| 14 | const HighsBasis& basis, |
| 15 | const HighsSolution& solution, const HighsInfo& info, |
| 16 | const HighsModelStatus model_status) { |
| 17 | if (options.highs_debug_level < kHighsDebugLevelCheap) |
| 18 | return HighsDebugStatus::kNotChecked; |
| 19 | HighsDebugStatus return_status = HighsDebugStatus::kOk; |
| 20 | HighsDebugStatus call_status; |
| 21 | |
| 22 | const bool have_info = info.valid; |
| 23 | const bool have_primal_solution = solution.value_valid; |
| 24 | const bool have_dual_solution = solution.dual_valid; |
| 25 | const bool have_basis = basis.valid; |
| 26 | switch (model_status) { |
| 27 | case HighsModelStatus::kNotset: |
| 28 | case HighsModelStatus::kLoadError: |
| 29 | case HighsModelStatus::kModelError: |
| 30 | case HighsModelStatus::kPresolveError: |
| 31 | case HighsModelStatus::kSolveError: |
| 32 | case HighsModelStatus::kPostsolveError: |
| 33 | case HighsModelStatus::kModelEmpty: |
| 34 | case HighsModelStatus::kMemoryLimit: |
| 35 | // Should have no info, so check this and return |
| 36 | assert(!have_primal_solution); |
| 37 | assert(!have_dual_solution); |
| 38 | assert(!have_basis); |
| 39 | call_status = debugNoInfo(info); |
| 40 | if (call_status != HighsDebugStatus::kOk) return_status = call_status; |
| 41 | return return_status; |
| 42 | case HighsModelStatus::kOptimal: |
| 43 | case HighsModelStatus::kInfeasible: |
| 44 | case HighsModelStatus::kUnbounded: |
| 45 | case HighsModelStatus::kObjectiveBound: |
| 46 | case HighsModelStatus::kObjectiveTarget: |
| 47 | case HighsModelStatus::kUnboundedOrInfeasible: |
| 48 | case HighsModelStatus::kTimeLimit: |
| 49 | case HighsModelStatus::kIterationLimit: |
| 50 | case HighsModelStatus::kSolutionLimit: |
| 51 | case HighsModelStatus::kInterrupt: |
| 52 | case HighsModelStatus::kHighsInterrupt: |
| 53 | case HighsModelStatus::kUnknown: |
| 54 | // Should have info |
| 55 | assert(have_info == true); |
| 56 | if (have_primal_solution) { |
| 57 | if (info.num_primal_infeasibilities < 0) { |
| 58 | highsLogDev(options.log_options, HighsLogType::kError, |
| 59 | "Have primal solution but num_primal_infeasibilities = " |
| 60 | "%" HIGHSINT_FORMAT "\n", |
| 61 | info.num_primal_infeasibilities); |
| 62 | return HighsDebugStatus::kLogicalError; |
| 63 | } else if (info.num_primal_infeasibilities == 0) { |
| 64 | if (info.primal_solution_status != kSolutionStatusFeasible) { |
| 65 | highsLogDev(options.log_options, HighsLogType::kError, |
| 66 | "Have primal solution and no infeasibilities but " |
| 67 | "primal status = %" HIGHSINT_FORMAT "\n", |
| 68 | info.primal_solution_status); |
| 69 | return HighsDebugStatus::kLogicalError; |
| 70 | } |
no test coverage detected