the question is on linear programming problems

3 views (last 30 days)
TYSON
TYSON on 17 Feb 2024
Commented: TED MOSBY on 2 Sep 2024
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 Comments
Torsten
Torsten on 17 Feb 2024
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 on 17 Feb 2024
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.

Sign in to comment.

Answers (1)

TED MOSBY
TED MOSBY on 25 Aug 2024
Edited: TED MOSBY on 25 Aug 2024
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 Comments
Torsten
Torsten on 1 Sep 2024
Edited: Torsten on 1 Sep 2024
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 on 2 Sep 2024
Thanks @Torsten ill look into this and revise my answer

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!