@@ -219,6 +219,19 @@ class HighsPostsolveStack {
219219 void transformToPresolvedSpace (std::vector<double >& primalSol) const ;
220220 };
221221
222+ struct SlackColSubstitution {
223+ double rhs;
224+ double colCost;
225+ HighsInt row;
226+ HighsInt col;
227+ RowType rowType;
228+
229+ void undo (const HighsOptions& options,
230+ const std::vector<Nonzero>& rowValues,
231+ const std::vector<Nonzero>& colValues, HighsSolution& solution,
232+ HighsBasis& basis);
233+ };
234+
222235 // / tags for reduction
223236 enum class ReductionType : uint8_t {
224237 kLinearTransform ,
@@ -234,6 +247,7 @@ class HighsPostsolveStack {
234247 kForcingColumnRemovedRow ,
235248 kDuplicateRow ,
236249 kDuplicateColumn ,
250+ kSlackColSubstitution ,
237251 };
238252
239253 HighsDataStack reductionValues;
@@ -323,6 +337,26 @@ class HighsPostsolveStack {
323337 reductionAdded (ReductionType::kFreeColSubstitution );
324338 }
325339
340+ template <typename RowStorageFormat, typename ColStorageFormat>
341+ void slackColSubstitution (HighsInt row, HighsInt col, double rhs,
342+ double colCost, RowType rowType,
343+ const HighsMatrixSlice<RowStorageFormat>& rowVec,
344+ const HighsMatrixSlice<ColStorageFormat>& colVec) {
345+ rowValues.clear ();
346+ for (const HighsSliceNonzero& rowVal : rowVec)
347+ rowValues.emplace_back (origColIndex[rowVal.index ()], rowVal.value ());
348+
349+ colValues.clear ();
350+ for (const HighsSliceNonzero& colVal : colVec)
351+ colValues.emplace_back (origRowIndex[colVal.index ()], colVal.value ());
352+
353+ reductionValues.push (SlackColSubstitution{rhs, colCost, origRowIndex[row],
354+ origColIndex[col], rowType});
355+ reductionValues.push (rowValues);
356+ reductionValues.push (colValues);
357+ reductionAdded (ReductionType::kSlackColSubstitution );
358+ }
359+
326360 template <typename ColStorageFormat>
327361 void doubletonEquation (HighsInt row, HighsInt colSubst, HighsInt col,
328362 double coefSubst, double coef, double rhs,
@@ -710,6 +744,14 @@ class HighsPostsolveStack {
710744 reduction.undo (options, solution, basis);
711745 break ;
712746 }
747+ case ReductionType::kSlackColSubstitution : {
748+ SlackColSubstitution reduction;
749+ reductionValues.pop (colValues);
750+ reductionValues.pop (rowValues);
751+ reductionValues.pop (reduction);
752+ reduction.undo (options, rowValues, colValues, solution, basis);
753+ break ;
754+ }
713755 default :
714756 printf (" Reduction case %d not handled\n " ,
715757 int (reductions[i - 1 ].first ));
@@ -887,6 +929,14 @@ class HighsPostsolveStack {
887929 reductionValues.pop (reduction);
888930 reduction.undo (options, solution, basis);
889931 }
932+ case ReductionType::kSlackColSubstitution : {
933+ SlackColSubstitution reduction;
934+ reductionValues.pop (colValues);
935+ reductionValues.pop (rowValues);
936+ reductionValues.pop (reduction);
937+ reduction.undo (options, rowValues, colValues, solution, basis);
938+ break ;
939+ }
890940 }
891941 }
892942#ifdef DEBUG_EXTRA
0 commit comments