I want to know how to transform this logical if-then constraint? If $B=1$,then $A \ge C$, else $A=0$, where $A$ and $B$ are decision variables and $C$ are constants. $B$ is binary variable and $A\ge 0$.
Asked
Active
Viewed 363 times
4
-
5Does this answer your question? Linear Programming with additional "if-then"/"Default to zero" constraints? – RobPratt Jan 05 '23 at 13:38
1 Answers
7
For better readability, let $y_B \in \{0,1\}$ be your $B$ variable, and let $x_A \in \mathbb{R}^+$ be your $A$ variable. You can model your statement as follows:
$$ Cy_B \le x_A \le My_B $$
$M$ is an upper bound for variable $x_A$.
Kuifje
- 13,324
- 1
- 23
- 56
-
Thanks a lot. Your answer is really fantastic! Here is my answer, it is more complex and nonlinear. (y_B-1) * x_A=0, M+x_A-C >= M*y_B, where y_B is binary and M is a large positive number. – Alan Zhang Jan 05 '23 at 11:27