I have a problem in writing a constraint in linear programming. I have a boolean variable c, that variable has to be 1 only if another variable (let's say x) is (for example) 5.
x is a non-negative integer.
I did:
c <= x / 5
c <= 5 / x
Unfortunately, in this way the model become non-linear. Is there a way to express that condition in a linear way?
Thank you.
In general something like:
5 - M(1-c) <= x <= 5 + M(1-c)
5.001 - Mc - Md <= x <= 4.999 + Mc + M(1-d)
c,d in {0,1}
x in [-M,M]
In practice we can often simplify this somewhat.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments