| 1927 | } |
| 1928 | |
| 1929 | HighsStatus Highs::getIisInterface() { |
| 1930 | if (this->model_status_ == HighsModelStatus::kOptimal || |
| 1931 | this->model_status_ == HighsModelStatus::kUnbounded) { |
| 1932 | // Strange to call getIis for a model that's known to be feasible |
| 1933 | highsLogUser( |
| 1934 | options_.log_options, HighsLogType::kInfo, |
| 1935 | "Calling Highs::getIis for a model that is known to be feasible\n"); |
| 1936 | this->iis_.clear(); |
| 1937 | // No IIS exists, so validate the empty HighsIis instance |
| 1938 | this->iis_.valid_ = true; |
| 1939 | this->iis_.status_ = kIisModelStatusFeasible; |
| 1940 | return this->getIisInterfaceReturn(HighsStatus::kOk, options_, |
| 1941 | callback_.active); |
| 1942 | } |
| 1943 | // Early exit for existing valid IIS |
| 1944 | if (this->iis_.valid_) |
| 1945 | return this->getIisInterfaceReturn(HighsStatus::kOk, options_, |
| 1946 | callback_.active); |
| 1947 | // Clear IIS |
| 1948 | this->iis_.clear(); |
| 1949 | // Check for trivial IIS: empty infeasible row or inconsistent bounds |
| 1950 | const HighsLp& lp = model_.lp_; |
| 1951 | if (this->iis_.trivial(lp, options_)) |
| 1952 | return this->getIisInterfaceReturn(HighsStatus::kOk, options_, |
| 1953 | callback_.active); |
| 1954 | HighsInt num_row = lp.num_row_; |
| 1955 | if (num_row == 0) { |
| 1956 | // For an LP with no rows, the only scope for infeasibility is |
| 1957 | // inconsistent columns bounds - which has already been assessed, |
| 1958 | // so validate the empty HighsIis instance |
| 1959 | this->iis_.valid_ = true; |
| 1960 | return this->getIisInterfaceReturn(HighsStatus::kOk, options_, |
| 1961 | callback_.active); |
| 1962 | } |
| 1963 | // Look for infeasible rows based on row value bounds |
| 1964 | if (this->iis_.rowValueBounds(lp, options_)) |
| 1965 | return this->getIisInterfaceReturn(HighsStatus::kOk, options_, |
| 1966 | callback_.active); |
| 1967 | // Don't continue with more expensive techniques if using the IIS |
| 1968 | // light strategy |
| 1969 | if (options_.iis_strategy == kIisStrategyLight) |
| 1970 | return this->getIisInterfaceReturn(HighsStatus::kOk, options_, |
| 1971 | callback_.active); |
| 1972 | // Clear IIS |
| 1973 | this->iis_.clear(); |
| 1974 | // Save original options |
| 1975 | HighsOptions original_options = this->options_; |
| 1976 | // Save original active callbacks and disable all except for |
| 1977 | // kCallbackLogging and kCallbackSimplexInterrupt |
| 1978 | std::vector<bool> original_callback_active = callback_.active; |
| 1979 | for (int i = kCallbackMin; i <= kCallbackMax; i++) { |
| 1980 | if (i != kCallbackLogging && i != kCallbackSimplexInterrupt && |
| 1981 | callback_.active[i]) |
| 1982 | this->stopCallback(i); |
| 1983 | } |
| 1984 | // Zero out all clocks and set time_limit to iis_time_limit |
| 1985 | this->zeroAllClocks(); |
| 1986 | this->setOptionValue("time_limit", options_.iis_time_limit); |
no test coverage detected