Zuraidah Derasit –FSKM- CHAPTER 3 LINEAR PROGRAMMING What is Linear Programming (LP) • The main issue of many managers and decision makers of company are to find the optimal solution to a problem that requires decision about how best to use a set of limited resources to achieve a state goal of objective. • Objectives of the business decision frequently involve maximizing profit or minimizing costs. • Resources typically include labor, money, time and raw materials. • LP is a technique to help managers in planning and decision making relative to resource allocation. • LP is a model consisting of linear relationships representing a firm’s decisions given an objective and resource constraints. Requirements of a LP Problem 1) One objective function - maximize or minimize objective • The major objective of a typical manufacturer is to maximize profit. • The major objective of trucking or railroad distribution system might be to minimize shipping costs. 2) One or more constraints • For example , deciding how many units of each product to product is restricted by available personnel and machinery. 3) Alternative courses of action • For example, if a company produce 3 different products, management may use LP to decide how to allocate among them its limited production resources. 4) Objective function and constraints are linear. • Linear just mean that all terms used in the objective function and constraints are of the first degree. 30 Zuraidah Derasit –FSKM- LP Model Components • Decision variables: mathematical symbols representing levels of activity of a firm. • Objective function: a linear mathematical relationship describing an objective of the firm, in terms of decision variables, that is maximized or minimized • Constraints: restrictions placed on the firm by the operating environment stated in linear relationships of the decision variables. • Parameters: numerical coefficients and constants used in the objective function and constraint equations. In QMT 425, you will learn: How to formulate the LP Model (Maximization & Minization Model) Solve the LP Model (Maximization & Minization Model) 31 Zuraidah Derasit –FSKM- Steps in Formulating The LP Model 1. Identify the objective and the constraints. 2. Clearly define the decision variables. 3. Construct the objective function. 4. Formulate the constraints. Example 3.1 (Maximization Model) The Beaver Creek Pottery Company is a small crafts company. The company employs skilled artisans to produce clay bowls and mugs. The two primary resources used by the company are special pottery clay and skilled labor. Given these limited resources the company desires to know how many bowls and mugs to produce each day in order to maximize profit. The two products have the following resource requirements for production and profit per item produced. Product Labor (hr/ unit) Resource Requirements Clay (lb/ unit) Profit (RM/ unit) Bowl Mug 1 2 4 3 40 50 There are 40 hours of labor and 120 pounds of clay available each day for production. Product Labor (hr/ unit) Resource Requirements Clay (lb/ unit) Bowl Mug Available 1 2 40 4 3 120 Profit (RM/ unit) 40 50 Decision Variables: x1= number of bowls to produce/day x2= number of mugs to produce/day 32 Zuraidah Derasit –FSKM- Objective function Maximize Z = 40x1 + 50x2 where Z= profit per day Resource Constraints: x1 + 2x2 40 hours of labor 4x1 + 3x2 120 pounds of clay Non-negativity Constraints: x1 0; x2 0 Therefore, Complete Linear Programming Model x1= number of bowls to produce/day x2= number of mugs to produce/day Maximize Z = 40x1 + 50x2 subject to x1 + 2x2 40 4x1 + 3x2 120 x1 , x2 0 Example 3.2 (Minimization Model) A farmer is preparing to plant a crop and needs to fertilize a field. There are two brands of fertilizer to choose from. Super-gro and Crop-quick. Each brand yields a specific amount of nitrogen and phosphate, as follows: Brand Super-gro Crop-quick Chemical contribution Nitrogen Phosphate (lb/ bag) (lb/ bag) 2 4 4 3 The farmer’s requires at least 16 pounds of nitrogen and 24 pounds of phosphate. Super-gro costs RM6 per bag and Crop-quick costs RM3. The farmer wants to know how many bags of each brand to purchase in order to minimize the total cost of fertilizing. 33 Zuraidah Derasit –FSKM- Brand Super-gro Crop-quick Requires at least Chemical contribution Nitrogen Phosphate (lb/ bag) (lb/ bag) 2 4 4 3 16 24 Cost (RM/ bag) 6 3 Decision variables x1 = number bags of Super-gro x2 = number bags of Crop-quick Objective function Minimize Z = 6x1 + 3x2 where 6x1 = cost of bags of Super-gro 3x2 = cost of bags of Crop-quick Model constraints 2x1 + 4x2 16 lb (nitrogen constraint) 4x1 + 3x2 24 lb (phosphate constraint) x1, x2 0 (non-negativity constraint) Therefore, Complete Linear Programming Model x1= number bags of Super-gro x2= number bags of Crop-quick Minimize Z = 6x1 + 3x2 subject to 2x1 + 4x2 16 4x1 + 3x2 24 x1, x2 0 34 Zuraidah Derasit –FSKM- Exercise 3.1 The Flair Furniture Company produces inexpensive tables and chairs. Each table takes 4 hours of carpentry and 2 hours in the painting and varnishing shop. Each chair requires 3 hours in carpentry and 1 hour in painting and varnishing. During the current production period, 240 hours of carpentry time are available and 100 hours in painting and varnishing time are available. Each table sold yields a profit of RM7, each chair produced is sold for a RM5 profit. Formulate LP model to determine the best possible combination of tables and chairs to manufacture in order to reach the maximum profit. Exercise 3.2 The Kalo Fertilizer Company makes a fertilizer using two chemicals that provide nitrogen, phosphate and potassium. A pound of ingredient 1 contributes 10 ounces of nitrogen and 6 ounces of phosphate, while a pound of ingredient 2 contributes 2 ounces of nitrogen, 6 ounces of phosphate and 1 ounce of potassium. Ingredient 1 costs RM3 per pound and ingredient 2 costs RM5 per pound. The company wants to know how many pounds of each chemical ingredient to put into a bag of fertilizer to meet minimum requirements of 20 ounces of nitrogen, 36 ounces of phosphate and 2 ounces of potassium. Formulate LP model in order to minimize cost. 35 Zuraidah Derasit –FSKM- Problems 3.1 A manufacturer has two versions of a toy house. The version X requires 23 sq cm of plywood, 2 pounds of plastic and 15 minutes of assembling. The version Y requires 31 sq cm of plywood, 3 pounds of plastic and 25 minutes of assembling. There are 9000 sq cm of plywood, 100 pounds of plastic and 42 hours of assembling time available. Each unit of version X results in RM4 of profit and for version Y the unit profit is RM5. The manufacturer will not produce more than 25 units of version Y and there must be a minimum of 5 units of each version produced to cater for previous orders. Formulate (do not solve) a linear programming model with the objective of maximizing profit. 3.2 A farmer wants to determine the number of acres of land to be planted with bananas and starfruits. He has 80 acres of land and has allocated a capital of RM10,000 to develop the land. The expenditures needed to plant the bananas and starfruits per acre are RM100 and RM150 respectively. The average yields per acre are 500 kg of bananas and 300kg of starfruits. The fruits are kept in the backyard store before they are sold. The store can only hold 6,000 kg of fruits at one time. The net profit of each kg of bananas and starfruits are RM0.60 and RM0.90 respectively. Formulate the above problem as a linear programming model to maximize the net profit. 3.3 Rahman the successful farmer has a 50 acres farm on which to plant tomatoes and cucumbers. He has 300 hours of labor per week and 800 tons of fertilizer available and has contracted for shipping space for a maximum of 26 acres worth of tomatoes and 37 acres worth of cucumbers. An acre of tomatoes requires 10 hours of labor and 8 tons of fertilizer, whereas an acre of cucumbers requires 3 hours of labor and 20 tons of fertilizer. The profit from an acre of tomatoes is RM400 and the profit from an acre of cucumbers is RM300. Formulate the linear programming model for this problem to maximize profit. 3.4 A marketing company is doing research in order to maximize their profit of selling products X, Y and Z. These products will be sold from door to door. X is sold at RM7 per unit. It takes a salesperson 10 minutes to sell one unit of X and it costs RM1 to deliver the goods to the customer. Y is sold at RM5 each. It takes a salesperson 15 minutes to sell one unit of Y. The goods are left with the customer at the time of sale. Z is sold at RM12 each. It takes a salesperson 12 minutes to sell one unit of Z and it costs RM0.80 to deliver the goods. During any week, a salesperson is only allowed delivery expenses of not more than RM75 and selling time is expected not to exceed 30 hours. If the unit costs of X, Y and Z are respectively RM2.20, RM 1.80 and RM4.25, how many units of X, Y and Z must be sold to maximize the total sales? Formulate the problem as a linear programming model (Do not solve the problem). 36 Zuraidah Derasit –FSKM- 3.5 The Mighty Silver Ball Company manufactures three kinds of pinball machines, each requiring a different manufacturing technique. Each Super Deluxe Machine (SDM) requires 17 hours of labor, 8 hours of testing and yields a profit of RM300. Each Silver Ball Special (SBS) requires 10 hours of labor, 4 hours of testing and yields a profit of RM200. Each Bumper King (BK) requires 2 hours of labor, 2 hours of testing and yields a profit of RM100. There are 1,000 hours of labor and 500 hours of testing time available. The company wants to produce at least 200 pinball machines. In addition, a marketing forecast has shown that the demand for the Super Deluxe is no more than 50 machines, demand for the Silver Ball Special is no more than 80 and demand for the Bumper King is no more than 150. The manufacturer wants to determine the optimal production schedule that will maximize his total profit. Formulate this as a linear programming problem. 3.6 The dean from one of the private university in Selangor must plan the school’s course offerings for the first semester next year. Student demands make it necessary to offer at least 30 undergraduate and 20 postgraduate courses in the term. Faculty contracts also dictate that at least 60 courses be offered in total. Each undergraduate course taught costs the college an average of RM2500 in faculty wages, and each postgraduate course costs RM3000. The dean wants to make sure so that total faculty salaries are kept to a minimum. Formulate the linear programming model for the above problem. 3.7 C-Bizz Mart is a retail catalog store specializing in cosmetics. Phone orders are taken each day by a large pool of computer operators, some of whom are permanent and some temporary. A permanent operator can process an average of 75 orders per day, whereas temporary operator can process an average of 52 orders per day. The company receives an average of at least 600 orders per day. The store has 10 computer workstations. A permanent operator will process about 1.3 orders with errors each day, whereas a temporary operator will average 4.2 orders with errors daily. The store wants to limit errors to 24 per day. A permanent operator is paid RM60 per day including benefits and temporary operator is paid RM40 per day. The company wants to know the number of permanent and temporary operators to hire to minimize costs. Formulate a linear programming model for C-Bizz Mart problem. 3.8 Maxi Designs Sdn. Bhd. has been awarded a contract to design a label for a new computer produced by KC Computer Company. Maxi Designs estimates that at least 160 hours will be required to complete the project. Three of the firm's graphic designers are available for assignment to this project: Aida, a senior designer and team leader; Bakri, a senior designer; and Carol, a junior designer. Since Aida has worked on several projects for KC, management has specified that Aida must be assigned at least 45% of the total number of hours that are assigned to the two senior designers. To provide label-designing experience for Carol, Carol must be assigned at least 20% of the total project time. However, the number of hours assigned to Carol must not exceed 25% of the total number of hours that are assigned to the two senior designers. Due to other project commitments, Aida has a maximum of 50 hours available to work on this project. Hourly wage rates are RM40 for Aida, RM30 for Bakri and RM20 for Carol. Formulate a linear programming model to determine the number of hours each graphic designer should be assigned to the project in order to minimize total cost of wages. 37 Zuraidah Derasit –FSKM- Solve The LP Model 1) 2) 1) Graphical Method Simplex Method Graphical Method • Graphical solution is limited to LP problems with only two decision variables. • Graphical methods provide visualization of how a solution for a linear programming problem is obtained. Steps in Graphical Method 1. Plot constraints on the graph. Convert inequality into equation. 2. Shade the feasible solution area. The feasible region is the overlapping area of problem’s constraints. The shaded region represents the area of solution. 3. Find the optimal solution to the problem. There are 2 approaches that can be taken either: i) Isoprofit/ Isocost line solution method or ii) Corner point solution method Example 3.3 (Maximization model) From example 3.1, how many bowls (x1) and mugs (x2) to produce daily, given limited amounts of labor and clay. Maximize Z = 40x1 + 50x2 subject to x1 + 2x2 40 4x1 + 3x2 120 x1 , x2 0 38 Zuraidah Derasit –FSKM- Solution Step 1: Plot the constraints on the graph. x1 + 2x2 = 40 x1 = 0, x2 = 20 x2 = 0 , x1 = 40 4x1 + 3x2 = 120 x1 = 0, x2 = 40 x2 = 0 , x1 = 30 Step 2 : Shaded the feasible region Shade the feasible solution area (area on the graph bounded by the constraint equation). 39 Zuraidah Derasit –FSKM- Step 3: Find the optimal solution : Use Isoprofit solution method or corner point solution method. i) Isoprofit solution method Let Z = 800 800 = 40x1 + 50x2 x1 = 0, x2 = 16 x2 = 0 , x1 = 20 Optimal solution: x1 = 24 x2 = 8 Z = 40 (24) + 50 (8) = RM1360 (highest profit) Conclusion : The company should produce 24 units of bowls and 8 units of mugs to maximize the profit. The maximum profit is RM1360. 40 Zuraidah Derasit –FSKM- ii) Corner point solution method A B C D Find the coordinates of each corner point Point A (x1 = 0, x2 = 20) Point C (x1 = 30, x2 = 0) Point D (x1 = 0, x2 = 0) Apply the simultaneous equations method to solve the corner point B, we obtain : Point B (x1 = 24, x2 = 8) Test the profit level at each corner point : Pick the highest profit Corner Point A (0,20) B (24,8) C (30,0) D (0,0) Z = 40x1 + 50x2 Z = 40(0) + 50(20) = 1000 Z = 40(24) + 50(8) = 1360 * Z = 40(30) + 50(0) = 1200 Z = 40(0) + 50(0) = 0 Optimal solution x1 = 24 x2 = 8 Z = RM1360 (highest profit) Conclusion : The company should produce 24 units of bowls and 8 units of mugs to maximize the profit. The maximum profit is RM1360. 41 Zuraidah Derasit –FSKM- Example 3.4 (Minimization model) From example 3.2, how many bags of Super-gro (x1) and Crop-quick (x2) to purchase in order to minimize the total cost of fertilizing. Minimize Z = 6x1 + 3x2 subject to 2x1 + 4x2 16 4x1 + 3x2 24 x1, x2 0 Solution Step 1: Plot the constraints on the graph. 2x1 + 4x2 = 16 x1 = 0, x2 = 4 x2 = 0 , x1 = 8 4x1 + 3x2 = 24 x1 = 0, x2 = 8 x2 = 0 , x1 = 6 Step 2 : Shaded the feasible region Shade the feasible solution area (area on the graph bounded by the constraint equation). 42 Zuraidah Derasit –FSKM- Step 3: Find the optimal solution : Use Isocost solution method or corner point solution method. i) Isocost solution method Let Z = 18 18 = 6x1 + 3x2 x1 = 0, x2 = 6 x2 = 0 , x1 = 3 Optimal solution x1 = 0 x2 = 8 Z = 6(0) + 3(8) = RM24 (lowest cost) Conclusion : The company should not purchase Super –pro and purchase 8 bags of Crop-quick to minimize the total cost. The minimum total cost should be RM24. 43 Zuraidah Derasit –FSKM- ii) Corner point solution method A B C Find the coordinates of each corner point Point A (x1 = 0, x2 = 8) Point C (x1 = 8, x2 = 0) Apply the simultaneous equations method to solve the corner point B, we obtain : Point B (x1 = 4.8, x2 = 1.6) Test the cost level at each corner point : Pick the lowest cost Corner Point A (0,8) B (4.8,1.6) C (8,0) Z = 6x1 + 3x2 Z = 6(0) + 3(8) = 24* Z = 6(4.8) + 3(1.6) = 33.6 Z = 6(8) + 3(0) = 48 Optimal solution x1 = 0 x2 = 8 Z = RM24 Conclusion : The company should not purchase Super –pro and purchase 8 bags of Crop-quick to minimize the total cost. The minimum total cost should be RM24. 44 Zuraidah Derasit –FSKM- Exercise 3.3 Solve the following linear programming problem using the graphical method. Maximize Profit 3x + 5y subject to 4x + 3y 48 x + 2y 20 x, y 0 Exercise 3.4 Use the graphical method to solve the following linear programming model. Minimize Cost 8x + 6y subject to 3x + 2y x + y y x, y 18 5 6 0 45 Zuraidah Derasit –FSKM- Problems Solve the following linear programming problems using the graphical method. 3.9 Maximize Z = 3x + 6y subject to 3x + 2y x+ y x x, y 18 5 ≤4 0 3.11 Maximize Z = 4x1 + 4x2 subject to 3x1 + 5x2 150 x1 - 2x2 ≤10 5x1 + 3x2 ≤150 x1, x2 0 3.13 Minimize Z = x +y subject to x + 2y 7 2x + y 5 x + 6y 11 x, y 0 3.10 Maximize Z = x1 + 5x2 subject to 5x1 + 5x2 25 2x1 + 4x2 ≤16 x1 ≤5 x1, x2 0 3.12 Maximize Z = 2x1 + 3x2 subject to x1 + 2x2 ≥ 160 2x1 + x2 ≤ 200 4x2 ≤ 200 x1, x2 0 3.14 Minimize Z = 10x1 + 20x2 subject to 6x1 + 2x2 ≥ 36 2x1 + 4x2 ≥ 32 x2 ≤ 20 x1, x2 0 3.15 Minimize Z = X + 2Y subject to 2X + 3Y = 600 Y ≥ 2X X ≤ 150 X, Y ≥0 46 Zuraidah Derasit –FSKMStandard Form LP Model (To handle constraint) Slack Variables In graphical solution, the model constraints are considered as equations (=), rather than or inequalities. There is a standard procedure for transforming inequality constraints into equations. The complete LP model with slack variables referred as standard form LP model. Slack variables A slack variable is added to a constraint to convert it to an equation (=). Slack variable represents the amount of unused resources. Slack variable contribute nothing to the objective function value. Example 3.5 (Maximization model) From example 3.1, Maximize Z = 40x1 + 50x2 subject to x1 + 2x2 40 (labor) 4x1 + 3x2 120 (clay) x1 , x2 0 Convert to standard form of LP model Maximize Z = 40x1 + 50x2 + 0s1 + 0s2 subject to x1 + 2x2 + s1 = 40 (labor) 4x1 + 3x2 + s2 = 120 (clay) x1 , x2 , s1 , s2 0 Consider a hypothetical solution x1 = 5, x2 = 10. Substituting these values into the equation yields. Profit: Z = 40(5) + 50(10) = 700 Constraint (labor): (5) + 2(10) + s1 = 40, then s1 = 15 Constraint (clay): 4(5) + 3(10) + s2 = 120, then s2 = 70 In this example, x1 = 5 bowls, x2 = 10 mugs. s1 = 15 hours represents the amount of unused labor s2 = 70 lb represents the amount of unused clay 47 Zuraidah Derasit –FSKM- 2) Simplex Method Setting up the first simplex tableau 1. Write the problem in standard form. Consider the maximization problem: Maximize Z = 40x1 + 50x2 subject to x1 + 2x2 40 4x1 + 3x2 120 x1 , x2 0 In standard form, the problem written as: Maximize Z = 40x1 + 50x2 + 0s1 + 0s2 subject to x1 + 2x2 + s1 = 40 4x1 + 3x2 + s2 = 120 x1 , x2 , s1 , s2 0 2. Basic feasible solution. All real variables are set equal to zero: x1 = 0 , x2 = 0 First simplex tableau: Cj 0 0 Solution mix s1 s2 Zj Cj-Zj 40 x1 1 4 0 40 50 x2 2 3 0 50 0 s1 1 0 0 0 0 s2 0 1 0 0 Quantity 40 120 0 Calculations for the values of Zj are as follows: Z (for column x1) = 0(1) + 0(4) = 0 Z (for column x2) = 0(2) + 0(3) = 0 Z (for column s1) = 0(1) + 0(0) = 0 Z (for column x1) = 0(0) + 0(1) = 0 Cj Zj Cj-Zj 40 0 40 50 0 50 0 0 0 0 0 0 48 Zuraidah Derasit –FSKM- Explanation about the values/variables inside the simplex tableau Variables in solution mix are referred as basic variables, in this example are s1 and s2. Variables not in the solution mix are called non-basic variables (x1 and x2). Cj : Profit contribution per unit of each variable. Zj : In the quantity column, provides total contribution. The basic feasible solution: x1 = 0 x2 = 0 s1 = 40 s2 = 120 Zj = 0 49 Zuraidah Derasit –FSKM- Simplex solution procedure (After setting up the first simplex tableau) 1. Determine which variable to enter into the next solution mix. Identify the column with the largest positive number in the Cj-Zj row. The column identified is called the pivot column. 2. Determine which variable to replace. Divide each amount in the quantity column with amount in pivot column. The row with the smallest nonnegative number will be replaced in the next tableau. This row referred as pivot row. 3. Compute new values for the pivot row. Divide every number in the row by pivot number. 4. Compute new values for each remaining row. All remaining rows are calculated as follows: New row number = Old row number - Its pivot column coefficient number New pivot row number x 5. Compute the Zj and Cj-Zj rows. If all numbers in the Cj-Zj row are zero or negative, we have found the optimal solution. Procedure 1 : Determine which variable to enter. Iteration 1 Cj 0 0 Basic variables s1 s2 Zj Cj-Zj x1 40 1 4 0 40 x2 50 2 3 0 50 s1 0 1 0 0 0 s2 0 0 1 0 0 Quantity s1 0 1 0 0 0 s2 0 0 1 0 0 Quantity 40 120 0 Procedure 2 : Determine which variable to replace. Cj 0 0 Basic variables s1 s2 Zj Cj-Zj x1 40 1 4 0 40 x2 50 2 3 0 50 40/2=20 120/3=40 0 Identify the pivot number (Pivot number = the number at the intersection of the pivot row and pivot column) = 2 The variable to enter is X2 The variable to remove is s1 50 Zuraidah Derasit –FSKM- Procedure 3 : Compute new values for the pivot row. Iteration 2 Cj 50 0 Basic variables x2 s2 Zj Cj-Zj x1 40 1/2 4 0 40 x2 50 1 3 0 50 s1 0 1/2 0 0 0 s2 0 0 1 0 0 Quantity x2 50 1 0 0 50 s1 0 1/2 -3/2 0 0 s2 0 0 1 0 0 Quantity x2 50 1 0 50 0 s1 0 1/2 -3/2 25 -25 s2 0 0 1 0 0 Quantity 40/20 120 0 Procedure 4 : Compute new values for each remaining row. Cj 50 0 Basic variables x2 s2 Zj Cj-Zj x1 40 1/2 5/2 0 40 20 60 0 Procedure 5 : Compute the Zj and Cj-Zj rows Cj 50 0 Basic variables x2 s2 Zj Cj-Zj x1 40 1/2 5/2 25 15 20 60 1000 * Since not all number in Cj-Zj row are 0 or negative, the second simplex tableau is not optimal, and we must repeat the five simplex step. 51 Zuraidah Derasit –FSKM- The result after repeat all five steps: Iteration 3 Cj 50 40 Basic variables x2 x1 Zj Cj-Zj x1 40 0 1 40 0 x2 50 1 0 50 0 s1 0 4/5 -3/5 16 -16 s2 0 -1/5 2/5 6 -6 Quantity 8 24 1360 Therefore, the optimal solution: x1 = 24 bowls x2 = 8 mugs s1 = 0 (unused labor) s2 = 0 (unused clay) Zj = RM1360 52 Zuraidah Derasit –FSKM- Exercise 3.5 Solve the following LP model using simplex method. Maximize Z = 4x1 + 5x2 subject to 2x1 + 2x2 20 3x1 + 7x2 42 x1 , x2 0 3.6 Write down the standard form and construct the initial simplex tableau for the following linear programming problem: Maximize Z = 3x1 + 2x2 + x3 subject to x1 + 2x2 + 2x3 30 2x1 + 3x2 + x3 50 x1 - 2x2 0 x1 , x2 , x3 0 3.7 Consider a linear programming model; Maximize Z = x1 + 3/2x2 + 2x3 subject to 2x1 + x2 + 2x3 30 x1 + 3x2 + 2x3 45 x1 , x2 , x3 0 The second simplex tableau for the above problem is given below: Cj Basis x1 x2 x3 s1 3/2 2 0 1 2 x3 1 ½ 1 ½ 0 s2 -1 2 0 -1 Zj 2 1 2 1 Cj-Zj -1 1/2 0 -1 s2 0 0 1 0 0 RHS 15 15 30 Is the solution optimal? Explain. If not, obtain the optimal solution. 53 Zuraidah Derasit –FSKMStandard Form LP Model (To handle , and = constraints) Slack Variables A slack variable is added to a constraint to convert it to an equation (=). Surplus Variables A surplus variable is subtracted from a constraint to convert it to an equation (=). Surplus variable represents an excess above a constraint requirement level. Surplus variable contribute nothing to the objective function value. Artificial Variables An artificial variable is a variable that has no physical meaning in terms of a real world LP problem. It simply allows us to create a basic feasible solution to start the simplex algorithm. An artificial variable is not allowed to appear in the final solution to the problem. Whenever an artificial or surplus variable is added to one of the constraints, it must also be included in the other equations and in the objective function, just as what we have done for slack variables. Each artificial variable is assigned an extremely high cost to ensure it does not appear in the final solution. Standard form of LP model To handle constraint, slack variable is added. To handle constraint, surplus variable is subtracted and then artificial variable is added. To convert an equality (=), we add an artificial variable to the equation. In the objective function, surplus and artificial variable must be included , just as we done for slack variable and Maximization model put -MA to represent the artificial variable Minimization model put +MA to represent the artificial variable 54 Zuraidah Derasit –FSKM- Convert the following LP model into standard form by adding appropriate slack variable(s) surplus variable(s) and artificial variable(s) to be used in the initial simplex tableau. Example 3.6 Maximize Z = x1 + 2x2 + 2x3 subject to x1 + x2 + 2x3 12 2x1 + x2 + 5x3 = 20 x1 + x2 - x3 8 x1, x2, x3 0 Maximize Z = x1 + 2x2 + 2x3 + 0s1 + 0s2 - MA1 - MA2 subject to x1 + x2 + 2x3 + s1 = 12 2x1 + x2 + 5x3 + A1 = 20 x1 + x2 - x3 - s2 + A2 = 8 x1 , x2 , x3, s1 , s2 , A1 , A2 0 Example 3.7 Minimize Z = 6x1 + 3x2 subject to 2x1 + 4x2 16 4x1 + 3x2 = 24 x1, x2 0 Minimize Z = 6x1 + 3x2 + 0s1 + MA1 + MA2 subject to 2x1 + 4x2 - s1 + A1 = 16 4x1 + 3x2 + A2 = 24 x1 , x2 , s1 , A1 , A2 0 Exercise Convert the following LP models to standard form. 3.8 3.9 Maximize Z = 30x1 + 40x2 + 35x3 subject to 3x1 + 4x2 + 2x3 90 2x1 + x2 + x3 ≤ 54 x1 + 3x2 + 2x3 = 93 x1, x2, x3 0 Minimize Z = 84x1 + 4x2 + 30x3 subject to 8x1 + x2 + 3x3 240 16x1 + x2 + 7x3 ≥ 480 8x1 - x2 + 4x3 ≥ 160 x1, x2, x3 0 55 Zuraidah Derasit –FSKM- 2) Simplex Method (Slack Variable, Surplus Variable and Artificial Variable) Solve this LP model using simplex method Maximize Z = 4x1 + 3x2 Subject to 2x1 + 2x2 ≤ 20 x1 + x2 ≥ 2 x1 , x2 ≥ 0 Standard form of LP model: Maximize Z = 4x1 + 3x2 + 0S1 + 0S2 – MA1 Subject to 2x1 + 2x2 + s1 = 20 x1 + x2 - s2 + A1 = 2 x1 , x2 , s1 , s2 , A1 ≥ 0 Solution: Iteration 1 Cj 0 -M Iteration 2 Cj 0 4 Iteration 3 Cj 0 4 Basic Var s1 A1 Zj Cj - Zj 4 x1 2 1 -M 4+M 3 x2 2 1 -M 3+M 0 s1 1 0 0 0 0 s2 0 -1 M -M -M A1 0 1 -M 0 Quantity 20 2 -2M Basic Var s1 x1 Zj Cj - Zj 4 x1 0 1 4 0 3 x2 0 1 4 -1 0 s1 1 0 0 0 0 s2 2 -1 -4 4 Quantity Basic Var s2 x1 Zj Cj - Zj 4 x1 0 1 4 0 3 x2 0 1 4 -1 0 s1 1/2 1/2 2 -2 0 s2 1 0 0 0 Quantity 16 2 8 8 10 40 Optimal solution: x1 = 10 x2 = 0 s1 = 0 s2 = 8 Z = 40 56 Zuraidah Derasit –FSKM- Special Cases in LP Four special cases that may occur in solving LP problems: 1. 2. 3. 4. An infeasible problem An unbounded problem Alternate optimal solutions Degeneracy 1. An Infeasible Problem – LP problem with no feasible solution. o Infeasibility is a condition that arises when there is no solution to a LP problem that satisfies all of the constraints given. Example 3.8 Maximize Z= 2x1 + 6x2 subject to 4x1 + 3x2 12 2x1 + x2 8 x1, x2 0 No feasible solution 57 Zuraidah Derasit –FSKM- o Simplex tableau : An infeasible problem is detected when an artificial variable still in the final solution mix. 2 Basic Var x1 x1 2 1 x2 6 3/4 s1 0 1/4 s2 0 0 -M A2 0 -1/2 -1/2 -1 2 Zj 2 3/2+1/2M 1/2+1/2M M 6-2M Cj-Zj 0 -1/2M+9/2 -1/2M-1/2 -M Cj 2. RHS 3 An Unbounded Problem – the objective function value (for maximization problem) gets very large without bound o o The objective function can increase indefinitely without reaching a maximum value. The solution space is not completely closed in. Example 3.9 Maximize Z= 2x1 + 6x2 subject to: 4x1 + 3x2 12 2x1 + x2 8 x1, x2 0 The solution is unbounded 58 Zuraidah Derasit –FSKM- o Cj 6 0 3. Simplex tableau : An unbounded problem is detected when all entries in the pivot column are non positive, hence there will be no leaving variable. Basic Var x2 s1 Zj Cj-Zj x1 2 2 2 12 -10 x2 6 1 0 6 0 s1 0 0 1 0 0 s2 0 -1 -3 -6 6 RHS 8 12 48 Ratio 8/-1 = - 8 12/-3= - 4 Alternate Optimal Solutions – LP problem has more than one optimal solution. o o This is the case when the objective function’s isoprofit or isocost line runs perfectly parallel to one of the problem’s constraint. Provide greater flexibility to the decision maker. Example 3.10 Maximize Z = 60x1 + 60x2 subject to 3x1 + 3x2 90 2x1 + 4x2 80 x1 , x2 0 Alternate optimal solution Corner points: 59 Zuraidah Derasit –FSKM- X1 0 30 0 20 X2 0 0 20 10 Z 0 1800 1200 1800 A corner points having the same maximum value indicate the LP problem has alternate optimal solution. o Simplex tableau : Alternate optimal solutions is detected if the final tableau has Cj – Zj value equal to 0 for a non-basic variable. An alternate optimal solution Cj Basic Var 60 x1 60 x2 Zj Cj-Zj 4. x1 60 1 0 60 0 x2 60 0 1 60 0 s1 0 2/3 -1/3 20 -20 s2 0 -1/2 1/2 0 0 RHS 20 10 1800 Degeneracy o A redundant constraint is one that does not affect the feasible solution region. Example 3.11 Maximize Z = 80x1 + 70x2 subject to 2x1 + x2 120 x1 + x2 60 x1 70 x1 , x2 0 60 Zuraidah Derasit –FSKM- Redundant constraint Degeneracy o Simplex tableau : Degeneracy is detected in simplex tableau when more than one row have similar smallest nonnegative numbers (ratio). Iteration 1 Basic Cj Var 0 s1 x1 80 2 x2 70 1 s1 0 1 s2 0 0 s3 0 0 RHS Ratio 120 120/2 = 60 0 s2 1 0 0 1 0 70 70/1 = 70 0 s3 1 1 0 0 1 60 60/1 = 60 Zj 0 0 0 0 0 0 0 Cj-Zj 80 70 0 0 0 0 Choosing row s1 as the pivot row produces the following tableau: 61 Zuraidah Derasit –FSKM- Iteration 2 Basic Cj Var 80 x1 x1 80 1 x2 70 1/2 s1 0 1/2 s2 0 0 s3 0 0 RHS Ratio 60 60/1/2 =120 0 s2 0 -1/2 -1/2 1 0 10 10/-1/2 = x 0 s3 0 1/2 1/2 0 1 0 0/1/2 = 0 Zj 80 40 40 0 0 4800 Cj-Zj 0 30 -40 0 0 Degeneracy causes a basic variable to have zero value. In the second iteration above, the basic variable s3 = 0. Iteration 3 80 Basic Var x1 x1 80 1 x2 70 0 s1 0 1 s2 0 0 s3 0 -1 0 s2 0 0 -1 1 1 10 70 x2 0 1 -1 0 2 0 Zj 80 70 10 0 60 4800 Cj-Zj 0 0 -10 0 -60 Cj RHS 60 In the third iteration, the basic variable x2 = 0. 62 Zuraidah Derasit –FSKM- Exercises Solve the following linear programming problems using the graphical method. 3.10 3.11 Maximize Z = x +y Maximize Z = 2x1 + x2 subject to subject to x+y 1 -3x + y 3 x, y 0 3.12 3x1 + x2 3 4x1 + 3x2 ≥ 6 x1 + 2x2 ≥ 2 x1, x2 0 3.13 Maximize Z = 2x1 + 4x2 Maximize Z = 4x1 + 5x2 subject to subject to x1 + 2x2 5 x1 + x2 ≤ 4 x1, x2 0 2x1 + 2x2 ≤ 100 x2 ≤ 25 x1 ≤ 60 x1, x2 0 63 Zuraidah Derasit –FSKM- Sensitivity Analysis with the simplex tableau Sensitivity analysis trace the changes that we make to our parameter. » Changes in Resources/RHS Values - Making changes in the resources/RHS values result in changes in the feasible region and often the optimal point. This would also affect the value of the objective function. - Making changes in the resources/RHS values also leads us to important topic of shadow price. - Shadow price is: The changes in value of the objective function for every additional unit of scarce resource. It is also refer to maximum amount the firm should pay for every additional unit of resource to make available. Example 3.12 High Note Sound is a company that makes compact disks CD players (x1) and stereo receivers (x2). The company wants to maximize profit. LP model: Maximize Profit = 50x1 + 120x2 subject to 2x1 + 4x2 80 (hours of electricians’ time available) 3x1 + x2 60 (hours of audio technicians’ time available) x1 , x2 0 In the High Note Sound company; there are two resources available; 1. hours of electrician’s time 2. hours of technician’s time For electrician’s time, there are 80 hours available; and 60 hours of technician’s time available. 64 Zuraidah Derasit –FSKM- The graphical solution of the above problem is as follows: A B D C Corner point solution: A (x1 = 0, x2 = 20, Z = 2,400)* B (x1 = 16, x2 = 12, Z = 2,240) C (x1 = 20, x2 = 0, Z = 1,000) D (x1 = 0, x2 = 0, Z = 0) Optimal solution: x1 = 0 CD player x2 = 20 stereo receivers Z = RM2400 With 80 hours and 60 hours of electrician and technician’s time available, we are able to produce RM2400 profit. Now, if we add one hour of technician’s time from 80 hours to 81 hours; the following result is obtained: 65 Zuraidah Derasit –FSKM- Change RHS value from 80 to 81 hours of electricians’ time available. Solve LP model. Maximize Profit = 50x1 + 120x2 subject to 2x1 + 4x2 81 3x1 + x2 60 x1 , x2 0 A B D C Corner point solution: A (x1 = 0, x2 = 20.25, Z = 2,430)* B (x1 = 15.9, x2 = 12.3, Z = 2,271) C (x1 = 20, x2 = 0, Z = 1,000) D (x1 = 0, x2 = 0, Z = 0) Noticed that; 1 additional unit of the electrician’s hour, assuming no cost incurred, causes the total profit to increase to RM2430. This is an increase of RM30. Hence, the 1 additional hour of electrician’s time is worth RM30. This is known as shadow price for electrician’s hour. Shadow prices can be simply obtained from an optimal solution simplex tableau. These are the numbers in the z-row of slack variable columns. 66 Zuraidah Derasit –FSKM- The simplex solution for High Note Sound model: Final simplex tableau: x2 x1 50 ½ x2 120 1 s1 0 ¼ s2 0 0 s2 5/2 0 -1/4 1 40 Zj 60 120 0 2400 Cj-Zj -10 0 30 -30 Cj Basic Var 120 0 Optimal solution: x1 = 0 (CD players) x2 = 20 (stereo receivers) s1 = 0 (hour of unused time of electrician’s) s2 = 40 (hours of unused time of audio technician’s) Z = RM2400 Quantity 20 0 Shadow price (ignore negative) RM30 for one additional hour of electrician’s time RM0 for one additional hour of technician’s time One additional hour of electrician’s time is worth RM30. If the company increases 1 hour of electrician’s time, the new profit would be: RM2400+RM30. One additional hour of technician’s time is worth nothing. If the company increases 1 hour of technician’s time, the new profit would be: RM2400+RM0. 67 Zuraidah Derasit –FSKM- Example 3.13 The management of a company has formulated the following linear programming problem. Let x1 = number of product 1 to produce x2 = number of product 2 to produce x3 = number of product 3 to produce Maximize Profit, Z = 7 x 1 3 x 2 9 x 3 subject to 4x1 + 5x2 + 6x3 360 hours (labor hour) 2x1 + 4x2 + 6x3 300 hours (machine hour) 9x1 + 5x2 + 6x3 600 kg (raw material) x1,x2,x3 0 The following is the final simplex tableau for the above problem. Use this to answer the questions below. Cj Basic x1 7 x2 3 x3 9 s1 0 s2 0 s3 0 RHS 7 9 0 x1 x3 s2 Zj Cj – Zj 1 0 0 7 0 0 0.83 -1 7.5 -4.5 0 1 0 9 0 -0.2 0.3 -1.4 1.3 -1.3 0 0 1 0 0 0.2 -0.13 0.4 0.2 -0.2 48 28 36 a 1. Why we said that the above tableau is the optimal tableau? All Cj – Zj row values are less and equal to zero. 2. State and interpret the optimal solution. x1 = 48; produce 48 units of product 1 x2 = 0; produce 0 unit of product 2 x3 = 28; produce 28 units of product 3 s1 = 0; raw material is fully utilized s2 = 36; 36 hours machine time is unused s3 = 0; workers’ time is fully utilized 68 Zuraidah Derasit –FSKM- 3. Determine the value of a. Z = a = 7(48) + 9(28) = RM588 4. Which resource(s) is/are not fully utilized? State the value. Machine time is not fully utilized, hours left is 36 hours. 5. How many hours of labor and machine and amount of raw material are used to reach the optimal solution? Used: Labor hour = 360 hours Machine hour = 300 – 36 = 264 hours Raw material = 600kg 6. What are the shadow prices of the resources? The shadow prices of labor hour = RM1.30 machine hour = RM0 raw material = RM0.20 7. What does a zero shadow price mean? How could this happen? Shadow price RM0 means that 1 additional unit of the resource is worth nothing. The resource is not fully utilized. e.g. optimal solution s2 = 36 8. Is it worthwhile to pay RM2 for 1 additional hour of the labor? Explain. Not worthwhile because the maximum amount to pay is RM1.30. 9. Should the company pay RM3 for 3 more hours of the labor? Explain. RM3 RM1/hour ; 3hours Worth, because the maximum amount to pay is RM1.30. 10. What will be the new Z value if the company increase 2 hours of labor? Increase 3 hours of machine time? Decrease 3 kilograms of raw material? Z = RM588 + 2(1.30) = RM590.60 Z = RM588 + 3(0) = RM588 Z = RM588 - 3(RM0.20) = RM587.40 11. Is there any alternative optimal solution? Why? No. Because in Cj – Zj row, there is no non-basic variable equal to zero. 69 Zuraidah Derasit –FSKM- Exercises 3.14 IMB Sdn. Bhd. manufactures three products, a, b and c. The products must go through three production processes: Machining (Resource 1), Assembly (Resource 2) and Packaging (Resource 3). The company wants to maximize profit. Profits for the products a, b and c are RM50, RM20 and RM30 respectively. The simplex tableau for this problem is given below. Cj Basic Variables A a b c s1 s2 s3 RHS 1 -1 0 1 -1 0 100 C 0 3 1 -1 2 0 40 s3 0 -1 0 0 1 1 25 Zj Cj – Zj a) Complete the above tableau. b) Is the above tableau optimal? Explain. c) State the optimal solution. d) Which resource(s) is/are fully utilized. e) Which resource(s) is/are not fully utilized and state the value(s). f) State the shadow price for each resource and interpret. g) What would be the effect on total profit if resource 1 was increased by 10 units and resource 3 was increased by 5 units? 70 Zuraidah Derasit –FSKM- 3.15 Beautiful Cotton Manufacturer produces two types of cotton cloths: denim and corduroy. This company wants to maximize profit. Given below is the LP model in order to maximize profit. Maximize profit = 6X1 + 4.5X2 subject to 3.5 X1 2.5 X 2 3250 (cotton usage, meters) 3.2 X1 3 X 2 3000 (processing time, hours) X 1 510 (demand for corduroy, meters) X 1, X 2 0 The final simplex tableau for the above problem is shown below: Cj 0 4.5 6 Basic Variable S1 X2 X1 Zj Cj – Zj 6 X1 0 0 1 6 0 4.5 X2 0 1 0 4.5 0 0 S1 1 0 0 0 0 0 S2 -0.83 0.33 0 1.5 -1.5 0 S3 -0.83 -1.07 1 1.2 -1.2 Quantity 325 456 510 5112 X1 = number of meters of corduroy produced, X2 = number of meters of denim produced, S1, S2, and S3 are the slack variables for cotton usage, processing time and demand for corduroy respectively. a) Determine the optimal production level and the maximum profit obtained. b) How much cotton and processing time are left over in the optimal solution? c) What is the maximum amount the manufacturer is willing to spend for an additional processing time? d) If the manufacturer increase one meter of cotton at cost RM3 will it be worthwhile? Why? e) Does this problem have alternate optimal solution? Explain. 71 Zuraidah Derasit –FSKM- The Dual Every LP primal model has a dual model. The first way of stating a linear problem is called the primal of the problem. The second way of stating the same problem is called the dual. Step to form a dual: Primal Dual Objective function maximization Objective function minimization Objective function minimization Objective function maximization RHS values Objective function coefficients Constraints coefficients Transpose of primal constraints coefficients Objective function coefficients RHS values Constraint inequality sign Inequality signs reversed Example 3.14 Primal model Maximize Profit = 50x1 + 120x2 subject to 2x1 + 4x2 80 3x1 + x2 60 x1 , x2 0 Dual model Minimize Opportunity Cost = 80y1 + 60y2 subject to 2y1 + 3y2 50 4y1 + y2 120 y1, y2 0 72 Zuraidah Derasit –FSKM In the final simplex tableau of primal problem; the absolute value of the number in the Cj-Zj row under slack variables represent the solutions to the dual problem It also happens that the absolute value of the Cj-Zj values of the slack variables in the dual solution represent the optimal values of the primal X1 and X2. The minimum opportunity cost derived in the dual must always equal to the maximum profit derived in the primal Example 3.15 Primal model Maximize Profit = 50x1 + 120x2 subject to 2x1 + 4x2 80 3x1 + x2 60 x1 , x2 0 Optimal tableau of primal model: Cj 120 0 Basic Var x2 s2 Zj Cj -Zj Primal optimal solution: x1 = 0 x2 = 20 s1 = 0 s2 = 40 Z = RM2400 x1 50 ½ 5/2 60 -10 x2 120 1 0 120 0 s1 0 ¼ -1/4 30 -30 s2 0 0 1 0 0 Quantity 20 40 2400 Dual optimal solution: y1 = 30 y2 = 0 s1 = 10 s2 = 0 Z = RM2400 73 Zuraidah Derasit –FSKM- Dual model Minimize Opportunity Cost = 80y1 + 60y2 subject to 2y1 + 3y2 50 4y1 + y2 120 y1, y2 0 Optimal tableau of dual model: Dual model Cj 80 0 Basic Var y1 s1 y1 80 1 0 y2 60 ¼ -5/2 s1 0 0 1 s2 0 -1/4 -1/2 Zj 80 20 0 -20 Zj - Cj 0 -40 0 -20 Dual optimal solution: y1 = 30 y2 = 0 s1 = 10 s2 = 0 Z = RM2400 Quantity 30 10 2400 Primal optimal solution: x1 = 0 x2 = 20 s1 = 0 s2 = 40 Z = RM2400 74 Zuraidah Derasit –FSKM- Exercises Write the dual. 3.16 3.17 Maximize Z = 3x1 + 9x2 Maximize Z = 5x1 +7x2 subject to subject to 2x1 + 4x2 8 x1 + 7x2 ≤ 7 x1, x2 0 3.18 x1 6 2x1 + 3x2 ≤ 19 x1 + x2 ≤ 8 x1, x2 0 3.19 Minimize Z = x 1 2x 2 Maximize Z =30x1+ 20x2 + 40x3 subject to subject to x1 + x2 40 2x1 + 4x2 60 x1 + x2 0 5x1 + 9x2 + 8x3 ≤ 450 3x1 – 4x2 ≥ 120 x1, x2, x3 ≥ 0 75 Zuraidah Derasit –FSKM- Problems 3.16 Consider the following linear programming problem. Z 2000 x 1 700 x 2 1600 x 3 Minimize Subject to 5 x 1 2x 2 2x 3 20 4 x 1 x 2 2x 3 30 x 1, x 2 , x 3 0 a) Write the dual for the above linear programming problem in variable Y. The following is an incomplete final simplex tableau for the dual model (a). Cj 30 0 0 Basic variable Y2 S2 S3 20 Y1 1.25 0.75 -0.5 30 Y2 1 0 0 0 S1 0.25 -0.25 -0.5 0 S2 0 1 0 0 S3 0 0 1 Quantity 500 200 600 Zj Cj-Zj b) c) d) Complete the above simplex tableau. State the optimal solution for the dual. State the optimal solution for the primal based on the final simplex tableau. 3.17 The following is the incomplete final simplex tableau for the primal, where S1, S2 and S3 are the slack variable. Cj Solution Mix 10 X1 24 X2 50 X3 Zj Cj - Zj a) b) c) 10 X1 1 0 0 24 X2 0 1 0 50 X3 0 0 1 0 S1 4 0 0 0 S2 -2 2 0 0 S3 -1 -1 1 Quantity 4 3 2 Complete the above simplex tableau. Explain why this tableau gives the optimal solution. What is the optimal solution for the primal? Dual? 76 Zuraidah Derasit –FSKM- 3.18 The Toy Race Car Company manufactures three different race-cars called Racer 1, Racer 2 and Racer 3. The resources required to make the products are technical services, labor and administration. Table below gives the requirements for the production. Product Technical services (hour) Labor (hour) Administration (hour) Unit profit (RM) Racer 1 Racer 2 Racer 3 1 2 3 10 4 5 2 2 6 10 6 4 Each week there are 100 hours of technical services available, 600 hours of labor and 300 hours of administration. a) Formulate the problem as a linear programming problem. The optimal simplex tableau for the above problem is given below. The S1, S2, S3 are the slack variables for technical services, labor and administration, respectively. Cj 10 X1 0 6 X2 1 4 X3 5/6 0 S1 5/3 0 S2 -1/6 0 S3 0 Quantity 6 Basic Variables X2 10 0 X1 S3 1 0 0 0 1/6 4 -2/3 -2 1/6 0 0 1 100/3 100 200/3 Zj Cj – Zj b) Fill in the values on Zj and Cj-Zj rows. c) Specify the optimal daily production levels of the three products. What is the total profit? d) Which resource(s) is not fully utilized? If so, how much spare capacity is left? e) If the company had an opportunity to purchase additional resources, which resource would be the most valuable? How much would the company be willing to pay for this resource? f) Write down the dual of the problem. g) Give the solution of the dual problem. 77