88const bool dev_run = false ;
99const double inf = kHighsInf ;
1010
11- void checkIisLp (const HighsIis& iis, const HighsLp& iis_lp);
12-
1311void testIis (const std::string& model, const HighsIis& iis);
1412
1513void testMps (std::string& model, const HighsInt iis_strategy,
@@ -21,6 +19,8 @@ void testFeasibilityRelaxation(
2119 const double rhs_penalty,
2220 const double require_feasibility_objective_function_value);
2321
22+ void checkIisLp (HighsLp& lp, const HighsIis& iis, const HighsLp& iis_lp);
23+
2424TEST_CASE (" lp-incompatible-bounds" , " [iis]" ) {
2525 // LP has row0 and col2 with inconsistent bounds.
2626 //
@@ -50,7 +50,7 @@ TEST_CASE("lp-incompatible-bounds", "[iis]") {
5050 REQUIRE (highs.getIisLp (iis_lp) == HighsStatus::kOk );
5151 HighsIis iis;
5252 REQUIRE (highs.getIis (iis) == HighsStatus::kOk );
53- checkIisLp (iis, iis_lp);
53+ checkIisLp (lp, iis, iis_lp);
5454 /*
5555 // Perform full IIS
5656 REQUIRE(highs.run() == HighsStatus::kOk);
@@ -437,14 +437,6 @@ void testIis(const std::string& model, const HighsIis& iis) {
437437 highs.resetGlobalScheduler (true );
438438}
439439
440- void checkIisLp (const HighsIis& iis, const HighsLp& iis_lp) {
441- HighsInt iis_num_col = iis.col_index_ .size ();
442- HighsInt iis_num_row = iis.row_index_ .size ();
443- REQUIRE (iis_lp.num_col_ == iis_num_col);
444- REQUIRE (iis_lp.num_row_ == iis_num_row);
445- }
446-
447-
448440void testMps (std::string& model, const HighsInt iis_strategy,
449441 const HighsModelStatus require_model_status) {
450442 std::string model_file =
@@ -492,3 +484,38 @@ void testFeasibilityRelaxation(
492484 REQUIRE (h.getInfo ().objective_function_value ==
493485 require_feasibility_objective_function_value);
494486}
487+
488+ void checkIisLp (HighsLp& lp, const HighsIis& iis, const HighsLp& iis_lp) {
489+ HighsInt iis_num_col = iis.col_index_ .size ();
490+ HighsInt iis_num_row = iis.row_index_ .size ();
491+ REQUIRE (iis_lp.num_col_ == iis_num_col);
492+ REQUIRE (iis_lp.num_row_ == iis_num_row);
493+
494+ lp.a_matrix_ .ensureColwise ();
495+ std::vector<HighsInt> iis_row;
496+ iis_row.assign (lp.num_row_ , -1 );
497+ for (HighsInt iisRow = 0 ; iisRow < iis_num_row; iisRow++) {
498+ HighsInt iRow = iis.row_index_ [iisRow];
499+ iis_row[iRow] = iisRow;
500+ REQUIRE (iis_lp.row_lower_ [iisRow] == lp.row_lower_ [iRow]);
501+ REQUIRE (iis_lp.row_upper_ [iisRow] == lp.row_upper_ [iRow]);
502+ }
503+
504+ for (HighsInt iisCol = 0 ; iisCol < iis_num_col; iisCol++) {
505+ HighsInt iCol = iis.col_index_ [iisCol];
506+ REQUIRE (iis_lp.col_cost_ [iisCol] == lp.col_cost_ [iCol]);
507+ REQUIRE (iis_lp.col_lower_ [iisCol] == lp.col_lower_ [iCol]);
508+ REQUIRE (iis_lp.col_upper_ [iisCol] == lp.col_upper_ [iCol]);
509+ for (HighsInt iEl = lp.a_matrix_ .start_ [iCol];
510+ iEl < lp.a_matrix_ .start_ [iCol+1 ]; iisCol++) {
511+ HighsInt iRow = lp.a_matrix_ .index_ [iEl];
512+ HighsInt iisRow = iis_row[iRow];
513+ if (iisRow >= 0 ) {
514+ REQUIRE (iis_lp.a_matrix_ .index_ [iisCol] == iisRow);
515+ REQUIRE (iis_lp.a_matrix_ .value_ [iisCol] == lp.a_matrix_ .value_ [iEl]);
516+ }
517+ }
518+ }
519+
520+ }
521+
0 commit comments