Skip to main content

Issue with general constraint

Ongoing

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,

    Actually, the error you see does not come from the indicator constraint but from your \(\texttt{cost_function}\), since you are asking for an \(\texttt{if}\)-clause with \(\texttt{continuous_penalties_slo_u_v[u, v] > tolerance}\) where \(\texttt{continuous_penalties_slo_u_v[u, v]}\) is an optimization variable.

    You should consider what you what to achieve by \(\Gamma(\texttt{if-clause})\). If you are trying to model something like \(\Gamma(1)\) if \(\beta \cdot \Delta > tolerance\) and \(\Gamma(1)\) otherwise, then it is best to introduce an additional binary variable and model the \(\texttt{if-else}\)-statement (see, e.g., this stackexchange post for how to model an \(\texttt{if-else}\)-statement).

    Your can then reformulate your \(\texttt{cost_function}\) with the new variables.

    Best regards,
    Jaromił

    0
  • Matthias Miltenberger
    • Gurobi Staff

    crosspost on Stackoverflow

    0
  • Laaziz Lahlou
    • Gurobi-versary
    • Curious
    • Conversationalist

    Dear Matthias,

    The post has been deleted. I will put a working example and share it with you here to reproduce the output. Thanks Jaromil for the suggestion and reply.

    All the best.

    Laaziz

    0

Post is closed for comments.