55#include " Highs.h"
66#include " catch.hpp"
77
8- const bool dev_run = true ; // false;
8+ const bool dev_run = true ; // false; //
99const double inf = kHighsInf ;
1010
1111void testIis (const std::string& model, const HighsIis& iis);
@@ -51,6 +51,11 @@ TEST_CASE("lp-incompatible-bounds", "[iis]") {
5151 HighsIis iis;
5252 REQUIRE (highs.getIis (iis) == HighsStatus::kOk );
5353 checkIisLp (lp, iis, iis_lp);
54+
55+ highs.passModel (lp);
56+ highs.getIis (iis);
57+ REQUIRE (highs.checkIis () == HighsStatus::kOk );
58+
5459 // Perform full IIS
5560 REQUIRE (highs.run () == HighsStatus::kOk );
5661 REQUIRE (highs.getModelStatus () == HighsModelStatus::kInfeasible );
@@ -117,11 +122,16 @@ TEST_CASE("lp-empty-infeasible-row", "[iis]") {
117122
118123 checkIisLp (lp, iis, iis_lp);
119124
125+ highs.passModel (lp);
126+ highs.getIis (iis);
127+ REQUIRE (highs.checkIis () == HighsStatus::kOk );
128+
120129 highs.resetGlobalScheduler (true );
121130}
122131
123132TEST_CASE (" lp-get-iis-light" , " [iis]" ) {
124133 HighsLp lp;
134+ lp.model_name_ = " lp-get-iis-light" ;
125135 lp.num_col_ = 4 ;
126136 lp.num_row_ = 3 ;
127137 lp.col_cost_ = {0 , 0 , 0 , 0 };
@@ -135,7 +145,14 @@ TEST_CASE("lp-get-iis-light", "[iis]") {
135145 lp.a_matrix_ .start_ = {0 , 3 , 7 , 10 };
136146 lp.a_matrix_ .index_ = { 0 , 1 , 2 , 0 , 1 , 2 , 3 , 1 , 2 , 3 };
137147 lp.a_matrix_ .value_ = {1.5 , 2 , 1 , 4 , -2 , 1 , 2 , -2 , -1.5 , -1 };
138- Highs highs;
148+ //
149+ // 1.5w + 2x + y <= 30
150+ //
151+ // -10 <= 4w -2x + y + 2z <= 15
152+ //
153+ // -2x -1.5y -z >= -34
154+ //
155+ Highs highs;
139156 highs.setOptionValue (" output_flag" , dev_run);
140157 highs.passModel (lp);
141158 highs.setOptionValue (" iis_strategy" , kIisStrategyLight );
@@ -193,6 +210,15 @@ TEST_CASE("lp-get-iis", "[iis]") {
193210 lp.a_matrix_ .start_ = {0 , 2 , 4 , 6 };
194211 lp.a_matrix_ .index_ = {0 , 1 , 0 , 1 , 0 , 1 };
195212 lp.a_matrix_ .value_ = {2 , 1 , 1 , 3 , 1 , 1 };
213+ //
214+ // 2x + y <= 8
215+ //
216+ // x + 3y <= 9
217+ //
218+ // x + y <= -2
219+ //
220+ // x, y \in [0, inf)
221+ //
196222 // lp.col_name_ = {"Col0", "Col1"};
197223 // lp.row_name_ = {"Row0", "Row1", "Row2"};
198224 Highs highs;
@@ -213,6 +239,10 @@ TEST_CASE("lp-get-iis", "[iis]") {
213239 REQUIRE (highs.getIisLp (iis_lp) == HighsStatus::kOk );
214240 checkIisLp (lp, iis, iis_lp);
215241
242+ highs.passModel (lp);
243+ highs.getIis (iis);
244+ REQUIRE (highs.checkIis () == HighsStatus::kOk );
245+
216246 highs.resetGlobalScheduler (true );
217247}
218248
@@ -555,6 +585,10 @@ void testMps(std::string& model, const HighsInt iis_strategy,
555585
556586 checkIisLp (lp, iis, iis_lp);
557587
588+ highs.passModel (lp);
589+ highs.getIis (iis);
590+ REQUIRE (highs.checkIis () == HighsStatus::kOk );
591+
558592 } else {
559593 REQUIRE (num_iis_col == 0 );
560594 REQUIRE (num_iis_row == 0 );
@@ -588,7 +622,6 @@ void checkIisLp(HighsLp& lp, const HighsIis& iis, const HighsLp& iis_lp) {
588622 double bound;
589623 for (HighsInt iisRow = 0 ; iisRow < iis_num_row; iisRow++) {
590624 HighsInt iRow = iis.row_index_ [iisRow];
591- printf (" checkIisLp: iRow = %d\n " , int (iRow));
592625 if (iRow < 0 || iRow >= lp.num_row_ ) {
593626 printf (" iRow out of range\n " );
594627 }
@@ -648,14 +681,14 @@ void checkIisLp(HighsLp& lp, const HighsIis& iis, const HighsLp& iis_lp) {
648681 HighsInt iisRow = iis_row[iRow];
649682 if (iisRow >= 0 ) {
650683 const bool index_ok = index[iisRow] == iRow;
651- if (!index_ok) {
684+ if (!index_ok && dev_run ) {
652685 printf (" checkIisLp: IIS LP matrix index incorrect %d != %d\n " ,
653686 int (index[iisRow]), int (iRow));
654687 }
655688 REQUIRE (index_ok);
656689 index[iisRow] = illegal_index;
657690 const bool value_ok = value[iisRow] == lp.a_matrix_ .value_ [iEl];
658- if (!value_ok) {
691+ if (!value_ok && dev_run ) {
659692 printf (" checkIisLp: IIS LP matrix value incorrect %g != %g\n " ,
660693 value[iisRow], lp.a_matrix_ .value_ [iEl]);
661694 }
@@ -683,13 +716,13 @@ void checkIisLp(HighsLp& lp, const HighsIis& iis, const HighsLp& iis_lp) {
683716 HighsInt iisRow = iis_lp.a_matrix_ .index_ [iEl];
684717 HighsInt iRow = iis.row_index_ [iisRow];
685718 const bool index_ok = index[iRow] == iisRow;
686- if (!index_ok) {
719+ if (!index_ok && dev_run ) {
687720 printf (" checkIisLp: IIS LP matrix index incorrect %d != %d\n " ,
688721 int (index[iRow]), int (iisRow));
689722 }
690723 REQUIRE (index_ok);
691724 const bool value_ok = value[iRow] == iis_lp.a_matrix_ .value_ [iEl];
692- if (!value_ok) {
725+ if (!value_ok && dev_run ) {
693726 printf (" checkIisLp: IIS LP matrix value incorrect %g != %g\n " ,
694727 value[iRow], iis_lp.a_matrix_ .value_ [iEl]);
695728 }
0 commit comments