Skip to main content

Adding Indicator constraints for PWL constraints

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • Gurobi Staff

    It is not directly possible to model the indicator constraint \(b = 1 \rightarrow y = f(x)\), with \(f\) being a general function, e.g., PWL. However, you can model it with an auxiliary variable \(z\).

    You have given \(y = f(x)\) via addGenConstrXxx. You can now model the constraint

    \[\begin{align*}
    b = 1 \rightarrow z = y\\
    \end{align*}\]

    and use \(z\) in the rest of your model instead of \(y\). This way, when \(b=1\) then \(z=y\) and it is as if you would have used \(y\), but when \(b=0\) then \(y\) is a free variable because the equality constraint \(z = y\) is not enforced. Thus, the constraint \(y = f(x)\) is redundant because \(y\) is not used anywhere else in the model.

    Unfortunately, I am not a Pyomo user, thus I cannot really help on the implementation side but hopefully with the above, you might be able to implement the formulation.

    Best regards, 
    Jaromił

    0

Post is closed for comments.