Multiplication of variables in "intlinprog" for mixed integer linear programming
4 views (last 30 days)
Show older comments
Hi,
I want to minimize the objective function like y*(x1*c1+x2*c2) where y,x1 and x2 are decision variables and c1,c2 are constants. Here y would be a binary result that is either 1 or 0 and x1 and x2 are real numbers. I was trying to use 'intlinprog' for this problem bus was facing difficulty to fit these variables in the objective function and the constraints as well since the variables are in multiplied form.I want to know whether I can solve this type of problem using 'intlinprog' function or I should go to other dirrection? If 'intlinprog' can be used then how can this be implemented?
0 Comments
Answers (2)
Matt J
on 26 Jun 2015
Edited: Matt J
on 26 Jun 2015
Since y is binary, just solve 2 separate problems corresponding to the cases y=0 and y=1, which will be standard linear programs. Then take the solution which gives the lowest value of the original objective.
3 Comments
Matt J
on 26 Jun 2015
Even now that you have 3 binary variables, my proposal is still reasonable. There are only 8 possible combinations of values of y1,y2,y3 to loop over.
More generally, the answer to your question is no. The multiplicative forms break the linearity of the problem, so intlinprog does not directly apply. You could use ga(), if you have the Global Optimization Toolbox.
Matt J
on 27 Jun 2015
Come to think of it, I think there is a way to rewrite the problem in standard intlinprog form, assuming the x variables have known bounds xmin(i)<=x(i)<=xmax(i). To simplify, I'll consider a version of the problem with only one y term,
y*(c1*x1+c2*x2) + c3*y
but the generalization to additional y's is straightfoward.
First, let us assume with no loss of generality that all bounds xmin(i)=0 and all xmax(i)=1. You can always normalize the x(i) so that this holds by rescaling the constants c1, c2, c3. Now define new non-binary variables z1=y*x1, z2=y*x2 so that the objective function can be rewritten in the linear form,
f(x1,x2,y,z1,z2) = c1*z1+c2*z2+c3*y
However, we also need to add linear constraints on z1 and z2 so that they have the correct relationship with y,x1,x2. The first set of constraints needed are,
0<=z1<=y
0<=z2<=y
This ensures that z1=z2=0 when y=0 and conversely that y=1 whever z1>0 or z2>0. A further set of constraints needed is
0<=x1-z1<=1-y
0<=x2-z2<=1-y
This ensures that, when y=1, we have z1=x1 and z2=x2. Obviously also, you must include whatever other constraints you already had on x1,x2, and y.
See Also
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!