Skip to main content

Changing coefficients in the constraint

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    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?.
  • Jaromił Najman
    • Gurobi Staff

    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
  • Nazmi Sener
    • Gurobi-versary
    • Conversationalist
    • First Question

    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
  • Jaromił Najman
    • Gurobi Staff

    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.