# I cant solve linear programming

2 views (last 30 days)
Jay Loh on 14 Feb 2020
Answered: fred ssemwogerere on 14 Feb 2020
Obejctive function: f= 2.84x1 - 0.22x2-3.33x3 + 1.09x4 + 9.39x5 + 9.51x6
Constraints
1.1x1 + 0.9x2 +0.9x3+ 1.0x4 + 1.1x5 + 0.9x6 ≤ 200,000
0.5x1 + 0.35x2 +0.25x3+ 0.25x4 + 0.5x5 + 0.35x6 ≤ 100,000
0.01x1 + 0.15x2 +0.15x3+ 0.18x4 + 0.01x5 + 0.15x6 ≤ 20,000
0.4x1 + 0.06x2 +0.04x3+ 0.05x4 - 0.6x5 + 0.06x6 = 0
0.1x2+0.01x3 + 0.01x4 - 0.9x6 = 0
-6857.6x1 + 364x2 +2032x3- 1145x4 – 6857.6x5 + 364x6 + 21,520x7= 20,000,000
Anyone can show me the code?When I solve it by linprog it says it is unbounded problem. When using optimtool it tell me f need to be double. Who can solve my problem??

fred ssemwogerere on 14 Feb 2020
I think you should try to go with all that has been advised. To obtain an optimal solution, your problem will require specification of atleast the lower bounds. For example based on your code, assuming your variables have assumed lower bounds greater than zero, try this in your program to see if it gives you a different optimal solution:
f=[2.84,-0.22,-3.33,1.09,9.39,9.51,0];
A=[1.1,0.9,0.9,1,1.1,0.9,0;0.5,0.35,0.25,0.25,0.5,0.35,0;0.01,0.15,0.15,0.18,0.01,0.15,0];
b=[200000,100000,20000];
Aeq=[0.4,0.06,0.04,0.05,-0.6,0.06,0;0,0.1,0.01,0.01,0,-0.9,0;-6857.6,364,2032,-1145,-6857.6,364,21520];
beq=[0,0,20000000];
lb=zeros(7,1); % specification of assumed lower bounds to be greater than zero
x= linprog(f,A,b,Aeq,beq,lb);

### More Answers (2)

John D'Errico on 14 Feb 2020
Edited: John D'Errico on 14 Feb 2020
Who can solve it? Most likely, nobody. Your problem is unbounded. I can go through some mathematics to reduce it to show more clearly, but consider this:
You have a 6 variable problem, with 3 equality constraints. So we can simply enough (using a nullspace argument) show this reduces to a 3 dimensional problem. Thus we need to live in a planar 3-manifold of the 6 dimensional space. Any solution, if such a solution exists must live on that 3-manifold.
However, then you have exactly 3 linear inequality constraints that remain. We can transform them also into the planar manifold. Can you bound a 3-dimensional space using only 3 planes? (Well, yes, in context of minimizing a linear objective function. But there is no assurance that will happen.) There are no bound constraints listed at all. I think you will find the odds are good your problem is unbounded. And, lo, and behold, linprog tells us it is unbounded.
The resolution to your problem? Either find any errors in your equations as written, or accept that the variables probably need lower as well as upper bounds.
##### 1 CommentShowHide None
Jay Loh on 14 Feb 2020
Hi, The objective function and constraints i found in this link
So i think should be ok

Jon on 14 Feb 2020
It is of course possible to have a linear programming problem that is unbounded. This happens if there are no constraints that prevent you from choosing a solution that has an infinitely large value of the objective function.
If you do not think that this should be possible for your situation, then perhaps you have not entered either the objective function or the constraints properly into the call to linprog.
Please include your code where you call linprog. Also please use the code button on the MATLAB toolbar to have it formatted nicely.
##### 2 CommentsShowHide 1 older comment
Jay Loh on 14 Feb 2020
A=[1.1 0.9 0.9 1 1.1 0.9 0; 0.5 0.35 0.25 0.25 0.5 0.35 0; 0.01 0.15 0.15 0.18 0.01 0.15 0]
A =
1.1000 0.9000 0.9000 1.0000 1.1000 0.9000 0
0.5000 0.3500 0.2500 0.2500 0.5000 0.3500 0
0.0100 0.1500 0.1500 0.1800 0.0100 0.1500 0
>> B= [200000 100000 20000]
B =
200000 100000 20000
>> Aeq = [0.4 0.06 0.04 0.05 -0.6 0.06 0; 0 0.1 0.01 0.01 0 -0.9 0; -6857.6 364 2032 -1145 -6857.6 364 21520]
Aeq =
1.0e+04 *
0.0000 0.0000 0.0000 0.0000 -0.0001 0.0000 0
0 0.0000 0.0000 0.0000 0 -0.0001 0
-0.6858 0.0364 0.2032 -0.1145 -0.6858 0.0364 2.1520
>> Beq= [0,0,20000000];
>> x=linprog (f,A,B,Aeq,Beq);
Problem is unbounded.