From b0435224119656e43f32b729231d48877de40d4f Mon Sep 17 00:00:00 2001 From: John Forrest Date: Tue, 13 Aug 2024 14:37:49 +0100 Subject: [PATCH] add modifyCoefficient --- src/Cbc_C_Interface.cpp | 11 +++++++++++ src/Cbc_C_Interface.h | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Cbc_C_Interface.cpp b/src/Cbc_C_Interface.cpp index cae6ae1ba..99cdd533c 100644 --- a/src/Cbc_C_Interface.cpp +++ b/src/Cbc_C_Interface.cpp @@ -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 diff --git a/src/Cbc_C_Interface.h b/src/Cbc_C_Interface.h index f3c8afd11..d981d1319 100644 --- a/src/Cbc_C_Interface.h +++ b/src/Cbc_C_Interface.h @@ -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 */