@@ -1228,6 +1228,42 @@ TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
12281228 h.resetGlobalScheduler (true );
12291229}
12301230
1231+ TEST_CASE (" get-presolved-mip" , " [highs_test_mip_solver]" ) {
1232+ HighsLp lp;
1233+ lp.num_col_ = 3 ;
1234+ lp.num_row_ = 3 ;
1235+ lp.col_cost_ = {1 , 1 , 1 };
1236+ lp.col_lower_ = {0 , -kHighsInf , -kHighsInf };
1237+ lp.col_upper_ = {kHighsInf , kHighsInf , kHighsInf };
1238+ lp.integrality_ = {HighsVarType::kContinuous , HighsVarType::kInteger ,
1239+ HighsVarType::kInteger };
1240+ lp.row_lower_ = {2 , 6 , 8 };
1241+ lp.row_upper_ = {2 , kHighsInf , kHighsInf };
1242+ lp.a_matrix_ .format_ = MatrixFormat::kRowwise ;
1243+ lp.a_matrix_ .start_ = {0 , 3 , 6 , 9 };
1244+ lp.a_matrix_ .index_ = {0 , 1 , 2 , 0 , 1 , 2 , 0 , 1 , 2 };
1245+ lp.a_matrix_ .value_ = {1 , 1 , 1 , 1 , -1 , 2 , 1 , 3 , -1 };
1246+ Highs h;
1247+ h.setOptionValue (" output_flag" , dev_run);
1248+ // Code coverage of highsVarTypeToString for all cases
1249+ HighsLogOptions log_options = h.getOptions ().log_options ;
1250+ for (HighsInt iVarType = -1 ;
1251+ iVarType < HighsInt (HighsVarType::kImplicitInteger ) + 2 ; iVarType++)
1252+ highsLogUser (log_options, HighsLogType::kInfo , " Variable type %2d is %s\n " ,
1253+ int (iVarType), highsVarTypeToString (iVarType).c_str ());
1254+ h.passModel (lp);
1255+ h.presolve ();
1256+ // Presolved MIP has an implied integer, so this tests passing such
1257+ HighsLp presolved_lp = h.getPresolvedModel ().lp_ ;
1258+ h.run ();
1259+ const double lp_objective_value = h.getObjectiveValue ();
1260+ h.passModel (presolved_lp);
1261+ h.run ();
1262+ const double presolved_lp_objective_value = h.getObjectiveValue ();
1263+ REQUIRE (presolved_lp_objective_value == lp_objective_value);
1264+ h.resetGlobalScheduler (true );
1265+ }
1266+
12311267TEST_CASE (" get-fixed-lp-semi" , " [highs_test_mip_solver]" ) {
12321268 HighsLp lp;
12331269 lp.num_col_ = 4 ;
@@ -1245,6 +1281,11 @@ TEST_CASE("get-fixed-lp-semi", "[highs_test_mip_solver]") {
12451281 Highs h;
12461282 h.setOptionValue (" output_flag" , dev_run);
12471283 h.setOptionValue (" presolve" , kHighsOffString );
1284+ // Code coverage of highsVarTypeToString for four main types
1285+ for (HighsInt iCol = 0 ; iCol < lp.num_col_ ; iCol++)
1286+ highsLogUser (h.getOptions ().log_options , HighsLogType::kInfo ,
1287+ " Column %d is of type %s\n " , int (iCol),
1288+ highsVarTypeToString (lp.integrality_ [iCol]).c_str ());
12481289 h.passModel (lp);
12491290 h.run ();
12501291 double mip_optimal_objective = h.getInfo ().objective_function_value ;
@@ -1256,6 +1297,7 @@ TEST_CASE("get-fixed-lp-semi", "[highs_test_mip_solver]") {
12561297 REQUIRE (h.run () == HighsStatus::kOk );
12571298
12581299 REQUIRE (h.getInfo ().objective_function_value == mip_optimal_objective);
1300+ h.resetGlobalScheduler (true );
12591301}
12601302
12611303TEST_CASE (" row-fixed-lp" , " [highs_test_mip_solver]" ) {
0 commit comments