@@ -1893,6 +1893,47 @@ HighsStatus Highs::getStandardFormLp(HighsInt& num_col, HighsInt& num_row,
18931893 return HighsStatus::kOk ;
18941894}
18951895
1896+ HighsStatus Highs::getFixedLp (HighsLp& lp) const {
1897+ if (!this ->model_ .lp_ .isMip ()) {
1898+ highsLogUser (options_.log_options , HighsLogType::kError ,
1899+ " Incumbent model is not a MIP, so cannot form fixed LP\n " );
1900+ return HighsStatus::kError ;
1901+ }
1902+ if (!this ->solution_ .value_valid ) {
1903+ highsLogUser (options_.log_options , HighsLogType::kError ,
1904+ " Incumbent model does not have a valid solution, so cannot "
1905+ " form fixed LP\n " );
1906+ return HighsStatus::kError ;
1907+ }
1908+ lp = this ->model_ .lp_ ;
1909+ const std::vector<HighsVarType> integrality = this ->model_ .lp_ .integrality_ ;
1910+ lp.integrality_ .clear ();
1911+ HighsInt num_non_conts_fractional = 0 ;
1912+ double max_fractional = 0 ;
1913+ for (HighsInt iCol = 0 ; iCol < this ->model_ .lp_ .num_col_ ; iCol++) {
1914+ if (integrality[iCol] == HighsVarType::kContinuous ) continue ;
1915+ double value = this ->solution_ .col_value [iCol];
1916+ if (integrality[iCol] == HighsVarType::kInteger ||
1917+ integrality[iCol] == HighsVarType::kSemiInteger ) {
1918+ double fractional = fractionality (value);
1919+ if (fractional > this ->options_ .mip_feasibility_tolerance ) {
1920+ num_non_conts_fractional++;
1921+ max_fractional = std::max (fractional, max_fractional);
1922+ }
1923+ }
1924+ lp.col_lower_ [iCol] = value;
1925+ lp.col_upper_ [iCol] = value;
1926+ }
1927+ if (num_non_conts_fractional) {
1928+ highsLogUser (
1929+ options_.log_options , HighsLogType::kWarning ,
1930+ " Fixed LP has %d variables fixed at max fractional value of %g\n " ,
1931+ int (num_non_conts_fractional), max_fractional);
1932+ return HighsStatus::kWarning ;
1933+ }
1934+ return HighsStatus::kOk ;
1935+ }
1936+
18961937HighsStatus Highs::getDualRay (bool & has_dual_ray, double * dual_ray_value) {
18971938 has_dual_ray = false ;
18981939 return getDualRayInterface (has_dual_ray, dual_ray_value);
0 commit comments