Skip to content

Commit 2181672

Browse files
committed
add modifyCoefficient
1 parent ffdc329 commit 2181672

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Osi/OsiSolverInterface.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,14 @@ int OsiSolverInterface::addRows(CoinModel &modelObject)
687687
return -1;
688688
}
689689
}
690+
// modify one coefficient
691+
void OsiSolverInterface::modifyCoefficient(int row, int column,
692+
double newElement,
693+
bool keepZero)
694+
{
695+
CoinPackedMatrix * matrix = getMutableMatrixByCol();
696+
matrix->modifyCoefficient(row, column, newElement, keepZero);
697+
}
690698
/* Strip off rows to get to this number of rows.
691699
If solver wants it can restore a copy of "base" (continuous) model here
692700
*/

src/Osi/OsiSolverInterface.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,9 @@ class OSILIB_EXPORT OsiSolverInterface {
695695
recognise any modifications to the matrix).
696696
*/
697697
virtual CoinPackedMatrix *getMutableMatrixByCol() const { return NULL; }
698-
698+
/// Modify a single element
699+
virtual void modifyCoefficient(int row, int column, double newElement,
700+
bool keepZero = false);
699701
/// Get the solver's value for infinity
700702
virtual double getInfinity() const = 0;
701703
//@}

0 commit comments

Comments
 (0)