How to convert the following if-else conditions to Linear integer programming constraints?

128 views Asked by At

if x ≥ 100, then x -100 + p(x) ≤ 0; else p(x) ≤ 0 p(x) is a linear function. We can add x ≥ 0 if it could make it easy.

I tried to make a binary variable z, if x ≥ 100, then z=1; else z=0. Then we got z(x-100)+p(x) ≤ 0. However, the term z(x-100) is nonlinear, we couldn't use it.

1

There are 1 answers

0
Hossein On

Some well-known tricks for describing such conditions (e.g., Either/Or and If/Then) as linear constraints can be found in this book (Applied Integer Programming: Modeling and Solution). See Section 3.6 (Transform Nonsimultaneous Constraints). Based on the technique described in Subsection 3.6.5, the condition if x ≥ 100, then x -100 + p(x) ≤ 0 can be linearized using the following two constraints:

  • x < 100 + M * y1
  • x - 100 + p(x) ≤ M * (1 - y1)

In the above constraints, y1 is a binary decision variable, and M is a big number. It should be noted that the first inequality is strict; But you can readily convert it to a non-strict one. See this link.

On the other hand, the condition if x < 100, then p(x) ≤ 0 can be enforced by the employment of the following two linear constraints in which y2 is again an auxiliary binary decision variable, and M' is a big number:

  • x ≥ 100 - M' * y2
  • p(x) ≤ M' * (1 - y2)