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 38e3568 commit b043522
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/Cbc_C_Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3520,6 +3520,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
Expand Down
12 changes: 11 additions & 1 deletion src/Cbc_C_Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,17 @@ 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 b043522

Please sign in to comment.