Skip to main content

Add constraint in GurobiPy using conditional decision variable

Answered

Comments

2 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 Aman,

    The error occurs because \(\texttt{model.x[t-1]}\) is a variable object and thus, cannot be evaluated to a value in the \(\texttt{if}\)-statement.

    You can find a detailed description of how to model a \(\texttt{if-elseif}\)-statement in this stackexchange post.

    Best regards,
    Jaromił

    0

Post is closed for comments.