Linear programming in matlab
Upcoming SlideShare
Loading in...5

Linear programming in matlab






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Linear programming in matlab Linear programming in matlab Document Transcript

  • INTERNATIONAL JOURNAL Research and Development (IJIERD), ISSN 0976 –International Journal of Industrial Engineering OF INDUSTRIAL ENGINEERING6979(Print), ISSN 0976 – 6987(Online) Volume 4, Issue 1, January - April (2013), © IAEME RESEARCH AND DEVELOPMENT (IJIERD)ISSN 0976 – 6979 (Print)ISSN 0976 – 6987 (Online)Volume 4, Issue 1, January - April (2013), pp. 19-24 IJIERD© IAEME: Impact Factor (2013): 5.1283 (Calculated by GISI) © LINEAR PROGRAMMING IN MATLAB Flt Lt Dinesh Kumar Gupta Department of Mechanical Engg, Lovely Professional University, Phagwara (Punjab) IndiaABSTRACT Since the late 1940s, linear programming models have been used for many differentpurposes. Airline companies apply these models to optimise their use of planes and staff.NASA has been using them for many years to optimize their use of limited resources. Oilcompanies use them to optimise their refinery operations. Small and medium-sizedbusinesses use linear programming to solve a huge variety of problems, often involvingresource allocation.In this paper, a typical product-mix problem in a manufacturing system producing twoproducts (each product consists of two sub-assemblies) is solved for its optimal solutionthrough the use of the latest versions of MATLAB having the command simlp, which is verymuch like linprog. As analysts, we try to find a good enough solution for the decision makerto make a final decision. Our attempt is to give the mathematical description of the product-mix optimization problem and bring the problem into a form ready to call MATLAB’s simlpcommand. The objective of this paper is to find the best product mix that maximizes profit.The graph obtained using MATLAB commands, give the shaded area enclosed by theconstraints called the feasible region, which is the set of points satisfying all the constraints.To find the optimal solution we look at the lines of equal profit to find the corner of thefeasible region which yield the highest profit. This corner can be found out at the farthest lineof equal profit which still touches the feasible region.Keywords: Constraints, Decision variables, Duality, Feasible region, Optimization andOperating expenses1. INTRODUCTION One of the most widespread commercial applications of scientific computation islinear programming. It is widely used for allocating resources to achieve an objective. Here, 19
  • International Journal of Industrial Engineering Research and Development (IJIERD), ISSN 0976 –6979(Print), ISSN 0976 – 6987(Online) Volume 4, Issue 1, January - April (2013), © IAEMEin this paper the product-mix problem illustrated as a prototype example [1] refers to amanufacturing system which may occur in real life applications is being solved throughMATLAB. The figure 1 represents a manufacturing system producing two products labeled Pand Q. The rounded rectangles at the top of the figure indicate the revenue per unit and themaximum sales per week. For instance we can sell as many as 100 units of P for $90 per unit.The circles show the raw materials used, and the rectangles indicate the operations that theproducts must pass through in the manufacturing process. Each rectangle designates amachine used for the operation and the time required. For example product P consists of two subassemblies. RM stands for raw material .Tomanufacture the first subassembly, one unit of RM1 passes through machine A for 15minutes. The output of machine A is moved to machine C where it is processed for 10minutes. The second subassembly starts with RM2 processed in machine B for 15 minutes.The output is taken to machine C for 5 minutes of processing. The two subassemblies arejoined with a purchased part in machine D. The result is a finished unit of P. Product Q ismanufactured by a similar process as indicated in the figure1. P Q Fig 1 20
  • International Journal of Industrial Engineering Research and Development (IJIERD), ISSN 0976 –6979(Print), ISSN 0976 – 6987(Online) Volume 4, Issue 1, January - April (2013), © IAEME The rectangle at the upper left indicates that one machine of each type is available. Eachmachine operates for 2400 minutes per week. OE stands for operating expenses. For this case theoperating expenses, not including the raw material cost is $6000. This amount is expendedregardless of amounts of P and Q produced. Our problem is to find out the product mix thatmaximizes profit using MATLAB software.2. FORMULATION OF LINEAR PROGRAMMING MODELLet X= Number of P products produced per week Y= Number of Q products produced per week Max Z = 45X + 60Y (Weekly revenue) subject to 15X + 10Y ≤ 2400 (Machine A) 15X + 30Y ≤ 2400 (Machine B) 15X + 5Y ≤ 2400 (Machine C) 10X + 5Y ≤ 2400 (Machine D) X ≤ 100 (Product P) Y ≤ 50 (Product Q) X≥ 0,Y≥ 0 (Nonnegativity)3. SOLUTION USING MATLAB Since there are only two unknowns involved, we may graph all constraints. TheMATLAB commands [2] given are as follows:x=0:160 % range of graphy1=(2400-15.*x)./10; % 15x+10y ≤2400 machine Aarea(x,y1)y2=max((2400-15.*x)./30,0); % 15x+30y ≤2400 machineBy3=max((2400-15.*x)./5,0); % 15x+5y ≤2400 machineCy4=max((2400-10.*x)/5,0); % 10x+5y ≤ 2400 machine Dy5=max((100-1.*x)./0,0); % 1x+0y ≤ 100 market constraint P producty6=max((50-0.*x)./1,0); % 0x+1y ≤ 50 market constraint Q productytop=min([y1;y2;y3;y4;y5;y6]); % array of minimaarea(x,ytop); % filled area plotThe shaded area enclosed by the constraints is called the feasible region, which is the set of pointssatisfying all the constraints. If this region is empty, then the problem is said to be infeasible, andit has no solution. The lines of equal profit Z are given by Z = 45x + 60y. If we fix Z to, say 100,then all points (x; y) which satisfy 45x + 60y yield the same profit 100.hold on;[u v]=meshgrid(0:160,0:160);contour(u,v,45*u+60*v);hold off; To find the optimal solution, we look at the lines of equal profit to find the corner of thefeasible region which yields the highest profit. This corner can be found at the farthest line ofequal profit which still touches the feasible region as shown in Fig 2. 21
  • International Journal of Industrial Engineering Research and Development (IJIERD), ISSN 0976 –6979(Print), ISSN 0976 – 6987(Online) Volume 4, Issue 1, January - April (2013), © IAEME Fig 23.1 THE COMMAND simlp The command simlp from the optimization toolbox implements the simplex algorithmto solve a linear programming problem in the formmin f * x xsubject to A * x ≤ bwhere f is any vector and the matrix A and vector b define the linear constraints. So ouroriginal problem is translated into the formatmax 45x + 60y min – 45x – 60y x,y x,ysubject to subject to15x +10y ≤ 2400 15 10 240015x+ 30y ≤ 2400 15 30 240015x + 5y ≤ 2400 15 5 x 240010x + 5y ≤ 2400 10 5 ≤ 2400 x ≤ 100 1 0 y 100 y ≤ 50 0 1 50 x≥ 0 -1 0 0 y≥ 0 0 -1 0 22
  • International Journal of Industrial Engineering Research and Development (IJIERD), ISSN 0976 –6979(Print), ISSN 0976 – 6987(Online) Volume 4, Issue 1, January - April (2013), © IAEMEObserve the switching of signs to turn the max into a min and to deal with the ≤ constraints.Duality in linear programming is a very important concept, more than just a matter of formatting.The economical interpretation of duality can be simplified into the saying that minimizing thecost of production is equivalent to maximizing the profit.Now we are ready to solve the problem. First we set up the vectors and matrices:f=[-45 -60]A=[15 10; 15 30;15 5; 10 5; 1 0; 0 1; -1 0; 0 -1]b=[2400; 2400; 2400; 2400; 100; 50; 0; 0]The optimization toolbox has the command simlp :simlp(f,A,b) % optimize-f*ans % compute profitf= -45 -60A= 15 10 15 30 15 5 10 5 1 0 0 1 -1 0 0 -1b= 2400 2400 2400 2400 100 50 0 0ans = 100 30ans = 6300 23
  • International Journal of Industrial Engineering Research and Development (IJIERD), ISSN 0976 –6979(Print), ISSN 0976 – 6987(Online) Volume 4, Issue 1, January - April (2013), © IAEME4. CONCLUSION The objective of this research work in finding the maximum units of products forproduct mix problem is achieved. The final result as derived using MATLAB are as follows:The values obtained are X = 100 units and Y= 30 units which mean that for the product mixto optimize profits the manufacturer should produce 100 units of P products per week and 30units of Q products per week. The net profit would be equal to maximum revenue, Z minustotal operating expenses, OE which comes out to be $300 per week. The extensions of thisresearch work would be to identify bottlenecks and sensitivity analysis using FuzzyAlgorithm which allows us to determine how “sensitive” the optimal solution is to changesin data values. This includes analyzing changes in:i) An Objective Function Coefficient (OFC)ii) A Right Hand Side (RHS) value of a constraint.REFERENCES[1] Operations Research Models and Methods by Paul A Jensen[2] B.R Hunt, R.L Lipsman and J.M. Rosenberg. A Guide to MATLAB, for beginners andexperienced users, Cambridge University Press, 2001[3] Varun Shukla, Anand Handa and Arun Agarwal, “Spectrum Analysis by using MATLABScript” International journal of Electronics and Communication Engineering & Technology(IJECET), Volume 3, Issue 1, 2012, pp. 69 - 75, ISSN Print: 0976- 6464, ISSN Online: 0976–6472.[4] Gopichand Allaka, Prasad Raju Kalidindi, Koteswara Rao S, Manibabu Daadi and AbhayPatnala, “Design of Solid Shafts using MATLAB” International Journal of MechanicalEngineering & Technology (IJMET), Volume 3, Issue 3, 2012, pp. 645 - 653, ISSN Print:0976 – 6340, ISSN Online: 0976 – 6359. 24