Applies checks before returning from optimizeModel()
| 4782 | |
| 4783 | // Applies checks before returning from optimizeModel() |
| 4784 | HighsStatus Highs::returnFromOptimizeModel(const HighsStatus run_return_status, |
| 4785 | const bool undo_mods) { |
| 4786 | assert(!called_return_from_optimize_model); |
| 4787 | HighsStatus return_status = highsStatusFromHighsModelStatus(model_status_); |
| 4788 | if (return_status != run_return_status) { |
| 4789 | highsLogDev( |
| 4790 | options_.log_options, HighsLogType::kError, |
| 4791 | "Highs::returnFromOptimizeModel: run_return_status = %d != %d = " |
| 4792 | "return_status = highsStatusFromHighsModelStatus(model_status_ = %s)\n", |
| 4793 | int(run_return_status), int(return_status), |
| 4794 | modelStatusToString(model_status_).c_str()); |
| 4795 | } |
| 4796 | assert(return_status == run_return_status); |
| 4797 | // return_status = run_return_status; |
| 4798 | switch (model_status_) { |
| 4799 | // First consider the error returns |
| 4800 | case HighsModelStatus::kNotset: |
| 4801 | case HighsModelStatus::kLoadError: |
| 4802 | case HighsModelStatus::kModelError: |
| 4803 | case HighsModelStatus::kPresolveError: |
| 4804 | case HighsModelStatus::kSolveError: |
| 4805 | case HighsModelStatus::kPostsolveError: |
| 4806 | case HighsModelStatus::kMemoryLimit: |
| 4807 | // Don't clear the model status! |
| 4808 | // invalidateSolverData(); |
| 4809 | invalidateInfo(); |
| 4810 | invalidateRunData(); |
| 4811 | invalidateSolution(); |
| 4812 | invalidateBasis(); |
| 4813 | assert(return_status == HighsStatus::kError); |
| 4814 | break; |
| 4815 | |
| 4816 | // Then consider the OK returns |
| 4817 | case HighsModelStatus::kModelEmpty: |
| 4818 | invalidateInfo(); |
| 4819 | invalidateRunData(); |
| 4820 | invalidateSolution(); |
| 4821 | invalidateBasis(); |
| 4822 | assert(return_status == HighsStatus::kOk); |
| 4823 | break; |
| 4824 | |
| 4825 | case HighsModelStatus::kOptimal: |
| 4826 | // The following is an aspiration |
| 4827 | // |
| 4828 | // assert(info_.primal_solution_status == kSolutionStatusFeasible); |
| 4829 | // |
| 4830 | // assert(info_.dual_solution_status == kSolutionStatusFeasible); |
| 4831 | assert(model_status_ == HighsModelStatus::kNotset || |
| 4832 | model_status_ == HighsModelStatus::kOptimal); |
| 4833 | assert(return_status == HighsStatus::kOk); |
| 4834 | break; |
| 4835 | |
| 4836 | case HighsModelStatus::kInfeasible: |
| 4837 | case HighsModelStatus::kUnbounded: |
| 4838 | case HighsModelStatus::kObjectiveBound: |
| 4839 | case HighsModelStatus::kObjectiveTarget: |
| 4840 | // For kInfeasible, will not have a basis, if infeasibility was |
| 4841 | // detected in presolve or by IPX without crossover |
nothing calls this directly
no test coverage detected