Warm tip: This article is reproduced from serverfault.com, please click

How can I define a set of linear constraints for the condition: "if x1 ≤ 0, then x2 ≤ 0"?

发布于 2020-12-10 13:33:01

As the question suggests, I'm trying to define linear constraints for the condition "if x1 ≤ 0, then x2 ≤ 0" with x1, x2 in [-10, 10]. I have tried doing this as follows, where B1 is a binary variable and M is a very large number:

X2 - M * X1 * B1 ≤ 0

X1 ≤ 11 * B1

-11 * B1 ≤ X1

The idea is that b1=1 if x>0 and b1=0 if x1≤0. However, this is incorrect because when x1 = 0, we have that b1 can be both 0 or 1. I don't know how to change this without using strict inequalities, which is not possible. Can anyone help?

Questioner
Kevin Lucas
Viewed
1
Erwin Kalvelagen 2020-12-10 22:41:43

X2 - M * X1 * B1 ≤ 0 looks non-linear to me. Here is my proposal:

    x1 ≥ 0.001 - 10.001*b
    x2 ≤ 10*(1-b) 
     b ∈ {0,1}

The 0.001 is there to force b=1 when x1=0.