# How to specify conditional constraints in integer linear programming

 0 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 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 23 Nov '13, 05:55 twfx 65●1●2●8 accept rate: 0%

 5 I'd like to turn the result of subtraction a to binary value {0,1}, such that 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? $$a \leq U \times b$$ $$a \geq L \times (1 - b) + \epsilon$$ for constants $$L, U, \epsilon: L + \epsilon \leq a \leq U, ~\epsilon > 0$$ The bigger question is, Given e = E * b I want e = E if b=1 and e = 0 if b=0. 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 23 Nov '13, 09:30 fbahr ♦ 4.6k●7●16 accept rate: 13%
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags: