Answer to Question #237088 in Linear Algebra for lavanya

Question #237088

Use simplex method to maximize 𝑓 = 4π‘₯ + 5𝑦 subject to the conditions π‘₯ + 2𝑦 ≀ 5 π‘₯ βˆ’ 2𝑦 ≀ 2 βˆ’π‘₯ + 𝑦 ≀ 2 2π‘₯ + 𝑦 ≀ 6 and π‘₯, 𝑦 β‰₯ 0.


1
Expert's answer
2021-09-16T00:46:31-0400
close all,
clear all,
clc,

disp('Use simplex method to maximize f = 4x + 5y subject to the conditions ');
disp('x+2y <= 5');
disp('x-2y <= 2');
disp('-x+y <= 2');
disp('2x+y <= 6');
disp('x,y >= 0');
disp(' ');




f = [-4; -5];
A =Β  [1, 2;
Β  Β  Β  1, -2;
Β  Β  Β  -1, 1;
Β  Β  Β  2, 1];
b = [5; 2; 2; 6];

lb=zeros(2,1);
ub=[1e4;1e4];
Aeq=[];
beq=[];
x0=[];
[x,fval,exitflag,output] = linprog(f,A,b,Aeq,beq,lb,ub,x0);
disp(['x = ',num2str(x(1)),'32,',', y = ',num2str(x(2))]);
disp(['Max f = ',num2str(fval)]);




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS