Binary IP - Binari-zed result of negative value to 0, and positive value to 1

47 Views Asked by At

I have a set of variables $T_i = \{22, 23.6, 24, 24.2, 25\}$ and a constant value $C=24$.

Given $$ a =T_i - C $$

I'd like to turn the result of subtraction a to binary value $\{0,1\}$, such that if $T_i \leq C$, result should be $0$, and if $T_i > C$, result should be $1$. In the above example, result should be $\{0,0,0,1,1\}$.

Is there any way to do it?


I think it's one of the formulation for Integer Linear Programming(?). The bigger question is,

Given $$ e = E * a $$

I want $e = E$ if $a=1$ and $e = 0$ if $a=0$.