@@ -124,11 +124,17 @@ bool HighsIis::trivial(const HighsLp& lp, const HighsOptions& options) {
124124 }
125125 // Now look for empty rows that cannot have zero activity
126126 std::vector<HighsInt> count;
127- count.assign (lp.num_row_ , 0 );
128- for (HighsInt iCol = 0 ; iCol < lp.num_col_ ; iCol++) {
129- for (HighsInt iEl = lp.a_matrix_ .start_ [iCol];
130- iEl < lp.a_matrix_ .start_ [iCol + 1 ]; iEl++)
131- count[lp.a_matrix_ .index_ [iEl]]++;
127+ // Get the row counts
128+ if (lp.a_matrix_ .isColwise ()) {
129+ count.assign (lp.num_row_ , 0 );
130+ for (HighsInt iCol = 0 ; iCol < lp.num_col_ ; iCol++) {
131+ for (HighsInt iEl = lp.a_matrix_ .start_ [iCol];
132+ iEl < lp.a_matrix_ .start_ [iCol + 1 ]; iEl++)
133+ count[lp.a_matrix_ .index_ [iEl]]++;
134+ }
135+ } else {
136+ for (HighsInt iRow = 0 ; iRow < lp.num_row_ ; iRow++)
137+ count.push_back (lp.a_matrix_ .start_ [iRow + 1 ]-lp.a_matrix_ .start_ [iRow]);
132138 }
133139 assert (this ->row_index_ .size () == 0 );
134140 for (HighsInt iRow = 0 ; iRow < lp.num_row_ ; iRow++) {
@@ -289,6 +295,7 @@ HighsStatus HighsIis::getData(const HighsLp& lp, const HighsOptions& options,
289295 std::vector<HighsInt> from_col;
290296 std::vector<HighsInt> to_row;
291297 to_row.assign (lp.num_row_ , -1 );
298+ // To get the IIS data needs the matrix to be column-wise
292299 assert (lp.a_matrix_ .isColwise ());
293300 // Determine how to detect whether a row is in infeasible_row and
294301 // (then) gather information about it
@@ -434,6 +441,8 @@ void HighsIis::getLp(const HighsLp& lp) {
434441 }
435442 iis_lp.num_col_ = iis_lp.col_cost_ .size ();
436443 iis_lp.num_row_ = iis_lp.row_lower_ .size ();
444+ // The IIS LP matrix will have the same format as the incumbent LP
445+ iis_lp.a_matrix_ .format_ = lp.a_matrix_ .format_ ;
437446 iis_lp.a_matrix_ .num_col_ = iis_lp.num_col_ ;
438447 iis_lp.a_matrix_ .num_row_ = iis_lp.num_row_ ;
439448 iis_lp.model_name_ = lp.model_name_ + " _IIS" ;
0 commit comments