问题
I am facing a problem where I must call the Gurobi engine iteratively. Between runs, I have to update the constant term in some of the constraints. I check the manual book in which I find GRBModel::chgCoeff() could be used to change the coefficient of variables in the constraint but there is no function related to changing the constant term. Any idea to do that? Thank you!
回答1:
I think that you have to set the RHS attribute of the Linear Constraint object. So, if constr is your constraint, something like
constr.Set(GRB.DoubleAttr.RHS, 329);
(this is C#, I guess you use C++, so the case of some of the letters may be different...).
来源:https://stackoverflow.com/questions/30355095/how-to-update-a-constant-term-of-a-constraint-in-gurobi