Filter löschen
Filter löschen

Both primal and dual problems are infeasible

6 Ansichten (letzte 30 Tage)
yu yue
yu yue am 11 Okt. 2016
Bearbeitet: Matt J am 15 Okt. 2016
I want to solve a linear optimisation problem in MatLab. But i see an error message :
Exiting: One or more of the residuals, duality gap, or
total relative error has stalled: both the primal and the dual appear to be infeasible.
My equation :
z=150*x9 + 150*x10 + 305*x11 + 100*x12 (min)
Limits :
2.5*x1 - 2.5*x2 <=1;
1.67*x1 - 1.67*x4 <=0.8;
5*x1 - 5*x5 <=1;
5*x2 - 5*x3<=1;
2.5*x2 - 2.5*x4 <=1;
5*x3 - 5*x5 <=1;
x6<=0.5;
x7<=1.65;
x8<=5.45.
Constrain:
-9.17*x1 + 2.5*x2 + 1.67*x4 + 5*x5 + x6 = 0.8;
2.5*x1 - 10*x2 + 5*x3 +2.5*x4 + x9 -x13= 2.4;
5*x2 - 10*x3 +5*x5 + x7 -x12 +x16 = 0.4;
1.67*x1 + 2.5*x2 - 4.17*x4 + x10 -x14 =1.6;
5*x1 + 5*x3 - 10*x5 + x11 + x12 - x15 -x16 =2.4;
x8 - x9 - x10 - x11 + x13 + x14+ x15 = 0.
My code in MatLab :
c=[0;0;0;0;0;0;0;0;150;150;305;100;0;0;0;0;];
A = [-9.17,2.5,0,1.67,5,1,0,0,0,0,0,0,0,0,0,0;
2.5,-10,5,2.5,0,0,0,0,1,0,0,0,-1,0,0,0;
0,5,-10,0,5,0,1,0,0,0,0,-1,0,0,0,1;
1.67,2.5,0,-4.17,0,0,0,0,0,1,0,0,0,-1,0,0;
5,0,5,0,-10,0,0,0,0,0,1,1,0,0,-1,-1;
0,0,0,0,0,0,0,1,-1,-1,-1,0,1,1,1,0;
2.5,-2.5,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
1.67,0,0,-1.67,0,0,0,0,0,0,0,0,0,0,0,0;
5,0,0,0,-5,0,0,0,0,0,0,0,0,0,0,0;
0,5,-5,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,2.5,0,-2.5,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,5,0,-5,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0;
];
b = [0.8;2.4;0.4;1.6;2.4;0;1;0.8;1;1;1;1;0.5;1.65;5.45;];
[x,fval] = linprog(f,A,b)
I think, everything is true but software say to me there was an error!
Please someone help me for this subject...
  1 Kommentar
Matt J
Matt J am 11 Okt. 2016
[x,fval] = linprog(f,A,b)
I think you really meant to write linprog(c,A,b)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 11 Okt. 2016
Bearbeitet: Matt J am 11 Okt. 2016
I think, everything is true but software say to me there was an error!
MATLAB isn't reporting an error, only that a solution does not exist.
It can be verified that the dual of your problem is infeasible, as the message reports. This means that your original problem has no solution. The constraints of the dual problem are,
A.'*y=-c,
y>=0
The 8th constraint in the above is y(6)+y(16)=0. Because y>=0, this means that both y(6)=0 and y(16)=0. Since y(6)=0, the 9th constraint above reduces to y(2)=-150, which conflicts with y>=0.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by