Maximize linear programming using linprog

12 ビュー (過去 30 日間)
Swera Vapoil
Swera Vapoil 2017 年 4 月 10 日
コメント済み: Stanislav Kubis 2022 年 3 月 5 日
I have to maximize the function given below: f(x,y) = 150x+175y; subject to
7x + 11y<=77;
10x + 8y<=80;
x>=9;
y<=6;
x>=0;
y>=0;
I tried to find out the value using linprog() function, but i am getting some absurd values:
[X,val]=linprog([-150 -175],[7 11;10 8;1 0;0 1],[77;80;9;6],[],[],[0 0]);
X =
4.8889
3.8889
val =
-1.4139e+03
Where did i go wrong? Any help would be really appreciated.

採用された回答

Torsten
Torsten 2017 年 4 月 11 日
[X,val]=linprog([-150 -175],[7 11;10 8;-1 0;0 1],[77;80;-9;6],[],[],[0 0],[Inf Inf]);
Best wishes
Torsten.
  1 件のコメント
Stanislav Kubis
Stanislav Kubis 2022 年 3 月 5 日
Great comment! I would only add that the minus is for the equations as the function is trying to maximize but the contraints are still having the wrong sign.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by