Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cbc_modifyCoefficient to C interface. #656

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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