Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
fwesselm committed Jan 27, 2025
1 parent 30e2311 commit c13d1a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 57 deletions.
51 changes: 0 additions & 51 deletions src/presolve/HPresolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,6 @@ void HPresolve::resetColImpliedBoundsDerivedFromRow(HighsInt row) {
for (const HighsInt& col : affectedCols) {
// set implied bounds to infinite values if they were deduced from the
// given row
assert(colLowerSource[col] == row || colUpperSource[col] == row);
resetColImpliedBounds(col, row);
}
}
Expand All @@ -717,51 +716,10 @@ void HPresolve::resetRowDualImpliedBoundsDerivedFromCol(HighsInt col) {
for (const HighsInt& row : affectedRows) {
// set implied bounds to infinite values if they were deduced from the
// given column
assert(rowDualLowerSource[row] == col || rowDualUpperSource[row] == col);
resetRowDualImpliedBounds(row, col);
}
}

void HPresolve::recomputeColImpliedBounds(HighsInt row) {
// recompute implied column bounds affected by a modification in a row
// (removed / added non-zeros, etc.)
if (colImplSourceByRow[row].empty()) return;
std::set<HighsInt> affectedCols(colImplSourceByRow[row]);
for (const HighsInt& col : affectedCols) {
// set implied bounds to infinite values if they were deduced from the given
// row
if (colLowerSource[col] == row) changeImplColLower(col, -kHighsInf, -1);
if (colUpperSource[col] == row) changeImplColUpper(col, kHighsInf, -1);

// iterate over column and recompute the implied bounds
for (const HighsSliceNonzero& nonz : getColumnVector(col)) {
updateColImpliedBounds(nonz.index(), col, nonz.value());
}
}
}

void HPresolve::recomputeRowDualImpliedBounds(HighsInt col) {
// recompute implied row dual bounds affected by a modification in a column
// (removed / added non-zeros, etc.)
if (implRowDualSourceByCol[col].empty()) return;
std::set<HighsInt> affectedRows(implRowDualSourceByCol[col]);
for (const HighsInt& row : affectedRows) {
// set implied bounds to infinite values if they were deduced from the given
// column
if (rowDualLowerSource[row] == col)
changeImplRowDualLower(row, -kHighsInf, -1);
if (rowDualUpperSource[row] == col)
changeImplRowDualUpper(row, kHighsInf, -1);

// iterate over row and recompute the implied bounds
for (const HighsSliceNonzero& nonz : getRowVector(row)) {
// integer columns cannot be used to tighten bounds on dual multipliers
if (model->integrality_[nonz.index()] != HighsVarType::kInteger)
updateRowDualImpliedBounds(row, nonz.index(), nonz.value());
}
}
}

HighsInt HPresolve::findNonzero(HighsInt row, HighsInt col) {
if (rowroot[row] == -1) return -1;

Expand Down Expand Up @@ -2485,9 +2443,6 @@ void HPresolve::substitute(HighsInt row, HighsInt col, double rhs) {
addToMatrix(colrow, Acol[rowiter], scale * Avalue[rowiter]);
}

// recompute implied column bounds affected by the substitution
// recomputeColImpliedBounds(colrow);

// check if this is an equation row and it now has a different size
reinsertEquation(colrow);
// printf("after substitution: ");
Expand Down Expand Up @@ -2517,12 +2472,6 @@ void HPresolve::substitute(HighsInt row, HighsInt col, double rhs) {
model->col_cost_[col] = 0.0;
}

// recompute implied row dual bounds affected by substitution
for (HighsInt rowiter : rowpositions) {
if (Acol[rowiter] == col) continue;
// recomputeRowDualImpliedBounds(Acol[rowiter]);
}

// finally remove the entries of the row that was used for substitution
for (HighsInt rowiter : rowpositions) unlink(rowiter);
}
Expand Down
8 changes: 2 additions & 6 deletions src/presolve/HPresolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class HPresolve {

void updateColImpliedBounds(HighsInt row, HighsInt col, double val);

void updateRowDualImpliedBounds(HighsInt row, HighsInt col, double val);

void resetColImpliedBounds(HighsInt col, HighsInt row = -1);

void resetRowDualImpliedBounds(HighsInt row, HighsInt col = -1);
Expand All @@ -162,12 +164,6 @@ class HPresolve {

void resetRowDualImpliedBoundsDerivedFromCol(HighsInt col);

void recomputeColImpliedBounds(HighsInt row);

void recomputeRowDualImpliedBounds(HighsInt col);

void updateRowDualImpliedBounds(HighsInt row, HighsInt col, double val);

bool rowCoefficientsIntegral(HighsInt row, double scale) const;

bool isImpliedFree(HighsInt col) const;
Expand Down

0 comments on commit c13d1a0

Please sign in to comment.