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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by