Skip to content

Commit

Permalink
add modifyCoefficient
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhforrest committed Aug 13, 2024
1 parent ffdc329 commit 2181672
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Osi/OsiSolverInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,14 @@ int OsiSolverInterface::addRows(CoinModel &modelObject)
return -1;
}
}
// modify one coefficient
void OsiSolverInterface::modifyCoefficient(int row, int column,
double newElement,
bool keepZero)
{
CoinPackedMatrix * matrix = getMutableMatrixByCol();
matrix->modifyCoefficient(row, column, newElement, keepZero);
}
/* Strip off rows to get to this number of rows.
If solver wants it can restore a copy of "base" (continuous) model here
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Osi/OsiSolverInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,9 @@ class OSILIB_EXPORT OsiSolverInterface {
recognise any modifications to the matrix).
*/
virtual CoinPackedMatrix *getMutableMatrixByCol() const { return NULL; }

/// Modify a single element
virtual void modifyCoefficient(int row, int column, double newElement,
bool keepZero = false);
/// Get the solver's value for infinity
virtual double getInfinity() const = 0;
//@}
Expand Down

0 comments on commit 2181672

Please sign in to comment.