the question is on linear programming problems
Mostra commenti meno recenti
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 Commenti
TYSON
il 17 Feb 2024
Torsten
il 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
il 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.
Risposte (1)
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 Commenti
Your solution is wrong.
You must define x_ij as the number of units of product i manufactured on machine j. This gives a total of 2*3 = 6 unknowns.
x(i) in your code (i.e. the total number of units of product i) are not sufficient to implement the conditions about the different production times on the two machines.
@Torsten its not wrong.
The table of 6 unknowns is already provided in the question along with all the inequalities and coefficients i will need for the function.
Objective Function:
Maximize the total contribution: Z = 3x_1 + 2x_2 + 4x_3
Where:
- ( x_1 ) = units of P1
- ( x_2 ) = units of P2
- ( x_3 ) = units of P3
Constraints:
- Machine M1 hours: [ ax_1 + cx_2 + ex_3 <= 2000 ]
- Machine M2 hours: [ bx_1 + dx_2 + fx_3 <= 2500 ]
- Production constraints: [ 100 <= x_1 <= 150 ] [ x_2 >= 200 ] [ x_3 >= 50 ]
- Non-negativity: [ x_1, x_2, x_3 >= 0 ]
Constraint 1. must hold for the units produced on machine 1 (x11,x21 and x31) and Constraint 2. must hold for the units produced on machine 2 (x12,x22 and x32), respectively. You set both constraints on the total number of units produced. This is wrong.
As far as the information given by the question owner, you will need more information for that, but the answer isnt wrong, as both machines are individually producing the units, solving beyond what i did is not possible i believe so until then its fine. Thanks!
John D'Errico
il 1 Set 2024
Modificato: John D'Errico
il 1 Set 2024
@KALASH Please don't do student homework assignments when no effortwas made at all. This does not help the student, beyond convincing them that there is someone out there willing to do their work for them. That never helps the student.
Worse, it actively hurts the forum, in several ways. It convinces this student to continue posting homework assignments, expecting someone to post an answer to do their work for them.
And worse yet, it convinces other students to think Answers is a forum where they can get their work done for them.
It even hurts the teacher who assigned the homework, since now they need to choose a new problem for future classes.
The only good thing here, is your answer is over 6 months overdue, from when they demanded an answer within 2 days.
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
Categorie
Scopri di più su Solver Outputs and Iterative Display in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!