Skip to main content

How to ensure that two variables are not =/= 0 at the same time without using binaries?

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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • Gurobi Staff

    Hi Pedro,

    You don't have to multiply the binary variables with your continuous ones.

    You could use Gurobi's indicator constraints to model

    \[\begin{align*}
    b=1 &\rightarrow x_1 = 0\\
    b=0 &\rightarrow x_2 = 0
    \end{align*}\]

    With the above, always at least one of the two variables \(x_1,x_2\) equals \(0\). This introduces only 1 binary per variable pair, which should be acceptable. Of course, you would have to test whether it is OK for your model's performance.

    Continuous "tricks" such as yours always work with tolerances and tend to cause numerical issues.

    The warning about Gurobi not supporting signomial terms is correct. Gurobi only support piecewise-linear approximations of signomial terms (cf. addGenConstrXxx) and is thus not suitable for your approach.

    Best regards, 
    Jaromił

    0

Post is closed for comments.