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=7,2*x1 + 3,42*x2 (max)
Limits : x1+x2<=-1 -x1+x2<=0 3x1+x2<=5 x1>=0 x2>=0
My code in MatLab : z=[7.2; 3.42] ; A=[1 1;-1 1;3 1] ; b=[-1;0;5];
[x, fval, exitflag, output]=linprog(-z,A,b)
I think, everythink is true but software say to me there was an error! Solution is negative.
Please someone help me for this subject...

回答 (1 件)

Torsten
Torsten 2016 年 5 月 19 日

0 投票

You forgot to include the two positivity conditions on x1 and x2: x1,x2 >= 0.
Best wishes
Torsten.

3 件のコメント

huseyin yildiz
huseyin yildiz 2016 年 5 月 19 日
編集済み: huseyin yildiz 2016 年 5 月 20 日
Thanks for your answer @Torsten.
I try your suggestion but i see another error message:
Exiting: One or more of the residuals, duality gap, or total relative error has grown 100000 times greater than its minimum value so far: the primal appears to be infeasible and the dual unbounded since the dual objective > 1e+10 and the primal objective > -1e+6.
Torsten
Torsten 2016 年 5 月 19 日
Yes, this message is correct. There is no point (x1,x2) that satisfies all of your constraints. Thus the set of feasible points is empty.
Best wishes
Torsten.
huseyin yildiz
huseyin yildiz 2016 年 5 月 19 日
You are right! There is no point for my contraints.
Thanks for everythink.

サインインしてコメントする。

質問済み:

2016 年 5 月 18 日

編集済み:

2016 年 5 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by