Skip to content

Commit

Permalink
Add Cbc_modifyCoefficient to C interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
jetuk committed Jul 2, 2024
1 parent 72fa111 commit 62509bd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Cbc_C_Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3523,6 +3523,17 @@ Cbc_setInteger(Cbc_Model *model, int iColumn)
model->solver_->setInteger(iColumn);
}

/** Change matrix coefficients */
void CBC_LINKAGE
Cbc_modifyCoefficient(Cbc_Model *model, int row, int column, double newValue )
{
Cbc_flush(model);
VALIDATE_ROW_INDEX(row, model);
VALIDATE_COL_INDEX(column, model);

model->solver_->modifyCoefficient(row, column, newValue);
}

/** Adds a new column */
void CBC_LINKAGE
Cbc_addCol(Cbc_Model *model, const char *name, double lb,
Expand Down
10 changes: 10 additions & 0 deletions src/Cbc_C_Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,16 @@ Cbc_setContinuous(Cbc_Model *model, int iColumn);
CBCLIB_EXPORT void CBC_LINKAGE
Cbc_setInteger(Cbc_Model *model, int iColumn);

/** @brief Change matrix coefficients
*
* @param model problem object
* @param row row index
* @param column column index
* @param newValue new value of the coefficient
**/
CBCLIB_EXPORT void CBC_LINKAGE
Cbc_modifyCoefficient(Cbc_Model *model, int row, int column, double newValue);

/** @brief Frees memory of model object
*
* @param model problem object */
Expand Down

0 comments on commit 62509bd

Please sign in to comment.