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 if a <= 0, then b=0 if a > 0, then b=1 In the above example, result should be {0,0,0,1,1}. How can I formulate such conditional constraints into linear constraints? The bigger question is, Given e = E * b I want e = E if b=1 and e = 0 if b=0. I have formulated and verified the constraints as below \(a \leq U \times b) \) \(a > (L-\epsilon) \times (1-b) \) To verify, Let U = 8, L = 0, \(\epsilon\) = 1 a=1, b=1 1 <= 8*1= True 1 > -1*(1-1)= True a=1, b=0 1 <= 8*0= False 1 > -1*(1-0)= True a=0, b=1 0 <= 8*1= True 0 > -1*(1-1)= False a=0, b=0 0 <= 8*0= True 0 > -1*(1-0)= True
asked
twfx |

\(a \leq U \times b\)
If \(E\) is a constant, the "bigger question" isn't a question at all ...so – I'd guess – \(E\) is supposed to be a variable? In that case:
answered
fbahr ♦ |