Indicator Constraint Definition for Bounds
AnsweredHello,
We are trying to implement constraints such that logically:
x = 0 -> f = 0 (this is easy, x binary f continuous).
However, we want to ensure that for our model that:
x = 1 -> f > 0
But this sense can't be encoded.
Is it true that the first equation forces the second, or should we write the second as:
x = 1 -> f >= 0 and this follows correctly, or do we do an increment such that:
x = 1 -> f >= epsilon
We can also use other constraint else to force this behaviour perhaps - seeking guidance.
-
Official comment
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. -
Hi Phillip,
you can model this via indicator constraints. Perhaps these two posts (here and here) will be helpful.
Best regards
Jonasz1 -
Hi Phillip,
To briefly add on Jonasz' answer:
Is it true that the first equation forces the second
No, if you encode x=0 -> f=0, then for x=1, f can by anything, i.e., it can be f=0. If you really want to make sure that f is > 0 then, you have to use an epsilon for x=1 as you proposed. Note that this epsilon should not be smaller than the FeasibilityTol you are using. Something like epsilon = 1e-4 should work fine.
Best regards,
Jaromił1 -
Thank you both, that clarifies our thinking on our modelling implementation.
:)
0
Post is closed for comments.
Comments
4 comments