| 844 | } |
| 845 | |
| 846 | HighsStatus Highs::readBasis(const std::string& filename) { |
| 847 | this->logHeader(); |
| 848 | HighsStatus return_status = HighsStatus::kOk; |
| 849 | // Try to read basis file into read_basis |
| 850 | HighsBasis read_basis = basis_; |
| 851 | return_status = interpretCallStatus( |
| 852 | options_.log_options, |
| 853 | readBasisFile(options_.log_options, model_.lp_, read_basis, filename), |
| 854 | return_status, "readBasis"); |
| 855 | if (return_status != HighsStatus::kOk) return return_status; |
| 856 | // Basis read OK: check whether it's consistent with the LP |
| 857 | if (!isBasisConsistent(model_.lp_, read_basis)) { |
| 858 | highsLogUser(options_.log_options, HighsLogType::kError, |
| 859 | "readBasis: invalid basis\n"); |
| 860 | return HighsStatus::kError; |
| 861 | } |
| 862 | // Update the HiGHS basis and invalidate any simplex basis for the model |
| 863 | basis_ = read_basis; |
| 864 | basis_.valid = true; |
| 865 | basis_.useful = true; |
| 866 | // Follow implications of a new HiGHS basis |
| 867 | newHighsBasis(); |
| 868 | // Can't use returnFromHighs since... |
| 869 | return HighsStatus::kOk; |
| 870 | } |
| 871 | |
| 872 | HighsStatus Highs::writeModel(const std::string& filename) { |
| 873 | return writeLocalModel(model_, filename); |