0

I posted a similar question earlier here

How to write the following if-else condition in Linear/MI Programming? If $a = b$ then $c = d$ else $c = e$

$a,b,c,d,e$ all are variables. How can we write a linear program without multiplying d and e with binary variables? But we can use binary variables.

Vinay
  • 235

1 Answers1

1

As in this question, you need some tolerance $\delta>0$, bounds $[L_1,U_1]$ on $a-b$, bounds $[L_2,U_2]$ on $c-d$, and bounds $[L_3,U_3]$ on $c-e$.

Introduce three binary variables $y^-$, $y$, and $y^+$ and big-M constraints: $$ y^- + y + y^+ = 1\\ L_1 y^- + 0y + \delta y^+ \le a- b \le -\delta y^- + 0y + U_1 y^+\\ L_2(1-y) \le c - d \le U_2(1-y)\\ L_3 y \le c - e \le U_3 y $$

RobPratt
  • 50,938