Linear Programming: Basic Concepts
Table of Contents Three Classic Applications of LP The Wyndor Glass Company Product Mix Problem Formulating the Wyndor Problem on a Spreadsheet The Algebraic Model for Wyndor The Graphical Method Applied to the Wyndor Problem Using the Excel Solver with the Wyndor Problem A Minimization Example The Profit & Gambit Co. Introduction to Linear Programming The Graphical Method and Properties of LP Solutions 2
Three Classic Applications of LP Product Mix at Ponderosa Industrial Considered limited resources, and determined optimal mix of plywood products. Increased overall profitability of company by 20%. Personnel Scheduling at United Airlines Designed work schedules for all employees at a location to meet service requirements most efficiently. Saved $ million annually. Planning Supply, Distribution, and Marketing at Citgo Petroleum Corporation The SDM system uses LP to coordinate the supply, distribution, and marketing of each of Citgo s major products throughout the United States. The resulting reduction in inventory added $1 million annually to Citgo s profits. 3
Wyndor Glass Co. Product Mix Problem Wyndor has developed the following new products: An -foot glass door with aluminum framing. A -foot by -foot double-hung, wood-framed window. The company has three plants Plant 1 produces aluminum frames and hardware. Plant 2 produces wood frames. Plant 3 produces glass and assembles the windows and doors. Questions: 1. Should they go ahead with launching these two new products? 2. If so, what should be the product mix?
Algebraic Model for Wyndor Glass Co. Let D = the number of doors to produce W = the number of windows to produce Maximize P = $300D + $500W subject to D 2W 12 3D + 2W 1 and D 0, W 0. 5
Graphing the Product Mix W Production rate (units per week) for windows 7 5 3 2 A product mix of D = and W = (, ) A product mix of D = 2 and W = 3 (2, 3) 1 Origin -2-1 0 1 2 3 5 7 Production rate (units per week) for doors -1 D -2
Graph Showing Constraints: D 0 and W 0 W 2 Production rate for windows 0 2 Production rate for doors D 7
Nonnegative Solutions Permitted by D W D = 2 Production rate for windows 0 2 D Production rate for doors
Nonnegative Solutions Permitted by 2W 12 Production rate for windows W 2 W = 12 2 0 2 Production rate for doors D 9
Boundary Line for Constraint 3D + 2W 1 Production rate for windows W (0, 9) (1, 7 1_ ) 2 (2, ) 3 D + 2 W = 1 (3, 1_ ) 2 (, 3) 2 (5, 1 1_ ) 2 (, 0) 0 2 Production rate for doors D
Changing Right-Hand Side Creates Parallel Constraint Boundary Lines Production rate for windows W 12 3D + 2W = 2 3D + 2W = 1 2 3D + 2W = 12 0 2 Production rate for doors D 11
Nonnegative Solutions Permitted by 3D + 2W 1 Production rate for windows W 3D + 2W = 1 2 0 2 Production rate for doors D 12
Graph of Feasible Region Production rate for windows W 3 D + 2 W = 1 D = 2 W =12 Feasible 2 region 0 2 Production rate for doors D 13
Objective Function (P = 1,500) Production rate for windows W P = 1500 = 300D + 500W Feasible region 2 0 2 Production rate for doors D 1
Finding the Optimal Solution Production rate W for windows P = 300 = 300D + 500W P = 3000 = 300D + 500W Optimal solution (2, ) P = 1500 = 300D + 500W Feasible region 2 0 2 Production rate for doors D 15
Summary of the Graphical Method Draw the constraint boundary line for each constraint. Use the origin (or any point not on the line) to determine which side of the line is permitted by the constraint. Find the feasible region by determining where all constraints are satisfied simultaneously. Determine the slope of one objective function line. All other objective function lines will have the same slope. Move a straight edge with this slope through the feasible region in the direction of improving values of the objective function. Stop at the last instant that the straight edge still passes through a point in the feasible region. This line given by the straight edge is the optimal objective function line. A feasible point on the optimal objective function line is an optimal solution. 1
Developing a Spreadsheet Model Step #1: Data Cells Enter all of the data for the problem on the spreadsheet. Make consistent use of rows and columns. It is a good idea to color code these data cells (e.g., light blue). 3 5 7 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Available Large Bricks 2 1 Small Bricks 2 2 17
Developing a Spreadsheet Model Step #2: Changing Cells Add a cell in the spreadsheet for every decision that needs to be made. If you don t have any particular initial values, just enter 0 in each. It is a good idea to color code these changing cells (e.g., yellow with border). 3 5 7 9 11 12 B C D E F G Doors Windows Unit Profit $300 $500 Hours Available Hours Used Per Unit Produced Plant 1 1 0 1 Plant 2 0 2 12 Plant 3 3 2 1 Doors Windows Units Produced 0 0 1
Developing a Spreadsheet Model Step #3: Target Cell Develop an equation that defines the objective of the model. Typically this equation involves the data cells and the changing cells in order to determine a quantity of interest (e.g., total profit or total cost). It is a good idea to color code this cell (e.g., orange with heavy border). 3 5 7 9 11 12 B C D E F G Doors Windows Unit Profit $300 $500 Hours Available Hours Used Per Unit Produced Plant 1 1 0 1 Plant 2 0 2 12 Plant 3 3 2 1 Doors Windows Total Profit Units Produced 1 1 $00 11 12 G Total Profit =SUMPRODUCT(UnitProfit,UnitsProduced) 19
Developing a Spreadsheet Model Step #: Constraints For any resource that is restricted, calculate the amount of that resource used in a cell on the spreadsheet (an output cell). Define the constraint in three consecutive cells. For example, if Quantity A Quantity B, put these three items (Quantity A,, Quantity B) in consecutive cells. 3 5 7 9 11 12 B C D E F G Doors Windows Unit Profit $300 $500 Hours Hours Hours Used Per Unit Produced Used Available Plant 1 1 0 1 <= 1 Plant 2 0 2 2 <= 12 Plant 3 3 2 5 <= 1 Doors Windows Total Profit Units Produced 1 1 $00 5 7 9 E Hours Used =SUMPRODUCT(C7:D7,UnitsProduced) =SUMPRODUCT(C:D,UnitsProduced) =SUMPRODUCT(C9:D9,UnitsProduced) 20
A Trial Solution 3 5 7 9 11 12 B C D E F G Doors Windows Unit Profit $300 $500 Hours Hours Hours Used Per Unit Produced Used Available Plant 1 1 0 <= 1 Plant 2 0 2 <= 12 Plant 3 3 2 1 <= 1 Doors Windows Total Profit Units Produced 3 $2,700 The spreadsheet for the Wyndor problem with a trial solution ( doors and 3 windows) entered into the changing cells. 21
Identifying the Target Cell and Changing Cells Choose the Solver from the Tools menu. Select the cell you wish to optimize in the Set Target Cell window. Choose Max or Min depending on whether you want to maximize or minimize the target cell. Enter all the changing cells in the By Changing Cells window. 3 5 7 9 11 12 B C D E F G Doors Windows Unit Profit $300 $500 Hours Hours Hours Used Per Unit Produced Used Available Plant 1 1 0 1 <= 1 Plant 2 0 2 2 <= 12 Plant 3 3 2 5 <= 1 Doors Windows Total Profit Units Produced 1 1 $00 22
Adding Constraints To begin entering constraints, click the Add button to the right of the constraints window. Fill in the entries in the resulting Add Constraint dialogue box. 3 5 7 9 11 12 B C D E F G Doors Windows Unit Profit $300 $500 Hours Hours Hours Used Per Unit Produced Used Available Plant 1 1 0 1 <= 1 Plant 2 0 2 2 <= 12 Plant 3 3 2 5 <= 1 Doors Windows Total Profit Units Produced 1 1 $00 23
The Complete Solver Dialogue Box 2
Some Important Options Click on the Options button, and click in both the Assume Linear Model and the Assume Non-Negative box. Assume Linear Model tells the Solver that this is a linear programming model. Assume Non-Negative adds nonnegativity constraints to all the changing cells. 25
The Solver Results Dialogue Box 2
The Optimal Solution 3 5 7 9 11 12 B C D E F G Doors Windows Unit Profit $300 $500 Hours Hours Hours Used Per Unit Produced Used Available Plant 1 1 0 2 <= 1 Plant 2 0 2 12 <= 12 Plant 3 3 2 1 <= 1 Doors Windows Total Profit Units Produced 2 $3,00 27
The Profit & Gambit Co. Management has decided to undertake a major advertising campaign that will focus on the following three key products: A spray prewash stain remover. A liquid laundry detergent. A powder laundry detergent. The campaign will use both television and print media The general goal is to increase sales of these products. Management has set the following goals for the campaign: Sales of the stain remover should increase by at least 3%. Sales of the liquid detergent should increase by at least 1%. Sales of the powder detergent should increase by at least %. Question: how much should they advertise in each medium to meet the sales goals at a minimum total cost? 2
Algebraic Model for Profit & Gambit Let TV = the number of units of advertising on television PM = the number of units of advertising in the print media Minimize Cost = TV + 2PM (in millions of dollars) subject to Stain remover increased sales: PM 3 Liquid detergent increased sales: 3TV + 2PM 1 Powder detergent increased sales: TV + PM and TV 0, PM 0. 29
Applying the Graphical Method Amount of print media advertising PM Feasible region PM = 3 2 -TV + PM = 3 TV + 2 PM = 1 - -2 0 2 Amount of TV advertising TV 30
The Optimal Solution PM Cost = 15 = TV + 2 PM Feasible region Cost = = TV + 2 PM (,3) optimal solution 0 5 15 Amount of TV advertising TV 31
Summary of the Graphical Method Draw the constraint boundary line for each constraint. Use the origin (or any point not on the line) to determine which side of the line is permitted by the constraint. Find the feasible region by determining where all constraints are satisfied simultaneously. Determine the slope of one objective function line. All other objective function lines will have the same slope. Move a straight edge with this slope through the feasible region in the direction of improving values of the objective function. Stop at the last instant that the straight edge still passes through a point in the feasible region. This line given by the straight edge is the optimal objective function line. A feasible point on the optimal objective function line is an optimal solution. 32
Profit & Gambit Co. Spreadsheet Model 3 5 7 9 11 12 13 1 B C D E F G Television Print Media Unit Cost ($millions) 1 2 Increased Minimum Increase in Sales per Unit of Advertising Sales Increase Stain Remover 0% 1% 3% >= 3% Liquid Detergent 3% 2% 1% >= 1% Powder Detergent -1% % % >= % Total Cost Television Print Media ($millions) Advertising Units 3 33
A Production Problem Weekly supply of raw materials: Products: Small Bricks Large Bricks Table Profit = $20 / Table Chair Profit = $15 / Chair 3
Linear Programming Linear programming uses a mathematical model to find the best allocation of scarce resources to various activities so as to maximize profit or minimize cost. Let T = Number of tables to produce C = Number of chairs to produce Maximize Profit = ($20)T + ($15)C subject to 2T + C large bricks 2T + 2C small bricks and T 0, C 0. 35
Graphical Representation Tables 5 3 2 Chairs + 2 Tables = Small Bricks 2 1 Chairs + 2 Tables = Large Bricks 1 2 3 5 Chairs 3
Components of a Linear Program Data Cells Changing Cells ( Decision Variables ) Target Cell ( Objective Function ) Constraints 37
Four Assumptions of Linear Programming Linearity Divisibility Certainty Nonnegativity 3
When is a Spreadsheet Model Linear? All equations (output cells) must be of the form = ax + by + cz + where a, b, c are constants (data cells) and x, y, z are changing cells. Suppose C1:C are changing cells and D1:D are data cells. Which of the following can be part of an LP? SUMPRODUCT(D1:D, C1:C) SUM(C1:C) C1 * SUM(C:C) SUMPRODUCT(C1:C3, C:C) IF(C1 > 3, 2*C3 + C, 3*C3 + C5) IF(D1 > 3, C1, C2) MIN(C1, C2) MIN(D1, D2) * C1 ROUND(C1) 39
Why Use Linear Programming? Linear programs are easy (efficient) to solve The best (optimal) solution is guaranteed to be found (if it exists) Useful sensitivity analysis information is generated Many problems are essentially linear 0
Developing a Spreadsheet Model Step #1: Data Cells Enter all of the data for the problem on the spreadsheet. Make consistent use of rows and columns. It is a good idea to color code these data cells (e.g., light blue). 3 5 7 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Available Large Bricks 2 1 Small Bricks 2 2 1
Developing a Spreadsheet Model Step #2: Changing Cells Add a cell in the spreadsheet for every decision that needs to be made. If you don t have any particular initial values, just enter 0 in each. It is a good idea to color code these changing cells (e.g., yellow with border). 3 5 7 9 11 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Available Large Bricks 2 1 Small Bricks 2 2 Tables Chairs Production Quantity: 0 0 2
Developing a Spreadsheet Model Step #3: Target Cell Develop an equation that defines the objective of the model. Typically this equation involves the data cells and the changing cells in order to determine a quantity of interest (e.g., total profit or total cost). It is a good idea to color code this cell (e.g., orange with heavy border). 3 5 7 9 11 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Available Large Bricks 2 1 Small Bricks 2 2 Tables Chairs Total Profit Production Quantity: 1 0 $20.00 11 Total Profit =SUMPRODUCT(C:D,C11:D11) G 3
Developing a Spreadsheet Model Step #: Constraints For any resource that is restricted, calculate the amount of that resource used in a cell on the spreadsheet (an output cell). Define the constraint in three consecutive cells. For example, if Quantity A Quantity B, put these three items (Quantity A,, Quantity B) in consecutive cells. Note the use of relative and absolute addressing to make it easy to copy formulas in column E. 3 5 7 9 11 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Total Used Available Large Bricks 2 1 3 <= Small Bricks 2 2 <= Tables Chairs Total Profit Production Quantity: 1 1 $35.00 7 E Total Used =SUMPRODUCT(C7:D7,$C$11:$D$11) =SUMPRODUCT(C:D,$C$11:$D$11)
Defining the Target Cell Choose the Solver from the Tools menu. Select the cell you wish to optimize in the Set Target Cell window. Choose Max or Min depending on whether you want to maximize or minimize the target cell. 3 5 7 9 11 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Total Used Available Large Bricks 2 1 3 <= Small Bricks 2 2 <= Tables Chairs Total Profit Production Quantity: 1 1 $35.00 5
Identifying the Changing Cells Enter all the changing cells in the By Changing Cells window. You may either drag the cursor across the cells or type the addresses. If there are multiple sets of changing cells, separate them by typing a comma. 3 5 7 9 11 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Total Used Available Large Bricks 2 1 3 <= Small Bricks 2 2 <= Tables Chairs Total Profit Production Quantity: 1 1 $35.00
Adding Constraints To begin entering constraints, click the Add button to the right of the constraints window. Fill in the entries in the resulting Add Constraint dialogue box. 3 5 7 9 11 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Total Used Available Large Bricks 2 1 3 <= Small Bricks 2 2 <= Tables Chairs Total Profit Production Quantity: 1 1 $35.00 7
Some Important Options Click on the Options button, and click in both the Assume Linear Model and the Assume Non-Negative box. Assume Linear Model tells the Solver that this is a linear programming model. Assume Non-Negative adds nonnegativity constraints to all the changing cells.
The Solution After clicking Solve, you will receive one of four messages: Solver found a solution. All constraints and optimality conditions are satisfied. Set cell values did not converge. Solver could not find a feasible solution. Conditions for Assume Linear Model are not satisfied. 3 5 7 9 11 B C D E F G Tables Chairs Profit $20.00 $15.00 Bill of Materials Total Used Available Large Bricks 2 1 <= Small Bricks 2 2 <= Tables Chairs Total Profit Production Quantity: 2 2 $70.00 9
The Graphical Method for Solving LP s Formulate the problem as a linear program Plot the constraints Identify the feasible region Draw an imaginary line parallel to the objective function (Z = a) Find the optimal solution 50
Example #1 Maximize Z = 3x 1 + 5x 2 subject to x 1 2x 2 12 3x 1 + 2x 2 1 and x 1 0, x 2 0. x 2 9 7 5 3 2 1 1 2 3 5 7 9 x 1 51
Example #2 Minimize Z = 15x 1 + 20x 2 subject to x 1 +2x 2 2x 1 3x 2 x 1 + x 2 and x 1 0, x 2 0. x 2 9 7 5 3 2 1 1 2 3 5 7 9 x 1 52
Example #3 Maximize Z = x 1 + x 2 subject to x 1 +2x 2 = x 1 x 2 0 and x 1 0, x 2 0. x 2 9 7 5 3 2 1 1 2 3 5 7 9 x 1 53
Properties of Linear Programming Solutions An optimal solution must lie on the boundary of the feasible region. There are exactly four possible outcomes of linear programming: A unique optimal solution is found. An infinite number of optimal solutions exist. No feasible solutions exist. The objective function is unbounded (there is no optimal solution). If an LP model has one optimal solution, it must be at a corner point. If an LP model has many optimal solutions, at least two of these optimal solutions are at corner points. 5
Example # (Multiple Optimal Solutions) Minimize Z = x 1 + x 2 subject to x 1 2x 2 12 3x 1 + 2x 2 1 and x 1 0, x 2 0. x 2 9 7 5 3 2 1 1 2 3 5 7 9 x 1 55
Example #5 (No Feasible Solution) Maximize Z = 3x 1 + 5x 2 subject to x 1 5 x 2 3x 1 + 2x 2 1 and x 1 0, x 2 0. x 2 9 7 5 3 2 1 1 2 3 5 7 9 x 1 5
Example # (Unbounded Solution) Maximize Z = 5x 1 + 12x 2 subject to x 1 5 2x 1 x 2 2 and x 1 0, x 2 0. x 2 9 7 5 3 2 1 1 2 3 5 7 9 x 1 57
The Simplex Method Algorithm 1. Start at a feasible corner point (often the origin). 2. Check if adjacent corner points improve the objective function: a) If so, move to adjacent corner and repeat step 2. b)if not, current corner point is optimal. Stop. x 2 9 7 5 3 2 1 1 2 3 5 7 9 x 1 5