the question is on linear programming problems

조회 수: 2 (최근 30일)
TYSON
TYSON 2024년 2월 17일
댓글: TED MOSBY 2024년 9월 2일
A farm manufacturers three products P1, P2 and P3 using two machines M1 and M2. The product yield a contribution of sh.3 sh.2 and sh.4 respectively. Machine M1 and M2 have 2000 and 2500 machine hours respectively. There is an agreement with trading association to manufacture at least 100 units of P1, 200 units of P2 and 50 units of P3 but not more than 150 units of P1. The table below shows the processing time in hours for each machine on each product.
products
machines P1 P2 P3
M1 4 3 5
M2 2 2 4
required:
i. The production plan that maximizes contribution
  댓글 수: 3
Torsten
Torsten 2024년 2월 17일
Where do you encounter difficulties ? Deriving objective function and constraints ? Or solving the problem ?
If it's the first: We won't help.
If it's the latter: Use MATLAB's "linprog".
Steven Lord
Steven Lord 2024년 2월 17일
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

댓글을 달려면 로그인하십시오.

답변 (1개)

TED MOSBY
TED MOSBY 2024년 8월 25일
편집: TED MOSBY 2024년 8월 25일
Hi @TYSON,
To get the optimal production plan, you can implement this using MATLAB’s function “linprog”.
Assuming you have the objective functions, inequality constraints and the lower and upper bounds. Here is an example code for the same:
% Coefficients for the objective function (negative for maximization)
f = [-3, -2, -4];
% Coefficients for the inequality constraints
A = [4, 3, 5; 2, 2, 4];
b = [2000; 2500];
% Coefficients for the lower and upper bounds
lb = [100, 200, 50];
ub = [150, Inf, Inf];
% Solve the linear programming problem
options = optimoptions('linprog', 'Display', 'off');
[x, fval] = linprog(f, A, b, [], [], lb, ub, options);
% Display the results
disp('Optimal Production Plan:');
fprintf('P1: %.2f units\n', x(1));
fprintf('P2: %.2f units\n', x(2));
fprintf('P3: %.2f units\n', x(3));
fprintf('Maximum Contribution: Sh. %.2f\n', -fval);
Here is the documentation for the "linprog" and the "optimoptions" functions:
Hope this helps!
  댓글 수: 7
Torsten
Torsten 2024년 9월 1일
편집: Torsten 2024년 9월 1일
max: 3*(x11+x12) + 2*(x21+x22) + 4*(x31+x32)
s.t.
4*x11 + 3*x21 + 5*x31 <= 2000
2*x12 + 2*x22 + 4*x32 <= 2500
x11 + x12 >= 100
x11 + x12 <= 150
x21 + x22 >= 200
x31 + x32 >= 50
x11 >= 0
x12 >= 0
x21 >= 0
x22 >= 0
x31 >= 0
x32 >= 0
TED MOSBY
TED MOSBY 2024년 9월 2일
Thanks @Torsten ill look into this and revise my answer

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Transaction Cost Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by