| 788 | } |
| 789 | |
| 790 | HighsStatus Highs::readModel(const std::string& filename) { |
| 791 | this->logHeader(); |
| 792 | HighsStatus return_status = HighsStatus::kOk; |
| 793 | Filereader* reader = |
| 794 | Filereader::getFilereader(options_.log_options, filename); |
| 795 | if (reader == NULL) { |
| 796 | highsLogUser(options_.log_options, HighsLogType::kError, |
| 797 | "Model file %s not supported\n", filename.c_str()); |
| 798 | return HighsStatus::kError; |
| 799 | } |
| 800 | |
| 801 | HighsModel model; |
| 802 | FilereaderRetcode call_code = |
| 803 | reader->readModelFromFile(options_, filename, model); |
| 804 | delete reader; |
| 805 | if (call_code != FilereaderRetcode::kOk) { |
| 806 | interpretFilereaderRetcode(options_.log_options, filename, call_code); |
| 807 | const HighsStatus call_status = call_code == FilereaderRetcode::kWarning |
| 808 | ? HighsStatus::kWarning |
| 809 | : HighsStatus::kError; |
| 810 | return_status = interpretCallStatus(options_.log_options, call_status, |
| 811 | return_status, "readModelFromFile"); |
| 812 | if (return_status == HighsStatus::kError) return return_status; |
| 813 | } |
| 814 | model.lp_.model_name_ = extractModelName(filename); |
| 815 | const bool remove_rows_of_count_1 = false; |
| 816 | if (remove_rows_of_count_1) { |
| 817 | // .lp files from PWSC (notably st-test23.lp) have bounds for |
| 818 | // semi-continuous variables in the constraints section. By default, |
| 819 | // these are interpreted as constraints, so the semi-continuous |
| 820 | // variables are not set up correctly. Fix is to remove all rows of |
| 821 | // count 1, interpreting their bounds as bounds on the corresponding |
| 822 | // variable. |
| 823 | removeRowsOfCountOne(options_.log_options, model.lp_); |
| 824 | } |
| 825 | return_status = |
| 826 | interpretCallStatus(options_.log_options, passModel(std::move(model)), |
| 827 | return_status, "passModel"); |
| 828 | return returnFromHighs(return_status); |
| 829 | } |
| 830 | |
| 831 | HighsStatus Highs::matrixImage( |
| 832 | const std::string& matrix_image_filename, |