メインコンテンツへスキップ

Adding Indicator constraints for PWL constraints

回答済み

コメント

1件のコメント

  • 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

サインインしてコメントを残してください。