How to code Binary Variable?

Y(I,t) 1 if ∑j T(j,I,t) + Z(I,t) >= 1,

0 Otherwise.

Thank you.

## Conditional Binary

### Re: Conditional Binary

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.:

http://yetanothermathprogrammingconsult ... ation.html

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

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.:

http://yetanothermathprogrammingconsult ... ation.html

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