How to code Binary Variable?
Y(I,t) 1 if ∑j T(j,I,t) + Z(I,t) >= 1,
0 Otherwise.
Thank you.
How to code Binary Variable?
Y(I,t) 1 if ∑j T(j,I,t) + Z(I,t) >= 1,
0 Otherwise.
Thank you.
Omi,
To paraphrase your question, you ask “How can I have a condition iff a binary variable is 1”, e.g. for a binary y
expression >= 1 implies y = 1
expression < 1 implies y = 0
This doesn’t work well. Strict inequalities are not part of optimization for several reasons, e.g.:
Instead, we go the other direction: if y = 1, we turn a constraint on, otherwise it isn’t on, i.e. it is relaxed.
expression >= 1 - M * (1-y)
It’s important to choose the M large enough so that expression >= 1 - M is satisfied for any feasible point, but no larger than necessary.
-Steve