Changing coefficients in the constraint
AnsweredDear all,
I try to change coefficients of decision variable z for each scenario s. However z is used with two different coefficients. The constraint is given below. How can I do it?

Thanks in advance,
Have a nice day,
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Nazmi,
Gurobi reformulates the model such that every variable has exactly 1 coefficient. This means that the sum of your \(z\) variables actually looks like this
\[\sum_{j \in \mathcal{N}, j \neq k} \left (d_{ij}(s)z_{jk}(s)\right) + (d_{ik}(s) - O_i(s))z_{kk}(s)\]
Thus, you have to change the coefficient given by \((d_{ik}(s) - O_i(s))\).
Best regards,
Jaromił1 -
Hi Jaromil,
Thank you for your quick response. i is not equal to k also. I will try to rewrite this constraint. Another question: How can I change coefficient of any parameter in python? I cannot fully understand.
Thank you,
Kind regards,
0 -
Hi Nazmi,
You can use the chgCoeff function. To use it, you have to provide the constraint, variable, and the new coefficient value.
Best regards,
Jaromił0
Post is closed for comments.
Comments
4 comments