 # BA 452 Lesson A.2 Solving Linear Programs 1 1ReadingsReadings Chapter 2 An Introduction to Linear Programming.

## Presentation on theme: "BA 452 Lesson A.2 Solving Linear Programs 1 1ReadingsReadings Chapter 2 An Introduction to Linear Programming."— Presentation transcript:

BA 452 Lesson A.2 Solving Linear Programs 1 1ReadingsReadings Chapter 2 An Introduction to Linear Programming

BA 452 Lesson A.2 Solving Linear Programs 2 2OverviewOverview

3 3Overview Graphical Solutions to linear programs arise from graphing the feasible solutions for each constraint and a constant-value line for the objective function to identify the binding constraints to solve. Slack and Surplus Variables measure the deviation of inequality constraints from binding equalities. Thus they measure how much non-binding constraints can change before they affect an optimum. Extreme Points are the corners (or vertices) of the feasible region of a linear program. An optimal solution can be found at extreme points. Thus finding extreme points is an alternative to graphing solutions. Computer Solutions are available to linear programs with many variables and constraints. Computed values include the objective function, decision variables, and slack and surplus variables. Resource Allocation Problems with Sales Maximums constrain the maximum output D that can be sold at a given price P. The demand curve for output is assumed to be of a special form.

BA 452 Lesson A.2 Solving Linear Programs 4 4 Graphical Solutions

BA 452 Lesson A.2 Solving Linear Programs 5 5 Overview Graphical Solutions to linear programs arise from graphing the feasible solutions for each constraint and a constant- value line for the objective function to identify which constraints bind (hold with equality) at the optimal solution. Then, solve those constraints to compute the optimal solution. Graphical Solutions

BA 452 Lesson A.2 Solving Linear Programs 6 6 Graph the first constraint of Example 1 from Lesson I.1, plus non-negativity constraints. x 2 x 2 x1x1x1x1 x 1 = 6 is the binding edge of the first constraint, where it holds with equality. The point (6, 0) is on the end of the binding edge of the first constraint plus the non- negativity of x 2. 87654321 1 2 3 4 5 6 7 8 9 10 Shaded region contains all feasible points for this constraint Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 Graphical Solutions

BA 452 Lesson A.2 Solving Linear Programs 7 7 2x 1 + 3x 2 = 19 is the binding edge of the second constraint. x 2 x 2 x1x1x1x1 87654321 Shaded region contains all feasible points for this constraint Graph the second constraint of Example 1, plus non-negativity constraints. The point (0, 6  ) is on the end of the binding edge of the second constraint plus the non-negativity of x 1. The point (9 , 0) is on the end of the binding edge of the second constraint plus the constraint plus the non-negativity of x 2. non-negativity of x 2. Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 Graphical Solutions 1 2 3 4 5 6 7 8 9 10

BA 452 Lesson A.2 Solving Linear Programs 8 8 x 2 x 2 x1x1x1x1 x 1 + x 2 = 8 is the binding edge of the third constraint 87654321 Shaded region contains all feasible points for this constraint Graph the third constraint of Example 1, plus non-negativity constraints. The point (0, 8) is on the end of the binding edge of the third constraint plus the non- negativity of x 1 negativity of x 1 The point (8, 0) is on the end of the binding edge of the third constraint plus the third constraint plus the non-negativity of x 2 non-negativity of x 2 Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 Graphical Solutions 1 2 3 4 5 6 7 8 9 10

BA 452 Lesson A.2 Solving Linear Programs 9 9 x1x1x1x1 x 2 x 2 87654321 2x 1 + 3x 2 = 19 x 1 + x 2 = 8 x 1 = 6 Feasible region region Intersect all constraint graphs to define the feasible region. Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 Graphical Solutions 1 2 3 4 5 6 7 8 9 10

BA 452 Lesson A.2 Solving Linear Programs 10 Graph a line with a constant objective-function value. For example, 35 dollars of profit. x1x1x1x1 (7, 0) (0, 5) objective function value 5x 1 + 7x 2 = 35 objective function value 5x 1 + 7x 2 = 35 87654321 x 2 x 2 Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 Graphical Solutions 1 2 3 4 5 6 7 8 9 10

BA 452 Lesson A.2 Solving Linear Programs 11 x1x1x1x1 5x 1 + 7x 2 = 35 87654321 5x 1 + 7x 2 = 42 5x 1 + 7x 2 = 39 Graph alternative constant-value lines. For example, 35 dollars, 39 dollars, or 42 dollars of profit. 42 dollars of profit. x 2 x 2 Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 Graphical Solutions 1 2 3 4 5 6 7 8 9 10

BA 452 Lesson A.2 Solving Linear Programs 12 x1x1x1x1 x 2 x 2 Maximum constant-value line 5x 1 + 7x 2 = 46 Second and third constraints bind at the optimal solution Second and third constraints bind at the optimal solution 87654321 Graph the maximum constant-value line, graph the optimal solution, then determine the binding constraints. the binding constraints. Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 Graphical Solutions 1 2 3 4 5 6 7 8 9 10

BA 452 Lesson A.2 Solving Linear Programs 13 1111232311112323 x1x1x2x2x1x1x2x2819 = x 1 = det / det = (8x3-1x19)/(1x3-1x2) = 5 8 1 19 3 1111232311112323 x 2 = det / det = (1x19-8x2)/(1x3-1x2) = 3 1 8 2 19 1111232311112323 1x 1 + 1x 2 = 8 2x 1 + 3x 2 = 19 Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 n The optimal solution (x 1, x 2 ) is where the second and third constraints bind (hold with equality): x 1 + x 2 = 8 and 2x 1 + 3x 2 = 19. n Solve those equalities using linear algebra, matrices, determinates (det), and Cramer’s rule: Graphical Solutions

BA 452 Lesson A.2 Solving Linear Programs 14 Summary of a graphical solution procedure n Graph the feasible solutions for each constraint. n Determine the feasible region that simultaneously satisfies all the constraints. n Draw a constant-value line for the objective function. n Move parallel value lines toward larger objective function values without leaving the feasible region. n Any feasible solution on the objective function line with the largest value is an optimal solution (or optimum). n That solution can be found by solving the binding (equality) constraints. Graphical Solutions

BA 452 Lesson A.2 Solving Linear Programs 15 Slack and Surplus Variables

BA 452 Lesson A.2 Solving Linear Programs 16 Slack and Surplus Variables Overview Slack and Surplus Variables measure the deviation of inequality constraints from binding equalities. Thus they measure how much non-binding constraints can change before they affect an optimum.

BA 452 Lesson A.2 Solving Linear Programs 17 n Compute slack variables at the optimum to Example 1. x1x1x1x1 x 2 x 2 87654321 Binding second constraint: 2x 1 + 3x 2 = 19 Binding third constraint: x 1 + x 2 = 8 Binding edge of first constraint: x 1 = 6 Optimalsolution (x 1 = 5, x 2 = 3) Optimalsolution s 1 = 1 s 2 = 0 s 3 = 0 Slack and Surplus Variables Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0 1 2 3 4 5 6 7 8 9 10

BA 452 Lesson A.2 Solving Linear Programs 18 Extreme Points

BA 452 Lesson A.2 Solving Linear Programs 19 Extreme Points Overview Extreme Points are the corners (or vertices) of the feasible region of a linear program. An optimal solution can be found at extreme points. Thus finding extreme points is an alternative to graphing solutions.

BA 452 Lesson A.2 Solving Linear Programs 20 x1x1x1x1 Feasible region region 11 22 33 44 55 x 2 x 2 87654321 1 2 3 4 5 6 7 8 9 10 (0, 6  ), where 2x 1 + 3x 2 = 19 and x 1 = 0 (5, 3), where 2x 1 + 3x 2 = 19 and x 1 + x 2 = 8 (0, 0) (6, 2), where x 1 + x 2 = 8 and x 1 = 6 (6, 0), where x 2 = 0 and x 1 = 6 n Compute the extreme points in Example 1 by solving pairs of binding constraints. Extreme Point Solutions Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0

BA 452 Lesson A.2 Solving Linear Programs 21 n Evaluate the objective function at each of the extreme points in Example 1. n Point (5,3) thus maximizes the objective function, with value 46. (Likewise, point (0,0) minimizes.) Extreme point has objective value 5x 1 + 7x 2 = 44 1/3 Extreme point has objective value 5x 1 + 7x 2 = 42 Extreme point has objective value 5x 1 + 7x 2 = 0 11 22 33 (0, 0) (6, 0) Extreme point has objective value 5x 1 + 7x 2 = 30 (6, 2) 44 55 (5, 3) (0, 6 1/3) Extreme point has objective value 5x 1 + 7x 2 = 46 Extreme Point Solutions Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0

BA 452 Lesson A.2 Solving Linear Programs 22 Computer Solutions

BA 452 Lesson A.2 Solving Linear Programs 23 Computer Solutions Overview Computer Solutions are available to linear programs with many variables and constraints. Computed values include the objective function, decision variables, and slack and surplus variables.

BA 452 Lesson A.2 Solving Linear Programs 24 Computer Solutions n LP problems involving many variables and constraints are now routinely solved with computer packages. n Linear programming solvers are now part of many spreadsheet packages, such as Microsoft Excel. n The Management Scientist program has a convenient LP module. n In remainder of this lesson we will interpret the following output: objective function value objective function value values of the decision variables values of the decision variables slack and surplus slack and surplus n In a forthcoming lesson, we will interpret the output the shows how an optimal solution is affected by a change in: a coefficient of the objective function a coefficient of the objective function the right-hand side value of a constraint the right-hand side value of a constraint

BA 452 Lesson A.2 Solving Linear Programs 25 n To use The Management Scientist 6.0 program, select New under the File menu. Computer Solutions Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0

BA 452 Lesson A.2 Solving Linear Programs 26 n Decision Variable Names can be changed, if desired. n Enter objective function coefficients in the Objective Function portion of the input screen. n In the Constraints section, enter constraint coefficients, constraint relationship ( ), where abbreviates >. And enter the constraint right-hand-side constants. n Do not enter non-negativity constraints. They are assumed. Computer Solutions Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0

BA 452 Lesson A.2 Solving Linear Programs 27 Maximized objective function value = 46 Optimal x 1 = 5 and x 2 = 3 n Under the Solution menu, select Solve for the Optimal Solution. Computer Solutions Example 1: Max 5x 1 + 7x 2 s.t. x 1 < 6 2x 1 + 3x 2 < 19 2x 1 + 3x 2 < 19 x 1 + x 2 < 8 x 1 + x 2 < 8 x 1 > 0 and x 2 > 0 x 1 > 0 and x 2 > 0

BA 452 Lesson A.2 Solving Linear Programs 28 Resource Allocation with Sales Maximums

BA 452 Lesson A.2 Solving Linear Programs 29 Overview Resource Allocation Problems with Sales Maximums constrain the maximum output D that can be sold at a given price P. The demand curve for output is assumed to be of the following special form:  At price P, demand quantity is D  At any price less than P, demand quantity does not increase, but remains D  At any price greater than P, demand quantity drops from D to 0 Resource Allocation with Sales Maximums

BA 452 Lesson A.2 Solving Linear Programs 30 Question: The Monet Company produces four type of picture frames: 1, 2, 3, 4. The four types differ in size, shape and materials used. n Each type requires a certain amount of skilled labor, metal, and glass: Each frame of type 1 uses 2 hours of labor, 4 ounces of metal, 6 ounces of glass, and sells for \$28.50. Each frame of type 1 uses 2 hours of labor, 4 ounces of metal, 6 ounces of glass, and sells for \$28.50. Each frame of type 2 uses 1 hour of labor, 2 ounces of metal, 2 ounces of glass, and sells for \$12.50. Each frame of type 2 uses 1 hour of labor, 2 ounces of metal, 2 ounces of glass, and sells for \$12.50. Each frame of type 3 uses 3 hours of labor, 1 ounces of metal, 1 ounces of glass, and sells for \$29.25. Each frame of type 3 uses 3 hours of labor, 1 ounces of metal, 1 ounces of glass, and sells for \$29.25. Each frame of type 4 uses 2 hours of labor, 2 ounces of metal, 2 ounces of glass, and sells for \$21.50. Each frame of type 4 uses 2 hours of labor, 2 ounces of metal, 2 ounces of glass, and sells for \$21.50. Resource Allocation with Sales Maximums

BA 452 Lesson A.2 Solving Linear Programs 31 n Each week, Monet can buy up to 4000 hours of skilled labor and 10,000 ounces of glass. n The unit costs are \$8.00 per labor hour, \$0.50 per ounce of metal, and \$0.75 per ounce of glass. n Market constraints are such that it is impossible to sell more than: 1000 type 1 frames, 1000 type 1 frames, 2000 type 2 frames, 2000 type 2 frames, 500 type 3 frames, 500 type 3 frames, 1000 type 4 frames. 1000 type 4 frames. How can Monet maximize its weekly profit? Resource Allocation with Sales Maximums

BA 452 Lesson A.2 Solving Linear Programs 32 Answer: First, compute unit profit for each type of frame: n Frame 1: Unit profit = Sales price – input costs = 28.5 – 2x8 – 4x.5 – 6x.75 = 28.5 – 2x8 – 4x.5 – 6x.75 = 28.5 – 16 – 2 – 4.5 = \$6.00 = 28.5 – 16 – 2 – 4.5 = \$6.00 n Frame 2: Unit profit = 12.5 – 1x8 – 2x.5 – 2x.75 = 12.5 – 8 – 1 – 1.5 = \$2.00 = 12.5 – 8 – 1 – 1.5 = \$2.00 n Frame 3: Unit profit = 29.25 – 3x8 – 1x.5 – 1x.75 = 29.25 – 24 –.5 –.75 = \$4.00 = 29.25 – 24 –.5 –.75 = \$4.00 n Frame 4: Unit profit = 21.5 – 2x8 – 2x.5 – 2x.75 = 21.5 – 16 – 1 – 1.5 = \$3.00 = 21.5 – 16 – 1 – 1.5 = \$3.00 Resource Allocation with Sales Maximums

BA 452 Lesson A.2 Solving Linear Programs 33 n Let x i be weekly sales of frames of type i (i = 1, 2, 3, 4). Maximize6x 1 + 2x 2 + 4x 3 + 3x 4 (profit objective) subject to2x 1 + x 2 + 3x 3 + 2x 4  4000 (labor constraint) 6x 1 + 2x 2 + x 3 + 2x 4  10,000 (glass constraint) x 1  1000 (frame 1 sales constraint) x 1  1000 (frame 1 sales constraint) x 2  2000 (frame 2 sales constraint) x 2  2000 (frame 2 sales constraint) x 3  500 (frame 3 sales constraint) x 3  500 (frame 3 sales constraint) x 4  1000 (frame 4 sales constraint) x 4  1000 (frame 4 sales constraint) x 1, x 2, x 3, x 4  0 (nonnegativity constraints) x 1, x 2, x 3, x 4  0 (nonnegativity constraints) n 6x 1 = Profit from frames of type 1 n 2x 1 = Labor used in frames of type 1 n 4x 1 = Glass used in frames of type 1 Resource Allocation with Sales Maximums

BA 452 Lesson A.2 Solving Linear Programs 34 Maximize 6x 1 + 2x 2 + 4x 3 + 3x 4 subject to 2x 1 + x 2 + 3x 3 + 2x 4  4000 6x 1 + 2x 2 + x 3 + 2x 4  10,000 6x 1 + 2x 2 + x 3 + 2x 4  10,000 x 1  1000 x 1  1000 x 2  2000 x 2  2000 x 3  500 x 3  500 x 4  1000 x 4  1000 x 1, x 2, x 3, x 4  0 x 1, x 2, x 3, x 4  0 Resource Allocation with Sales Maximums

BA 452 Lesson A.2 Solving Linear Programs 35 Resource Allocation with Sales Maximums Maximize 6x 1 + 2x 2 + 4x 3 + 3x 4 subject to 2x 1 + x 2 + 3x 3 + 2x 4  4000 6x 1 + 2x 2 + x 3 + 2x 4  10,000 6x 1 + 2x 2 + x 3 + 2x 4  10,000 x 1  1000 x 1  1000 x 2  2000 x 2  2000 x 3  500 x 3  500 x 4  1000 x 4  1000 x 1, x 2, x 3, x 4  0 x 1, x 2, x 3, x 4  0

BA 452 Lesson A.2 Solving Linear Programs 36 n Maximum weekly profit of \$10,000. n X i is optimal weekly sales of frames of type i (i = 1, 2, 3, 4). Resource Allocation with Sales Maximums Maximize 6x 1 + 2x 2 + 4x 3 + 3x 4 subject to 2x 1 + x 2 + 3x 3 + 2x 4  4000 6x 1 + 2x 2 + x 3 + 2x 4  10,000 6x 1 + 2x 2 + x 3 + 2x 4  10,000 x 1  1000 x 1  1000 x 2  2000 x 2  2000 x 3  500 x 3  500 x 4  1000 x 4  1000 x 1, x 2, x 3, x 4  0 x 1, x 2, x 3, x 4  0

BA 452 Lesson A.2 Solving Linear Programs 37 End of Lesson A.2 BA 452 Quantitative Analysis