Quiz I am trying to convert a statement into equation
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Joshua Amuga
el 26 de Oct. de 2016
Comentada: Joshua Amuga
el 1 de Nov. de 2016
I have a question. How can create a program that can perform a task for accurate decision making. For example, I need to take a decision based on some constrains is have in a business. this are the facts. I have 75 machines that can produce two products say B=Bucket, and K=Kettle, The cost expense for electricity and materials for the production of 30 cartoons of Bucket is N210 and the profit per cartoon is N2.00 while for the kettle the cost /material expenses is N120 and the profit per cartoon is N1.30. How you are restricted by two factors N15,000 for expenses and 4000 storage capacity for the warehouse, So how can you utilize effectively the 75 machines
0 comentarios
Respuesta aceptada
Stefano Gianoli
el 27 de Oct. de 2016
Following the guideline contained in
you can easily solve the problem as follow:
First you need to define an objective or cost function. This function must describe a minimization problem.
Let's assume you want to maximize the profit or minimize it negate as a function of the number of Bucket x(1) and Kettle x(2).
Your cost function then is:
f'*x := f(1) * x(1) + f(2) * x(2)
hence
>> f = [-2; -1.3];
let's define the inequality constraints for the production costs
7 * x(1) + 4 * x(2) <= 15000
and for the size of the warehouse:
x(1) + x(2) <= 4000
in matrix form
>> A = [7 4; 1 1];
>> b = [15000; 4000];
also x(1) and x(2) can assume value in the range 0 <= x <= 4000, therefore the lower bound and upper bound constrains are
>> lb = [0 0];
>> ub = [4000 4000];
you don't have any equality constrains therefore
>> Aeq = [];
>> beq = [];
Now you are ready to call the LP solver:
>> options = optimoptions('linprog','Algorithm','dual-simplex');
>> [x,fval,exitflag,output] = linprog(f,A,b,Aeq,beq,lb,ub,options);
the optimal solution should be
>> x
x =
0
3750
so the maximum profit within the given cost is given by producing 3750 Kettle only. You still have 250 storage capacity available in the warehouse, so this constraint wasn't hit.
The fact that we have 75 machines to utilize effectively is irrelevant for the above solution. Perhaps additional information such the production type: continuous or batch, time scheduled for producing B or K, etc. would make this additional information necessary/useful.
Más respuestas (1)
Shlomo
el 26 de Oct. de 2016
It's a unit commitment problem (and there's much literature on it). It's an integer programming problem and Matlab has a solver for this class of problems https://www.mathworks.com/help/optim/ug/intlinprog.html.
Basically you define a cost function that includes the profit from selling your items and the cost of electricity, etc. Then you feed in your constraints (max costs, storage capacity and machine capacity) and the solver will give you an optimal solution (to within some tolerance).
If you are looking to solve large-scale problems I would recommend you look into dedicated Mixed Integer Programming (MIP) solvers.
Ver también
Categorías
Más información sobre Linear Programming and Mixed-Integer Linear Programming en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!