Readings Readings Chapter 2 An Introduction to Linear Programming BA 452 Lesson A.2 Solving Linear Programs 1 Overview Overview BA 452 Lesson A.2 Solving Linear Programs 2 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 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 3 Graphical Solutions Graphical Solutions BA 452 Lesson A.2 Solving Linear Programs 4 Graphical Solutions Overview Graphical Solutions to linear programs arise from graphing the feasible solutions for each constraint and a constantvalue 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. BA 452 Lesson A.2 Solving Linear Programs 5 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Graph the first constraint of Example 1 from Lesson I.1, plus non-negativity constraints. x2 8 7 6 5 4 x1 = 6 is the binding edge of the first constraint, where it holds with equality. Shaded region contains all feasible points for this constraint The point (6, 0) is on the end of the binding edge of the first constraint plus the nonnegativity of x2. 3 2 1 1 2 3 4 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 6 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Graph the second constraint of Example 1, plus non-negativity constraints. The point (0, 6 1/3) is on the x2 end of the binding edge of the second constraint plus the non-negativity of x1. 8 7 6 2x1 + 3x2 = 19 is the binding edge of the second constraint. 5 4 3 2 1 The point (9 1/2, 0) is on the end of the binding edge of the second constraint plus the non-negativity of x2. Shaded region contains all feasible points for this constraint 1 2 3 4 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 7 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Graph the third constraint of Example 1, plus non-negativity constraints. The point (0, 8) is on the end x2 of the binding edge of the third constraint plus the nonnegativity of x1 8 7 6 x1 + x2 = 8 is the binding edge of the third constraint 5 4 3 2 1 Shaded region contains all feasible points for this constraint 1 2 3 4 5 The point (8, 0) is on the end of the binding edge of the third constraint plus the non-negativity of x2 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 8 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Intersect all constraint graphs to define the feasible region. x2 x1 + x2 = 8 8 7 x1 = 6 6 5 4 3 2x1 + 3x2 = 19 Feasible region 2 1 1 2 3 4 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 9 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Graph a line with a constant objective-function value. For example, 35 dollars of profit. x2 8 7 (0, 5) 6 objective function value 5x1 + 7x2 = 35 5 4 3 2 (7, 0) 1 1 2 3 4 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 10 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Graph alternative constant-value lines. For example, 35 dollars, 39 dollars, or x2 42 dollars of profit. 8 7 5x1 + 7x2 = 35 6 5x1 + 7x2 = 39 5 4 5x1 + 7x2 = 42 3 2 1 1 2 3 4 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 11 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Graph the maximum constant-value line, graph the optimal solution, then determine x2 the binding constraints. 8 Maximum constant-value line 5x1 + 7x2 = 46 Second and third constraints bind at the optimal solution 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 12 Graphical Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 The optimal solution (x1, x2 ) is where the second and third constraints bind (hold with equality): x1 + x2 = 8 and 2x1 + 3x2 = 19. Solve those equalities using linear algebra, matrices, determinates (det), and Cramer’s rule: 1x1 + 1x2 = 8 2x1 + 3x2 = 19 1 2 1 3 x1 x2 = 8 19 x1 = det 8 1 19 3 / det 1 2 1 3 = (8x3-1x19)/(1x3-1x2) = 5 x2 = det 1 8 2 19 / det 1 2 1 3 = (1x19-8x2)/(1x3-1x2) = 3 BA 452 Lesson A.2 Solving Linear Programs 13 Graphical Solutions Summary of a graphical solution procedure Graph the feasible solutions for each constraint. Determine the feasible region that simultaneously satisfies all the constraints. Draw a constant-value line for the objective function. Move parallel value lines toward larger objective function values without leaving the feasible region. Any feasible solution on the objective function line with the largest value is an optimal solution (or optimum). That solution can be found by solving the binding (equality) constraints. BA 452 Lesson A.2 Solving Linear Programs 14 Slack and Surplus Variables Slack and Surplus Variables BA 452 Lesson A.2 Solving Linear Programs 15 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 16 Slack and Surplus Variables Compute slack variables at the optimum to Example 1. x2 Binding third constraint: x1 + x2 = 8 8 7 Binding edge of first constraint: x1 = 6 s3 = 0 6 s1 = 1 5 Binding second constraint: 2x1 + 3x2 = 19 4 3 2 1 Optimal solution (x1 = 5, x2 = 3) 1 2 3 4 Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 s2 = 0 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs x1 17 Extreme Points Extreme Points BA 452 Lesson A.2 Solving Linear Programs 18 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 19 Extreme Point Solutions x2 Compute the extreme points in Example 1 by solving pairs of binding constraints. 8 7 Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 5 (0, 6 1/3), where 2x1 + 3x2 = 19 and x1 = 0 6 5 4 3 Feasible region 2 1 4 (5, 3), where 2x1 + 3x2 = 19 and x1 + x2 = 8 3 (6, 2), where x1 + x2 = 8 and x1 = 6 2 (6, 0), where x2 = 0 and x1 = 6 1 (0, 0) 1 2 x1 3 4 5 6 7 8 9 10 BA 452 Lesson A.2 Solving Linear Programs 20 Extreme Point Solutions Evaluate the objective function at each of the extreme points in Example 1. Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 1 Extreme point (0, 0) has objective value 5x1 + 7x2 = 0 2 Extreme point (6, 0) has objective value 5x1 + 7x2 = 30 3 Extreme point (6, 2) has objective value 5x1 + 7x2 = 42 4 Extreme point (5, 3) has objective value 5x1 + 7x2 = 46 5 Extreme point (0, 6 1/3) has objective value 5x1 + 7x2 = 44 1/3 Point (5,3) thus maximizes the objective function, with value 46. (Likewise, point (0,0) minimizes.) BA 452 Lesson A.2 Solving Linear Programs 21 Computer Solutions Computer Solutions BA 452 Lesson A.2 Solving Linear Programs 22 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 23 Computer Solutions LP problems involving many variables and constraints are now routinely solved with computer packages. Linear programming solvers are now part of many spreadsheet packages, such as Microsoft Excel. The Management Scientist program has a convenient LP module. In remainder of this lesson we will interpret the following output: • objective function value • values of the decision variables • slack and surplus 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 • the right-hand side value of a constraint BA 452 Lesson A.2 Solving Linear Programs 24 Computer Solutions To use The Management Scientist 6.0 program, select New under the File menu. BA 452 Lesson A.2 Solving Linear Programs Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 25 Computer Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Decision Variable Names can be changed, if desired. Enter objective function coefficients in the Objective Function portion of the input screen. In the Constraints section, enter constraint coefficients, constraint relationship (<, =,>), where < abbreviates <, and > abbreviates >. And enter the constraint right-hand-side constants. Do not enter non-negativity constraints. They are assumed. BA 452 Lesson A.2 Solving Linear Programs 26 Computer Solutions Example 1: Max 5x1 + 7x2 s.t. x1 < 6 2x1 + 3x2 < 19 x1 + x2 < 8 x1 > 0 and x2 > 0 Under the Solution menu, select Solve for the Optimal Solution. Maximized objective function value = 46 Optimal x1 = 5 and x2 = 3 BA 452 Lesson A.2 Solving Linear Programs 27 Resource Allocation with Sales Maximums Resource Allocation with Sales Maximums BA 452 Lesson A.2 Solving Linear Programs 28 Resource Allocation with Sales Maximums 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 BA 452 Lesson A.2 Solving Linear Programs 29 Resource Allocation with Sales Maximums Question: The Monet Company produces four type of picture frames: 1, 2, 3, 4. The four types differ in size, shape and materials used. 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 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 4 uses 2 hours of labor, 2 ounces of metal, 2 ounces of glass, and sells for $21.50. BA 452 Lesson A.2 Solving Linear Programs 30 Resource Allocation with Sales Maximums Each week, Monet can buy up to 4000 hours of skilled labor and 10,000 ounces of glass. The unit costs are $8.00 per labor hour, $0.50 per ounce of metal, and $0.75 per ounce of glass. Market constraints are such that it is impossible to sell more than: • 1000 type 1 frames, • 2000 type 2 frames, • 500 type 3 frames, • 1000 type 4 frames. How can Monet maximize its weekly profit? BA 452 Lesson A.2 Solving Linear Programs 31 Resource Allocation with Sales Maximums Answer: First, compute unit profit for each type of frame: Frame 1: Unit profit = Sales price – input costs = 28.5 – 2x8 – 4x.5 – 6x.75 = 28.5 – 16 – 2 – 4.5 = $6.00 Frame 2: Unit profit = 12.5 – 1x8 – 2x.5 – 2x.75 = 12.5 – 8 – 1 – 1.5 = $2.00 Frame 3: Unit profit = 29.25 – 3x8 – 1x.5 – 1x.75 = 29.25 – 24 – .5 – .75 = $4.00 Frame 4: Unit profit = 21.5 – 2x8 – 2x.5 – 2x.75 = 21.5 – 16 – 1 – 1.5 = $3.00 BA 452 Lesson A.2 Solving Linear Programs 32 Resource Allocation with Sales Maximums Let xi be weekly sales of frames of type i (i = 1, 2, 3, 4). Maximize subject to 6x1 + 2x2 + 4x3 + 3x4 (profit objective) 2x1 + x2 + 3x3 + 2x4 4000 (labor constraint) 6x1 + 2x2 + x3 + 2x4 10,000 (glass constraint) x1 1000 (frame 1 sales constraint) x2 2000 (frame 2 sales constraint) x3 500 (frame 3 sales constraint) x4 1000 (frame 4 sales constraint) x1, x2, x3, x4 0 (nonnegativity constraints) 6x1 = Profit from frames of type 1 2x1 = Labor used in frames of type 1 4x1 = Glass used in frames of type 1 BA 452 Lesson A.2 Solving Linear Programs 33 Resource Allocation with Sales Maximums Maximize 6x1 + 2x2 + 4x3 + 3x4 subject to 2x1 + x2 + 3x3 + 2x4 4000 6x1 + 2x2 + x3 + 2x4 10,000 x1 1000 x2 2000 x3 500 x4 1000 x 1, x 2, x 3, x 4 0 BA 452 Lesson A.2 Solving Linear Programs 34 Resource Allocation with Sales Maximums Maximize 6x1 + 2x2 + 4x3 + 3x4 subject to 2x1 + x2 + 3x3 + 2x4 4000 6x1 + 2x2 + x3 + 2x4 10,000 x1 1000 x2 2000 x3 500 x4 1000 x 1, x 2, x 3, x 4 0 BA 452 Lesson A.2 Solving Linear Programs 35 Resource Allocation with Sales Maximums Maximize 6x1 + 2x2 + 4x3 + 3x4 subject to 2x1 + x2 + 3x3 + 2x4 4000 6x1 + 2x2 + x3 + 2x4 10,000 x1 1000 x2 2000 x3 500 x4 1000 x 1, x 2, x 3, x 4 0 Maximum weekly profit of $10,000. Xi is optimal weekly sales of frames of type i (i = 1, 2, 3, 4). BA 452 Lesson A.2 Solving Linear Programs 36 BA 452 Quantitative Analysis End of Lesson A.2 BA 452 Lesson A.2 Solving Linear Programs 37