How to use non-binary variable in a conditional statement MILP?

306 Views Asked by At

I have a conditional statement I want to implement in a MILP. $A$ is a non-binary variable that has known upper and lower bounds. $B$ is a known parameter. And $C$ is a binary variable. How do I formulate the condition?

If $A < B$ then $C$ is $1$, otherwise $C$ is $0$ or $1$.

Is this possible? I am new to optimization using GAMS and i'm still figuring out how this works.

1

There are 1 best solutions below

1
On BEST ANSWER

We know the bounds of $A$, let say $m \le A \le M$.

if $m \ge B$, then we clearly, we have $A \ge B$.

Hence we assume that $m < B$, then we know that

$$\frac{B-A}{B-m} \le 1$$

we consider the constraint $$\frac{B-A}{B-m}\le C$$

Hence if $A < B$, then we have the left hand side of the inequality being positive and it is at most $1$, forcing $C$ to take value $1$.

If $A \ge B$, then the left hand side of the inequality is non-positive, hence not imposing constraint on $C$.