| 4961 | } |
| 4962 | |
| 4963 | HighsStatus Highs::returnFromHighs(HighsStatus highs_return_status) { |
| 4964 | // Applies checks before returning from HiGHS |
| 4965 | HighsStatus return_status = highs_return_status; |
| 4966 | |
| 4967 | forceHighsSolutionBasisSize(); |
| 4968 | |
| 4969 | const bool consistent = |
| 4970 | debugHighsBasisConsistent(options_, model_.lp_, basis_) != |
| 4971 | HighsDebugStatus::kLogicalError; |
| 4972 | if (!consistent) { |
| 4973 | highsLogUser( |
| 4974 | options_.log_options, HighsLogType::kError, |
| 4975 | "returnFromHighs: Supposed to be a HiGHS basis, but not consistent\n"); |
| 4976 | assert(consistent); |
| 4977 | return_status = HighsStatus::kError; |
| 4978 | } |
| 4979 | // Check that any retained Ekk data - basis and NLA - are OK |
| 4980 | bool retained_ekk_data_ok = ekk_instance_.debugRetainedDataOk(model_.lp_) != |
| 4981 | HighsDebugStatus::kLogicalError; |
| 4982 | if (!retained_ekk_data_ok) { |
| 4983 | highsLogUser(options_.log_options, HighsLogType::kError, |
| 4984 | "returnFromHighs: Retained Ekk data not OK\n"); |
| 4985 | assert(retained_ekk_data_ok); |
| 4986 | return_status = HighsStatus::kError; |
| 4987 | } |
| 4988 | // Check that returnFromOptimizeModel() has been called |
| 4989 | if (!called_return_from_optimize_model) { |
| 4990 | highsLogDev(options_.log_options, HighsLogType::kError, |
| 4991 | "Highs::returnFromHighs() called with " |
| 4992 | "called_return_from_optimize_model false\n"); |
| 4993 | assert(called_return_from_optimize_model); |
| 4994 | } |
| 4995 | // Stop the HiGHS run clock if it is running |
| 4996 | if (timer_.running()) timer_.stop(); |
| 4997 | const bool dimensions_ok = |
| 4998 | lpDimensionsOk("returnFromHighs", model_.lp_, options_.log_options); |
| 4999 | if (!dimensions_ok) { |
| 5000 | highsLogDev(options_.log_options, HighsLogType::kError, |
| 5001 | "LP Dimension error in returnFromHighs()\n"); |
| 5002 | return_status = HighsStatus::kError; |
| 5003 | } |
| 5004 | assert(dimensions_ok); |
| 5005 | if (ekk_instance_.status_.has_nla) { |
| 5006 | const bool lp_factor_row_compatible = |
| 5007 | ekk_instance_.lpFactorRowCompatible(model_.lp_.num_row_); |
| 5008 | if (!lp_factor_row_compatible) { |
| 5009 | highsLogDev(options_.log_options, HighsLogType::kWarning, |
| 5010 | "Highs::returnFromHighs(): LP and HFactor have inconsistent " |
| 5011 | "numbers of rows\n"); |
| 5012 | assert(lp_factor_row_compatible); |
| 5013 | // Clear Ekk entirely |
| 5014 | ekk_instance_.clear(); |
| 5015 | } |
| 5016 | } |
| 5017 | return return_status; |
| 5018 | } |
| 5019 | |
| 5020 | void Highs::reportSolvedLpQpStats() { |
nothing calls this directly
no test coverage detected