Modeling following constraints in MILP. I want to know how I should formulate the following constraints in my MIP problem? x=x_1z_1+⋯+x_n z_n and y_1 <= y <= y_n and z_1+ cdots +z_n=1

caritatsjq

caritatsjq

Answered question

2022-10-24

Modeling following constraints in MILP
I want to know how I should formulate the following constraints in my MIP problem?
x = x 1 z 1 + + x n z n  and  y 1 y y n  and  z 1 + + z n = 1
OR
y = y 1 w 1 + + y n w n  and  x 1 x x n  and  w 1 + + w n = 1
x and y are continuous variables. z 1 , , z n and w 1 , , w n are binary decision variables. x 1 , , x n and y 1 , , y n are parameters.

Answer & Explanation

Szulikto

Szulikto

Beginner2022-10-25Added 22 answers

Step 1
Brace yourself, the notation is about to get a little ugly.
Let me list the variables first. In addition to x and y (continuous), we will have z 1 , , z n { 0 , 1 } and w 1 , , w n { 0 , 1 }, plus z ^ , z ~ , w ^ , w ~ [ 0 , 1 ] and one more binary variable t { 0 , 1 }. The constraints will be as follows:
x = i x i z i + x 1 z ^ + x n z ~ y = i y i w i + y 1 w ^ + y n w ~ i z i = 1 t z ^ + z ~ = t i w i = t w ^ + w ~ = 1 t .
Step 2
If t = 0, the fourth equation zeroes out the last two terms of the first equation and the third equation plus the first equation result in x being one of the x i . Meanwhile, the fifth equation zeroes out the summation in the second equation and the sixth equation and what's left of the second equation make y a convex combination of the endpoints y 1 , y n , so basically any value in the interval [ y 1 , y n ]. If t = 1, the reverse occurs.
varsa1m

varsa1m

Beginner2022-10-26Added 4 answers

Step 1
(1) x min x x max (2) y min y y max (3) ( x min i x i ) t x i x i z i x max t (4) t i z i 1 ( n 1 ) t (5) ( y min i y i ) ( 1 t ) y i y i w i y max ( 1 t ) (6) ( 1 t ) i w i 1 ( n 1 ) ( 1 t )
Step 2
Constraints (1) and (2) are valid for both sides of the desired disjunction. Constraints (3) and (4) enforce
t = 0 ( x = i x i z i i z i = 1 ) .
Constraints (5) and (6) enforce
t = 1 ( y = i y i w i i w i = 1 ) .

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?