Skip to main content

TypeError: 'gurobipy.LinExpr' object is not iterable

Answered

Comments

1 comment

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    I am not sure what you are trying to model with your constraint. Currently, your constraint reads

    \[\begin{align*}
    x_{0,2} + x_{0,3} \leq \max(x_{0,2} + x_{0,3})
    \end{align*}\]

    which is redundant. If you are trying to implement

    \[\begin{align*}
    x_{0,2} + x_{0,3} \leq \max(x_{0,2},x_{0,3}, \dots)
    \end{align*}\]

    then you have to us the addGenConstrMax method.

    Note that this method only accepts single variables. It does not accept linear or quadratic expressions. Thus, if you want to take the \(\max\) of a more complex term, you have to introduce auxiliary variables and equality constraints.

    Best regards, 
    Jaromił

    0

Please sign in to leave a comment.