Linear programming
Modeling with binary variables
Let y,x1,…,xn∈{0,1} be binary variables.
Logical NOT
y=¬x1
Logical AND
y=x1∧x2
- y≤x1
- y≤x2
- y+1≥x1+x2
Logical OR
y=x1∨x2
- y≥x1
- y≥x2
- y≤x1+x2
Logical XOR
y=x1⊕x2
- y≤x1+x2
- y+x1≥x2
- y+x2≥x1
- y+x1+x2≤2
Logical implication
y=(x1⟹x2)
- y≥x2
- y+x1≥1
- y+x1≤1+x2
Linearization
Product of a real variable and a binary variable
Let x be a real variable such that 0≤x≤M.
Let y be a binary variable.
Let z be a real variable such that z≥0.
z=xy
- z≤My
- z≤x
- z+M(1−y)≥x
Zero or greater than a constant
Let x be a real variable such that 0≤x≤M.
Let y be a binary variable.
Let L be a real constant such that 0≤L≤M.
x=0 or x≥L
- x≥Ly
- x≤My