Linear programming

Modeling with binary variables

Let y,x1,,xn{0,1}y, x_1, \dots, x_n \in \{0, 1\} be binary variables.

Logical NOT

y=¬x1y = \neg x_1

Logical AND

y=x1x2y = x_1 \land x_2

Logical OR

y=x1x2y = x_1 \lor x_2

Logical XOR

y=x1x2y = x_1 \oplus x_2

Logical implication

y=(x1    x2)y = (x_1 \implies x_2)

Linearization

Product of a real variable and a binary variable

Let xx be a real variable such that 0xM0 \leq x \leq M.
Let yy be a binary variable.
Let zz be a real variable such that z0z \geq 0.

z=xyz = xy

Zero or greater than a constant

Let xx be a real variable such that 0xM0 \leq x \leq M.
Let yy be a binary variable.
Let LL be a real constant such that 0LM0 \leq L \leq M.

x=0x = 0 or xLx \geq L