@@ -1055,17 +1055,57 @@ TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
10551055 double mip_optimal_objective = h.getInfo ().objective_function_value ;
10561056 HighsSolution solution = h.getSolution ();
10571057
1058+ // Transform the incumbent MIP into the fixed LP
1059+ HighsLp mip = h.getLp ();
1060+ std::vector<HighsInt> col_set;
1061+ std::vector<double > fixed_value;
1062+ std::vector<HighsVarType> integrality = mip.integrality_ ;
1063+ for (HighsInt iCol = 0 ; iCol < mip.num_col_ ; iCol++) {
1064+ if (mip.integrality_ [iCol] == HighsVarType::kInteger ) {
1065+ col_set.push_back (iCol);
1066+ fixed_value.push_back (solution.col_value [iCol]);
1067+ integrality[iCol] = HighsVarType::kContinuous ;
1068+ }
1069+ }
1070+ h.clearIntegrality ();
1071+ HighsInt num_set_entries = col_set.size ();
1072+ h.changeColsBounds (num_set_entries, col_set.data (), fixed_value.data (),
1073+ fixed_value.data ());
1074+ h.setOptionValue (" presolve" , kHighsOffString );
1075+ REQUIRE (h.run () == HighsStatus::kOk );
1076+
1077+ REQUIRE (h.getInfo ().objective_function_value == mip_optimal_objective);
1078+ // In calling changeColsBounds, the incumbent solution is cleared,
1079+ // so there is no information from which to construct an advanced
1080+ // basis. Hence simplex starts from a logical basis and requires a
1081+ // positive number of iterations (#2556)
1082+ REQUIRE (h.getInfo ().simplex_iteration_count > 0 );
1083+
1084+ // Now, passing the MIP solution, there is information from which to
1085+ // construct an advanced basis. In the case of flugpl, this is
1086+ // optimal, so no simplex iterations are required
1087+ h.clearSolver ();
1088+ h.setSolution (solution);
1089+ REQUIRE (h.run () == HighsStatus::kOk );
1090+
1091+ REQUIRE (h.getInfo ().objective_function_value == mip_optimal_objective);
1092+ REQUIRE (h.getInfo ().simplex_iteration_count == 0 );
1093+
1094+ // Now re-load the MIP, re-solve, and get the fixed LP
1095+ REQUIRE (h.passModel (mip) == HighsStatus::kOk );
1096+ REQUIRE (h.run () == HighsStatus::kOk );
1097+ REQUIRE (h.getInfo ().objective_function_value == mip_optimal_objective);
1098+
10581099 REQUIRE (h.getFixedLp (fixed_lp) == HighsStatus::kOk );
10591100
10601101 REQUIRE (h.passModel (fixed_lp) == HighsStatus::kOk );
10611102 REQUIRE (h.run () == HighsStatus::kOk );
10621103
10631104 REQUIRE (h.getInfo ().objective_function_value == mip_optimal_objective);
10641105
1065- // Now run from saved solution without presolve
1106+ // Now run from saved solution ( without presolve)
10661107 h.clearSolver ();
10671108 h.setSolution (solution);
1068- h.setOptionValue (" presolve" , kHighsOffString );
10691109 REQUIRE (h.run () == HighsStatus::kOk );
10701110
10711111 REQUIRE (h.getInfo ().objective_function_value == mip_optimal_objective);
@@ -1074,7 +1114,7 @@ TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
10741114 REQUIRE (h.readModel (model_file) == HighsStatus::kOk );
10751115 // Perturb one of the integer variables for code coverage of
10761116 // warning: makes fixed LP of flugpl infeasible
1077- std::vector<HighsVarType> integrality = h.getLp ().integrality_ ;
1117+ integrality = h.getLp ().integrality_ ;
10781118 for (HighsInt iCol = 0 ; iCol < fixed_lp.num_col_ ; iCol++) {
10791119 if (integrality[iCol] != HighsVarType::kContinuous ) {
10801120 solution.col_value [iCol] -= 0.01 ;
0 commit comments