| 849 | } |
| 850 | |
| 851 | void testMps(std::string& model, const HighsInt iis_strategy, |
| 852 | const HighsModelStatus require_model_status) { |
| 853 | std::string model_file = |
| 854 | std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps"; |
| 855 | Highs highs; |
| 856 | highs.setOptionValue("output_flag", dev_run); |
| 857 | |
| 858 | REQUIRE(highs.readModel(model_file) == HighsStatus::kOk); |
| 859 | // if (iis_strategy == kIisStrategyFromRay || |
| 860 | // iis_strategy == kIisStrategyFromRayColPriority) { |
| 861 | // // For a ray strategy, solve the LP first |
| 862 | // REQUIRE(highs.run() == HighsStatus::kOk); |
| 863 | // } |
| 864 | highs.setOptionValue("iis_strategy", iis_strategy); |
| 865 | HighsIis iis; |
| 866 | REQUIRE(highs.getIis(iis) == HighsStatus::kOk); |
| 867 | if (dev_run && write_model) { |
| 868 | highs.writeModel(""); |
| 869 | highs.writeIisModel(""); |
| 870 | } |
| 871 | HighsInt num_iis_col = iis.col_index_.size(); |
| 872 | HighsInt num_iis_row = iis.row_index_.size(); |
| 873 | HighsModelStatus model_status = highs.getModelStatus(); |
| 874 | REQUIRE(model_status == require_model_status); |
| 875 | if (model_status == HighsModelStatus::kInfeasible) { |
| 876 | REQUIRE(num_iis_col > 0); |
| 877 | REQUIRE(num_iis_row > 0); |
| 878 | if (dev_run) |
| 879 | printf("Model %s has IIS with %d columns and %d rows\n", model.c_str(), |
| 880 | int(num_iis_col), int(num_iis_row)); |
| 881 | REQUIRE(iis.valid_ == true); |
| 882 | const bool find_irreducible = kIisStrategyIrreducible & iis_strategy; |
| 883 | if (find_irreducible) REQUIRE(iis.status_ == kIisModelStatusIrreducible); |
| 884 | const HighsInt in_iis_status = iis.status_ == kIisModelStatusIrreducible |
| 885 | ? kIisStatusInConflict |
| 886 | : kIisStatusMaybeInConflict; |
| 887 | for (HighsInt iX = 0; iX < num_iis_col; iX++) |
| 888 | REQUIRE(iis.col_status_[iis.col_index_[iX]] == in_iis_status); |
| 889 | for (HighsInt iX = 0; iX < num_iis_row; iX++) |
| 890 | REQUIRE(iis.row_status_[iis.row_index_[iX]] == in_iis_status); |
| 891 | } else { |
| 892 | REQUIRE(num_iis_col == 0); |
| 893 | REQUIRE(num_iis_row == 0); |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | void testFeasibilityRelaxation( |
| 898 | std::string& model, const double lower_penalty, const double upper_penalty, |
no test coverage detected