I'm currently stuck with a MIP program where the interest rate, i, is based on the number of units produced for Housing Plan A. If the number of plan A houses sold is the highest among all four types then i=1. If the number of plan A houses sold is the second highest, then i=2 and so on up to i=4. The interest rate is basically 2i%. Not really sure how to add constraints that will represent the position of plan A houses and implement the correct interest rate in the objective function. The objective function maximizes the total profit (e.g 50,000A + 40,000B + 70,000C + 80,000D). Any ideas on how to use binary variables to represent position?
Asked
Active
Viewed 109 times
1
-
1Please edit your question with an example of how you have attempted a solution. – Quintin Balsdon Dec 05 '16 at 08:32
1 Answers
2
One way of doing this is, is using a permutation matrix p(i,j)
. I.e.
sets
i = {A,B,C,D}
j = {1,2,3,4}
binary variable p(i,j)
# assignment constraints
sum(i,p(i,j))=1
sum(j,p(i,j))=1
# quantities sold
x(j) = sum(i, p(i,j)*x(i))
x(j) >= x(j+1)
# interest rate
r(i) = sum(j, p(i,j)*r(j))
r(j) = 2*j/100
Unfortunately the expression p(i,j)*x(i)
is non-linear. With some effort we can repair this as follows:
sets
i = {A,B,C,D}
j = {1,2,3,4}
binary variable p(i,j)
positive variable q(i,j)
# assignment constraints
sum(i,p(i,j))=1
sum(j,p(i,j))=1
# quantities sold
x(j) = sum(i, q(i,j))
x(j) >= x(j+1)
# linearization of q(i,j) = p(i,j)*x(i)
q(i,j) <= p(i,j)*xup(i)
x(i) - xup(i)*(1-p(i,j)) <= q(i,j) <= x(i)
' interest rate
r(i) = 2*sum(j, p(i,j)*j)/100
Here xup(i)
is an upper bound on x(i)
.
Not a very elegant formulation.

Erwin Kalvelagen
- 15,677
- 2
- 14
- 39
-
But isn't the first constraint under quantities sold non-linear since you're multiplying the permutation matrix with x(i) [the quantity you are also solving for]? – Gurobi22 Dec 06 '16 at 11:02
-
Darn, you are right. Could be linearized easily but that makes this thing rather complicated. – Erwin Kalvelagen Dec 06 '16 at 11:08
-
I've been trying to figure that out, but seems a little difficult to linearize the Ranking constraint since both quantities and binary variables are unknown. Any ideas? – Gurobi22 Dec 06 '16 at 11:11