I have built a decomposition algorithm using the gurobi python interface.
The algorithm involves adding new variables to already existing constraints of my model in each iteration. Right now I am reading the constraints from the model via getConstrByName
and getRow(constraint)
, add the new variables to the resulting linear expression, delete the old constraint and add the new constraint to the model. This procedure is extremely inefficient.
Is there a more efficient way to add new variables to existing constraints in a gurobi model?
使用新变量,约束和新系数调用Model.chgCoeff() 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.