BUS 304 OPERATIONS RESEARCH Applications of LP, Network, IP, NLP Applications of Decision A. and Project M. Inventory Modeling Queueing Analysis Markov Processes Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-1 Introduction to Optimization and Linear Programming Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-2 Applications of Mathematical Optimization Determining Product Mix Manufacturing Routing and Logistics Financial Planning Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-3 Characteristics of Optimization Problems Decisions Variables Constraints Objectives Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-4 General Form of a Linear Programming (LP) Problem MAX (or MIN): c1X1 + c2X2 + … + cnXn Subject to: a11X1 + a12X2 + … + a1nXn <= b1 : ak1X1 + ak2X2 + … + aknXn >=bk : am1X1 + am2X2 + … + amnXn = bm Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-5 An Example LP Problem Blue Ridge Hot Tubs produces two types of hot tubs: Aqua-Spas & Hydro-Luxes. Pumps Labor Tubing Unit Profit Aqua-Spa 1 9 hours 12 feet $350 Hydro-Lux 1 6 hours 16 feet $300 There are 200 pumps, 1566 hours of labor, and 2880 feet of tubing available. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-6 5 Steps In Formulating LP Models: 1. Understand the problem. 2. Identify the decision variables. X1=number of Aqua-Spas to produce X2=number of Hydro-Luxes to produce 3. State the objective function as a linear combination of the decision variables. MAX: 350X1 + 300X2 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-7 5 Steps In Formulating LP Models (continued) 4. State the constraints as linear combinations of the decision variables. 1X1 + 1X2 <= 200 } pumps 9X1 + 6X2 <= 1566 } labor 12X1 + 16X2 <= 2880 } tubing 5. Identify any upper or lower bounds on the decision variables. X1 >= 0 X2 >= 0 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-8 Summary of the LP Model for Blue Ridge Hot Tubs MAX: 350X1 + 300X2 S.T.: 1X1 + 1X2 <= 200 9X1 + 6X2 <= 1566 12X1 + 16X2 <= 2880 X1 >= 0 X2 >= 0 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-9 Solving LP Problems: An Intuitive Approach Idea: Each Aqua-Spa (X1) generates the highest unit profit ($350), so let’s make as many of them as possible! How many would that be? – Let X2 = 0 1st constraint: 1X1 <= 200 2nd constraint: 9X1 <=1566 or X1 <=174 3rd constraint: 12X1 <= 2880 or X1 <= 240 If X2=0, the maximum value of X1 is 174 and the total profit is $350*174 + $300*0 = $60,900 This solution is feasible, but is it optimal? No! Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-10 Solving LP Problems: A Graphical Approach The constraints of an LP problem defines its feasible region. The best point in the feasible region is the optimal solution to the problem. For LP problems with 2 variables, it is easy to plot the feasible region and find the optimal solution. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-11 Plotting the First Constraint X2 250 (0, 200) 200 boundary line of pump constraint X1 + X2 = 200 150 100 50 (200, 0) 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-12 Plotting the Second Constraint X2 (0, 261) 250 boundary line of labor constraint 9X1 + 6X2 = 1566 200 150 100 50 (174, 0) 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-13 Plotting the Third Constraint X2 250 (0, 180) 200 150 boundary line of tubing constraint 12X1 + 16X2 = 2880 100 Feasible Region 50 (240, 0) 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-14 Plotting A Level Curve of the Objective Function X2 250 200 (0, 116.67) objective function 150 350X1 + 300X2 = 35000 100 (100, 0) 50 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-15 A Second Level Curve of the Objective Function X2 250 (0, 175) 200 objective function 350X1 + 300X2 = 35000 objective function 350X1 + 300X2 = 52500 150 100 (150, 0) 50 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-16 Using A Level Curve to Locate the Optimal Solution X2 250 objective function 350X1 + 300X2 = 35000 200 150 optimal solution 100 objective function 350X1 + 300X2 = 52500 50 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-17 Calculating the Optimal Solution The optimal solution occurs where the “pumps” and “labor” constraints intersect. This occurs where: X1 + X2 = 200 (1) and 9X1 + 6X2 = 1566 (2) From (1) we have, X2 = 200 -X1 (3) Substituting (3) for X2 in (2) we have, 9X1 + 6 (200 -X1) = 1566 which reduces to X1 = 122 So the optimal solution is, X1=122, X2=200-X1=78 Total Profit = $350*122 + $300*78 = $66,100 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-18 Enumerating The Corner Points X2 250 obj. value = $54,000 (0, 180) 200 obj. value = $64,000 150 (80, 120) obj. value = $66,100 (122, 78) 100 50 obj. value = $60,900 (174, 0) obj. value = $0 (0, 0) 0 0 50 100 150 200 250 X1 Note: This technique will not work if the solution is unbounded.2-19 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. Example of Alternate Optimal Solutions X2 250 objective function level curve 450X1 + 300X2 = 78300 200 150 100 alternate optimal solutions 50 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-20 Example of a Redundant Constraint X2 250 boundary line of tubing constraint 200 boundary line of pump constraint 150 boundary line of labor constraint 100 Feasible Region 50 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-21 Example of an Unbounded Solution X2 1000 objective function X1 + X2 = 600 800 -X1 + 2X2 = 400 objective function X1 + X2 = 800 600 400 200 X1 + X2 = 400 0 0 200 400 600 800 1000 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-22 X2 Example of Infeasibility 250 200 X1 + X2 = 200 feasible region for second constraint 150 100 feasible region for first constraint 50 X1 + X2 = 150 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-23 Modeling and Solving LP Problems in a Spreadsheet Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-24 Introduction Solving LP problems graphically is only possible when there are two decision variables Few real-world LP have only two decision variables Fortunately, we can now use spreadsheets to solve LP problems Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-25 Spreadsheet Solvers The company that makes the Solver in Excel, Lotus 1-2-3, and Quattro Pro is Frontline Systems, Inc. Check out their web site: http://www.frontsys.com Other packages for solving MP problems: AMPL CPLEX LINDO MPSX Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-26 The Steps in Implementing an LP Model in a Spreadsheet 1. Organize the data for the model on the spreadsheet. 2. Reserve separate cells in the spreadsheet to represent each decision variable in the model. 3. Create a formula in a cell in the spreadsheet that corresponds to the objective function. 4. For each constraint, create a formula in a separate cell in the spreadsheet that corresponds to the lefthand side (LHS) of the constraint. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-27 Let’s Implement a Model for the Blue Ridge Hot Tubs Example... MAX: 350X1 + 300X2 S.T.: 1X1 + 1X2 <= 200 9X1 + 6X2 <= 1566 12X1 + 16X2 <= 2880 X1, X2 >= 0 } profit } pumps } labor } tubing } nonnegativity Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-28 Implementing the Model See file Fig3-1.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-29 How Solver Views the Model Target cell - the cell in the spreadsheet that represents the objective function Changing cells - the cells in the spreadsheet representing the decision variables Constraint cells - the cells in the spreadsheet representing the LHS formulas on the constraints Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-30 Let’s go back to Excel and see how Solver works... Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-31 Goals For Spreadsheet Design Communication - A spreadsheet's primary business purpose is that of communicating information to managers. Reliability - The output a spreadsheet generates should be correct and consistent. Auditability - A manager should be able to retrace the steps followed to generate the different outputs from the model in order to understand the model and verify results. Modifiability - A well-designed spreadsheet should be easy to change or enhance in order to meet dynamic user requirements. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-32 Spreadsheet Design Guidelines Organize the data, then build the model around the data. Do not embed numeric constants in formulas. Things which are logically related should be physically related. Use formulas that can be copied. Column/rows totals should be close to the columns/rows being totaled. The English-reading eye scans left to right, top to bottom. Use color, shading, borders and protection to distinguish changeable parameters from other model elements. Use text boxes and cell notes to document various elements of the model. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-33 Sensitivity Analysis Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-34 Introduction When solving an LP model we assume that all relevant factors are known with certainty. Such certainty rarely exists. Sensitivity analysis helps answer questions about how sensitive the optimal solution is to changes in various coefficients in an LP model. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-35 General Form of a Linear Programming (LP) Problem MAX (or MIN): c1X1 + c2X2 + … + cnXn Subject to: How a11X1 + a12X2 + … + a1nXn <= b1 : ak1X1 + ak2X2 + … + aknXn <= bk : am1X1 + am2X2 + … + amnXn = bm sensitive is a solution to changes in the ci, aij, and bi? Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-36 Approaches to Sensitivity Analysis Change the data and re-solve the model! – Sometimes this is the only practical approach. Solver also produces sensitivity reports that can answer questions about: – amounts objective function coefficients can change without changing the solution. – the impact on the optimal objective function value of changes in various constrained resources. – the impact on the optimal objective function value of forced changes in certain decision variables. – the impact changes in constraint coefficients will have on the optimal solution. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-37 Once Again, We’ll Use The Blue Ridge Hot Tubs Example... MAX: 350X1 + 300X2 S.T.: 1X1 + 1X2 <= 200 9X1 + 6X2 <= 1566 12X1 + 16X2 <= 2880 X1, X2 >= 0 } profit } pumps } labor } tubing } nonnegativity Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-38 The Answer Report See file Fig4-1.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-39 The Sensitivity Report See file Fig4-1.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-40 X2 How Changes in Objective Coefficients Change the Slope of the Level Curve 250 original level curve 200 new optimal solution 150 original optimal solution 100 new level curve 50 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-41 Changes in Objective Function Coefficients Values in the “Allowable Increase” and “Allowable Decrease” columns for the Changing Cells indicate the amounts by which an objective function coefficient can change without changing the optimal solution, assuming all other coefficients remain constant. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-42 Alternate Optimal Solutions Values of zero (0) in the “Allowable Increase” or “Allowable Decrease” columns for the Changing Cells indicate that an alternate optimal solution exists. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-43 Changes in Constraint RHS Values The shadow price of a constraint indicates the amount by which the objective function value changes given a unit increase in the RHS value of the constraint, assuming all other coefficients remain constant. Shadow prices hold only within RHS changes falling within the values in “Allowable Increase” and “Allowable Decrease” columns. Shadow prices for nonbinding constraints are always zero. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-44 Comments About Changes in Constraint RHS Values Shadow prices only indicate the changes that occur in the objective function value as RHS values change. Changing a RHS value for a binding constraint also changes the feasible region and the optimal solution (see graph on following slide). To find the optimal solution after changing a binding RHS value, you must re-solve the problem. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-45 How Changing the RHS Value of a Constraint Can Change the Feasible Region and Optimal Solution X2 250 Suppose available labor hours increase from 1,566 to 1,728 200 150 old optimal solution old labor constraint 100 new optimal solution 50 new labor constraint 0 0 50 100 150 200 250 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. X1 2-46 Other Uses of Shadow Prices Suppose a new Hot Tub (the Typhoon-Lagoon) is being considered. It generates a marginal profit of $320 and requires: – 1 pump (shadow price = $200) – 8 hours of labor (shadow price = $16.67) – 13 feet of tubing (shadow price = $0) Q: Would it be profitable to produce any? A: $320 - $200*1 - $16.67*8 - $0*13 = -$13.33 = No! Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-47 The Meaning of Reduced Costs The Reduced Cost for each product equals its per-unit marginal profit minus the per-unit value of the resources it consumes (priced at their shadow prices). Type of Problem Optimal Value of Decision Variable Optimal Value of Reduced Cost Maximization at simple lower bound between lower & upper bounds at simple upper bound <=0 =0 >=0 Minimization at simple lower bound between lower & upper bounds at simple upper bound >=0 =0 <=0 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-48 Key Points The shadow prices of resources equate the marginal value of the resources consumed with the marginal benefit of the goods being produced. Resources in excess supply have a shadow price (or marginal value) of zero. The reduced cost of a product is the difference between its marginal profit and the marginal value of the resources it consumes. Products whose marginal profits are less than the marginal value of the goods required for their production will not be produced in an optimal solution. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-49 Analyzing Changes in Constraint Coefficients Q: Suppose a Typhoon-Lagoon required only 7 labor hours rather than 8. Is it now profitable to produce any? A: $320 - $200*1 - $16.67*7 - $0*13 = $3.31 = Yes! Q: What is the maximum amount of labor Typhoon-Lagoons could require and still be profitable? A: We need $320 - $200*1 - $16.67*L3 - $0*13 >=0 The above is true if L3 <= $120/$16.67 = $7.20 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-50 Make vs. Buy Decisions: The Electro-Poly Corporation Electro-Poly is a leading maker of slip-rings. A $750,000 order has just been received. Model 1 Model 2 Model 3 3,000 2,000 900 Hours of wiring/unit 2 1.5 3 Hours of harnessing/unit 1 2 1 Cost to Make $50 $83 $130 Cost to Buy $61 $97 $145 Number ordered The company has 10,000 hours of wiring capacity and 5,000 hours of harnessing capacity. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-51 Defining the Decision Variables M1 = Number of model 1 slip rings to make in-house M2 = Number of model 2 slip rings to make in-house M3 = Number of model 3 slip rings to make in-house B1 = Number of model 1 slip rings to buy from competitor B2 = Number of model 2 slip rings to buy from competitor B3 = Number of model 3 slip rings to buy from competitor Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-52 Defining the Objective Function Minimize the total cost of filling the order. MIN: 50M1 + 83M2 + 130M3 + 61B1 + 97B2 + 145B3 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-53 Defining the Constraints Demand Constraints M1 + B1 = 3,000 } model 1 M2 + B2 = 2,000 } model 2 M3 + B3 = Resource 900 } model 3 Constraints 2M1 + 1.5M2 + 3M3 <= 10,000 } wiring 1M1 + 2.0M2 + 1M3 <= 5,000 } harnessing Nonnegativity Conditions M1, M2, M3, B1, B2, B3 >= 0 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-54 Implementing the Model See file Fig3-17.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-55 An Investment Problem: Retirement Planning Services, Inc. A client wishes to invest $750,000 in the following bonds. Company Return Years to Maturity Acme Chemical 8.65% 11 1-Excellent DynaStar 9.50% 10 3-Good Eagle Vision 10.00% 6 4-Fair Micro Modeling 8.75% 10 1-Excellent OptiPro 9.25% 7 3-Good Sabre Systems 9.00% 13 2-Very Good Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. Rating 2-56 Investment Restrictions No more than 25% can be invested in any single company. At least 50% should be invested in longterm bonds (maturing in 10+ years). No more than 35% can be invested in DynaStar, Eagle Vision, and OptiPro. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-57 Defining the Decision Variables X1 = amount of money to invest in Acme Chemical X2 = amount of money to invest in DynaStar X3 = amount of money to invest in Eagle Vision X4 = amount of money to invest in MicroModeling X5 = amount of money to invest in OptiPro X6 = amount of money to invest in Sabre Systems Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-58 Defining the Objective Function Maximize the total annual investment return. MAX: .0865X1 + .095X2 + .10X3 + .0875X4 + .0925X5 + .09X6 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-59 Defining the Constraints Total amount is invested X1 + X2 + X3 + X4 + X5 + X6 = 750,000 No more than 25% in any one investment Xi <= 187,500, for all i 50% long term investment restriction. X1 + X2 + X4 + X6 >= 375,000 35% Restriction on DynaStar, Eagle Vision, and OptiPro. X2 + X3 + X5 <= 262,500 Nonnegativity conditions Xi >= 0 for all i Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-60 Implementing the Model See file Fig3-20.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-61 A Transportation Problem: Tropicsun Supply Groves Distances (in miles) Capacity 21 Mt. Dora 275,000 Processing Plants 1 Ocala 4 50 200,000 40 35 400,000 30 Eustis Orlando 2 600,000 5 22 55 20 Clermont 300,000 3 Leesburg 25 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 6 225,000 2-62 Defining the Decision Variables Xij = # of bushels shipped from node i to node j Specifically, the nine decision variables are: X14 = # of bushels shipped from Mt. Dora (node 1) to Ocala (node 4) X15 = # of bushels shipped from Mt. Dora (node 1) to Orlando (node 5) X16 = # of bushels shipped from Mt. Dora (node 1) to Leesburg (node 6) X24 = # of bushels shipped from Eustis (node 2) to Ocala (node 4) X25 = # of bushels shipped from Eustis (node 2) to Orlando (node 5) X26 = # of bushels shipped from Eustis (node 2) to Leesburg (node 6) X34 = # of bushels shipped from Clermont (node 3) to Ocala (node 4) X35 = # of bushels shipped from Clermont (node 3) to Orlando (node 5) X36 = # of bushels shipped from Clermont (node 3) to Leesburg (node 6) Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-63 Defining the Objective Function Minimize the total number of bushel-miles. MIN: 21X14 + 50X15 + 40X16 + 35X24 + 30X25 + 22X26 + 55X34 + 20X35 + 25X36 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-64 Defining the Constraints Capacity constraints X14 + X24 + X34 <= 200,000 X15 + X25 + X35 <= 600,000 X16 + X26 + X36 <= 225,000 Supply } Ocala } Orlando } Leesburg constraints X14 + X15 + X16 = 275,000 X24 + X25 + X26 = 400,000 X34 + X35 + X36 = 300,000 } Mt. Dora } Eustis } Clermont Nonnegativity conditions Xij >= 0 for all i and j Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-65 Implementing the Model See file Fig3-24.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-66 A Blending Problem: The Agri-Pro Company Agri-Pro has received an order for 8,000 pounds of chicken feed to be mixed from the following feeds. Percent of Nutrient in Nutrient Feed 1 Feed 2 Feed 3 Feed 4 Corn 30% 5% 20% 10% Grain 10% 3% 15% 10% Minerals 20% 20% 20% 30% Cost per pound $0.25 $0.30 $0.32 $0.15 The order must contain at least 20% corn, 15% grain, and 15% minerals. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-67 Defining the Decision Variables X1 = pounds of feed 1 to use in the mix X2 = pounds of feed 2 to use in the mix X3 = pounds of feed 3 to use in the mix X4 = pounds of feed 4 to use in the mix Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-68 Defining the Objective Function Minimize the total cost of filling the order. MIN: 0.25X1 + 0.30X2 + 0.32X3 + 0.15X4 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-69 Defining the Constraints Produce 8,000 pounds of feed X1 + X2 + X3 + X4 = 8,000 Mix consists of at least 20% corn (0.3X1 + 0.5X2 + 0.2X3 + 0.1X4)/8000 >= 0.2 Mix consists of at least 15% grain (0.1X1 + 0.3X2 + 0.15X3 + 0.1X4)/8000 >= 0.15 Mix consists of at least 15% minerals (0.2X1 + 0.2X2 + 0.2X3 + 0.3X4)/8000 >= 0.15 Nonnegativity conditions X1, X2, X3, X4 >= 0 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-70 A Comment About Scaling Notice that the coefficient for X2 in the ‘corn’ constraint is 0.05/8000 = 0.00000625 As Solver solves our problem, intermediate calculations must be done that make coefficients large or smaller. Storage problems may force the computer to use approximations of the actual numbers. Such ‘scaling’ problems sometimes prevents Solver from being able to solve the problem accurately. Most problems can be formulated in a way to minimize scaling errors... Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-71 Re-Defining the Decision Variables X1 = thousands of pounds of feed 1 to use in the mix X2 = thousands of pounds of feed 2 to use in the mix X3 = thousands of pounds of feed 3 to use in the mix X4 = thousands of pounds of feed 4 to use in the mix Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-72 Re-Defining the Objective Function Minimize the total cost of filling the order. MIN: 250X1 + 300X2 + 320X3 + 150X4 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-73 Re-Defining the Constraints Produce 8,000 pounds of feed X1 + X2 + X3 + X4 = 8 Mix consists of at least 20% corn (0.3X1 + 0.5X2 + 0.2X3 + 0.1X4)/8 >= 0.2 Mix consists of at least 15% grain (0.1X1 + 0.3X2 + 0.15X3 + 0.1X4)/8 >= 0.15 Mix consists of at least 15% minerals (0.2X1 + 0.2X2 + 0.2X3 + 0.3X4)/8 >= 0.15 Nonnegativity conditions X1, X2, X3, X4 >= 0 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-74 A Comment About Scaling Earlier the largest coefficient in the constraints was 8,000 and the smallest is 0.05/8 = 0.00000625. Now the largest coefficient in the constraints is 8 and the smallest is 0.05/8 = 0.00625. The problem is now more evenly scaled. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-75 The Assume Linear Model Option The Solver Options dialog box has an option labeled “Assume Linear Model”. When you select this option Solver performs some tests to verify that your model is in fact linear. These test are not 100% accurate & often fail as a result of a poorly scaled model. If Solver tells you a model isn’t linear when you know it is, try solving it again. If that doesn’t work, try re-scaling your model. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-76 Implementing the Model See file Fig3-33.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-77 A Production Planning Problem: The Upton Corporation Upton is planning the production of their heavy-duty air compressors for the next 6 months. Month 1 2 3 4 5 6 Unit Production Cost $240 $250 $265 $285 $280 $260 Units Demanded 1,000 4,500 6,000 5,500 3,500 4,000 Maximum Production 4,000 3,500 4,000 4,500 4,000 3,500 Minimum Production 1,750 2,000 2,250 2,000 1,750 2,000 Beginning inventory = 2,750 units Safety stock = 1,500 units Unit carrying cost = 1.5% of unit production cost Maximum warehouse capacity = 6,000 units Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-78 Defining the Decision Variables Pi = number of units to produce in month i, i=1 to 6 Bi = beginning inventory month i, i=1 to 6 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-79 Defining the Objective Function Minimize the total cost production & inventory costs. MIN: 240P1+ 250P2 + 265P3 + 285P4 + 280P5 + 260P6 + 3.6(B1+B2)/2 + 3.75(B2+B3)/2 + 3.98(B3+B4)/2 + 4.28(B4+B5)/2 + 4.20(B5+ B6)/2 + 3.9(B6+B7)/2 Note: The beginning inventory in any month is the same as the ending inventory in the previous month. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-80 Defining the Constraints Production levels 2,000 <= P1 <= 4,000 } month 1 1,750 <= P2 <= 3,500 } month 2 2,000 <= P3 <= 4,000 } month 3 2,250 <= P4 <= 4,500 } month 4 2,000 <= P5 <= 4,000 } month 5 1,750 <= P6 <= 3,500 } month 6 Ending Inventory (EI = BI + P - D) 1,500 <= 1,500 <= 1,500 <= 1,500 <= 1,500 <= 1,500 <= B1 + P1 - 1,000 <= 6,000 B2 + P2 - 4,500 <= 6,000 B3 + P3 - 6,000 <= 6,000 B4 + P4 - 5,500 <= 6,000 B5 + P5 - 3,500 <= 6,000 B6 + P6 - 4,000 <= 6,000 } month 1 } month 2 } month 3 } month 4 } month 5 } month 6 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-81 Defining the Constraints Beginning (cont’d) Balances B1 = 2750 B2 = B1 + P1 - 1,000 B3 = B2 + P2 - 4,500 B4 = B3 + P3 - 6,000 B5 = B4 + P4 - 5,500 B6 = B5 + P5 - 3,500 B7 = B6 + P6 - 4,000 Notice that the Bi can be computed directly from the Pi. Therefore, only the Pi need to be identified as changing cells. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-82 Implementing the Model See file Fig3-31.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-83 A Multi-Period Cash Flow Problem: The Taco-Viva Sinking Fund - I Taco-Viva needs to establish a sinking fund to pay $800,000 in building costs for a new restaurant in the next 6 months. Payments of $250,000 are due at the end of months 2 and 4, and a final payment of $300,000 is due at the end of month 6. The following investments may be used. Investment A B C D Available in Month Months to Maturity Yield at Maturity 1, 2, 3, 4, 5, 6 1 1.8% 1, 3, 5 2 3.5% 1, 4 3 5.8% 1 6 11.0% Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-84 Summary of Possible Cash Flows Cash Inflow/Outflow at the Beginning of Month Investment 1 2 3 4 5 6 7 A1 -1 1.018 B1 -1 <_____> 1.035 C1 -1 <_____> <_____> 1.058 D1 -1 <_____> <_____> <_____> <_____> <_____> 1.11 A2 -1 1.018 A3 -1 1.018 B3 -1 <_____> 1.035 A4 -1 1.018 C4 -1 <_____> <_____> 1.058 A5 -1 1.018 B5 -1 <_____> 1.035 A6 -1 1.018 Req’d Payments $0 $0 $250 $0 $250 $0 $300 (in $1,000s) Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-85 Defining the Decision Variables Ai = amount (in $1,000s) placed in investment A at the beginning of month i=1, 2, 3, 4, 5, 6 Bi = amount (in $1,000s) placed in investment B at the beginning of month i=1, 3, 5 Ci = amount (in $1,000s) placed in investment C at the beginning of month i=1, 4 Di = amount (in $1,000s) placed in investment D at the beginning of month i=1 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-86 Defining the Objective Function Minimize the total cash invested in month 1. MIN: A1 + B1 + C1 + D1 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-87 Defining the Constraints Cash Flow Constraints 1.018A1 – 1A2 = 0 1.035B1 + 1.018A2 – 1A3 – 1B3 = 250 1.058C1 + 1.018A3 – 1A4 – 1C4 = 0 1.035B3 + 1.018A4 – 1A5 – 1B5 = 250 1.018A5 –1A6 = 0 1.11D1 + 1.058C4 + 1.035B5 + 1.018A6 = 300 Nonnegativity } month 2 } month 3 } month 4 } month 5 } month 6 } month 7 Conditions Ai, Bi, Ci, Di >= 0, for all i Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-88 Implementing the Model See file Fig3-35.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-89 Network Modeling Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-90 Introduction A number of business problems can be represented graphically as networks. This chapter focuses on several types of network flow problems: – – – – – Transshipment Problems Shortest Path Problems Maximal Flow Problems Transportation/Assignment Problems Generalized Network Flow Problems We also consider a different type of network problem called the Minimum Spanning Tree Problem Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-91 Characteristics of Network Flow Problems Network flow problems can be represented as a collection of nodes connected by arcs. There are three types of nodes: – Supply – Demand – Transshipment We’ll use negative numbers to represent supplies and positive numbers to represent demand. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-92 A Transshipment Problem: The Bavarian Motor Company +100 Boston 2 $50 +60 $30 Newark 1 -200 Columbus $40 3 $40 $35 +170 $30 Atlanta 5 Richmond +80 4 $25 $45 $35 +70 Mobile 6 $50 $50 J'ville 7 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. -300 2-93 Defining the Decision Variables For each arc in a network flow model we define a decision variable as: Xij = the amount being shipped (or flowing) from node i to node j For example, X12 = the number of cars shipped from node 1 (Newark) to node 2 (Boston) X56 = the number of cars shipped from node 5 (Atlanta) to node 6 (Mobile) Note: The number of arcs determine the number of variables in a network flow problem! Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-94 Defining the Objective Function Minimize total shipping costs. MIN: 30X12 + 40X14 + 50X23 + 35X35 +40X53 + 30X54 + 35X56 + 25X65 + 50X74 + 45X75 + 50X76 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-95 Constraints for Network Flow Problems: The Balance-of-Flow Rules For Minimum Cost Network Flow Problems Where: Total Supply > Total Demand Apply This Balance-of-Flow Rule At Each Node: Inflow-Outflow >= Supply or Demand Total Supply < Total Demand Inflow-Outflow <=Supply or Demand Total Supply = Total Demand Inflow-Outflow = Supply or Demand Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-96 Defining the Constraints In the BMC problem: Total Supply = 500 cars Total Demand = 480 cars So for each node we need a constraint of the form: Inflow - Outflow >= Supply or Demand Constraint for node 1: –X12 – X14 >= -200 This (there is no inflow for node 1!) is equivalent to: +X12 + X14 <= 200 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-97 Defining the Constraints Flow constraints –X12 – X14 >= –200 +X12 – X23 >= +100 +X23 + X53 – X35 >= +60 + X14 + X54 + X74 >= +80 + X35 + X65 + X75 – X53 – X54 – X56 >= +170 + X56 + X76 – X65 >= +70 –X74 – X75 – X76 >= –300 } node 1 } node 2 } node 3 } node 4 } node 5 } node 6 } node 7 Nonnegativity conditions Xij >= 0 for all ij Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-98 Implementing the Model See file Fig5-2.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-99 Optimal Solution to the BMC Problem +100 Boston 2 $50 Newark 1 120 20 +60 $30 Columbus 80 3 -200 $40 $40 40 +170 Richmond +80 4 Atlanta 5 $45 +70 Mobile 6 210 70 $50 J'ville 7 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. -300 2-100 Generalized Network Flow Problems In some problems, a gain or loss occurs in flows over arcs. – Examples Oil or gas shipped through a leaky pipeline Imperfections in raw materials entering a production process Spoilage of food items during transit Theft during transit Interest or dividends on investments These problems require some modeling changes. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-101 Coal Bank Hollow Recycling Recycling Process 1 Recycling Process 2 Material Cost Newspaper $13 Mixed Paper $11 White Office Paper $9 Cardboard $13 Pulp Source Recycling Process 1 Recycling Process 2 Demand Yield 90% 80% 95% 75% Cost $12 $13 $10 $14 Yield 85% 85% 90% 85% Supply 70 tons 50 tons 30 tons 40 tons Newsprint Packaging Paper Print Stock Cost Yield $5 95% $6 90% 60 tons Cost Yield $6 90% $8 95% 40 tons Cost Yield $8 90% $7 95% 50 tons Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-102 Network for Recycling Problem -70 Newspaper $13 1 $12 -50 Mixed paper 2 -30 White office paper 3 $11 80% 5 75% $9 85% 4 +60 7 90% $8 90% 95% Packing paper pulp +40 8 $6 $10 $13 Cardboard Newsprint pulp $6 85% 90% Recycling Process 2 6 -40 $5 Recycling Process 1 95% $13 95% +0 90% $8 90% $7 85% +0 95% Print stock pulp 9 $14 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-103 +50 Defining the Objective Function Minimize total cost. MIN: 13X15 + 12X16 + 11X25 + 13X26 + 9X35+ 10X36 + 13X45 + 14X46 + 5X57 + 6X58 + 8X59 + 6X67 + 8X68 + 7X69 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-104 Defining the Constraints Raw Materials -X15 -X16 >= -70 -X25 -X26 >= -50 -X35 -X36 >= -30 -X45 -X46 >= -40 } node 1 } node 2 } node 3 } node 4 Recycling Processes +0.9X15 +0.8X25 +0.95X35 +0.75X45 -X57 -X58 -X59 >= 0 } node 5 +0.85X16 +0.85X26 +0.9X36 +0.85X46 -X67 -X68 -X69 >= 0 } node 6 Paper Pulp +0.95X57 +0.90X67 >= 60 } node 7 +0.90X57 +0.95X67 >= 40 } node 8 +0.90X57 +0.95X67 >= 50 } node 9 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-105 Implementing the Model See file Fig5-17.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-106 Integer Linear Programming Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-107 An Employee Scheduling Problem: Air-Express Day of Week Sunday Workers Needed 18 Shift Days Off 1 Sun & Mon Wage $680 Monday 27 2 Mon & Tue $705 Tuesday 22 3 Tue & Wed $705 Wednesday 26 4 Wed & Thr $705 Thursday 25 5 Thr & Fri $705 Friday 21 6 Fri & Sat $680 Saturday 19 7 Sat & Sun $655 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-108 Defining the Decision Variables X1 = the number of workers assigned to shift 1 X2 = the number of workers assigned to shift 2 X3 = the number of workers assigned to shift 3 X4 = the number of workers assigned to shift 4 X5 = the number of workers assigned to shift 5 X6 = the number of workers assigned to shift 6 X7 = the number of workers assigned to shift 7 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-109 Defining the Objective Function Minimize the total wage expense. MIN: 680X1 +705X2 +705X3 +705X4 +705X5 +680X6 +655X7 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-110 Defining the Constraints Workers required each day 0X1 + 1X2 + 1X3 + 1X4 + 1X5 + 1X6 + 0X7 0X1 + 0X2 + 1X3 + 1X4 + 1X5 + 1X6 + 1X7 1X1 + 0X2 + 0X3 + 1X4 + 1X5 + 1X6 + 1X7 1X1 + 1X2 + 0X3 + 0X4 + 1X5 + 1X6 + 1X7 1X1 + 1X2 + 1X3 + 0X4 + 0X5 + 1X6 + 1X7 1X1 + 1X2 + 1X3 + 1X4 + 0X5 + 0X6 + 1X7 1X1 + 1X2 + 1X3 + 1X4 + 1X5 + 0X6 + 0X7 Nonnegativity >= 18 >= 27 >= 22 >= 26 >= 25 >= 21 >= 19 } Sunday } Monday }Tuesday } Weds. } Thurs. } Friday } Saturday & integrality conditions Xi >= 0 and integer for all i Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-111 Implementing the Model See file Fig6-14.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-112 Binary Variables Binary variables are integer variables that can assume only two values: 0 or 1. These variables can be useful in a number of practical modeling situations…. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-113 A Capital Budgeting Problem: CRT Technologies Expected NPV Capital (in $000s) Required in Project (in $000s) Year 1 Year 2 Year 3 Year 4 Year 5 1 $141 $75 $25 $20 $15 $10 2 $187 $90 $35 $0 $0 $30 3 $121 $60 $15 $15 $15 $15 4 $83 $30 $20 $10 $5 $5 5 $265 $100 $25 $20 $20 $20 6 $127 $50 $20 $10 $30 $40 The company currently has $250,000 available to invest in new projects. It has budgeted $75,000 for continued support for these projects in year 2 and $50,000 per year for years 3, 4, and 5. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-114 Defining the Decision Variables 1, if project i is selected X i 1,2,...,6 i 0, otherwise Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-115 Defining the Objective Function Maximize the total NPV of selected projects. MAX: 141X1 + 187X2 + 121X3 + 83X4 + 265X5 + 127X6 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-116 Defining the Constraints Capital Constraints 75X1 + 90X2 + 60X3 + 30X4 + 100X5 + 50X6 <= 250 } year 1 25X1 + 35x2 + 15X3 + 20X4 + 25X5 + 20X6 <= 75 } year 2 20X1 + 0x2 + 15X3 + 10X4 + 20X5 + 10X6 <= 50 } year 3 15X1 + 0X2 + 15X3 + 5X4 + 20X5 + 30X6 <= 50 } year 4 10X1 + 30X2 + 15X3 + 5X4 + 20X5 + 40X6 <= 50 } year 5 Binary Constraints All Xi must be binary Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-117 Implementing the Model See file Fig6-17.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-118 Binary Variables & Logical Conditions Binary variables are also useful in modeling a number of logical conditions. – Of projects 1, 3 & 6, no more than one may be selected X1 + X3 + X6 <= 1 – Of projects 1, 3 & 6, exactly one must be selected X1 + X3 + X6 = 1 – Project 4 cannot be selected unless project 5 is also selected X4 – X5 <= 0 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-119 The Fixed-Charge Problem Many decisions result in a fixed or lump-sum cost being incurred: The cost to lease, rent, or purchase a piece of equipment or a vehicle that will be required if a particular action is taken. The setup cost required to prepare a machine or production line to produce a different type of product. The cost to construct a new production line or facility that will be required if a particular decision is made. The cost of hiring additional personnel that will be required if a particular decision is made. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-120 Example Fixed-Charge Problem : Remington Manufacturing Operation Machining Grinding Assembly Unit Profit Setup Cost Hours Required By: Prod. 1 Prod. 2 Prod. 3 2 3 6 6 3 4 5 6 2 $48 $55 $50 $1000 $800 $900 Hours Available 600 300 400 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-121 Defining the Decision Variables Xi = the amount of product i to be produced, i = 1, 2, 3 1, if Xi 0 Y i = 1, 2, 3 0, if X 0 i i Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-122 Defining the Objective Function Maximize total profit. MAX: 48X1 + 55X2 + 50X3 – 1000Y1 – 800Y2 – 900Y3 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-123 Defining the Constraints Resource Constraints 2X1 + 3X2 + 6X3 <= 600 } machining 6X1 + 3X2 + 4X3 <= 300 } grinding 5X1 + 6X2 + 2X3 <= 400 } assembly Binary Constraints All Yi must be binary Nonnegativity conditions Xi >= 0, i = 1, 2, ..., 6 Is there a missing link? Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-124 Defining the Constraints (cont’d) Linking Constraints (with “Big M”) X1 <= M1Y1 or X1 - M1Y1 <= 0 X2 <= M2Y2 or X2 - M2Y2 <= 0 X3 <= M3Y3 or X3 - M3Y3 <= 0 If Xi > 0 these constraints force the associated Yi to equal 1. If Xi = 0 these constraints allow Yi to equal 0 or 1, but the objective will cause Solver to choose 0. Note that Mi imposes an upper bounds on Xi. It helps to find reasonable values for the Mi. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-125 Finding Reasonable Values for M1 Consider the resource constraints 2X1 + 3X2 + 6X3 <= 600 } machining 6X1 + 3X2 + 4X3 <= 300 } grinding 5X1 + 6X2 + 2X3 <= 400 } assembly What is the maximum value X1 can assume? Let X2 = X3 = 0 X1 = MIN(600/2, 300/6, 400/5) = MIN(300, 50, 80) = 50 Maximum values for X2 & X3 can be found similarly. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-126 Summary of the Model MAX: 48X1 + 55X2 + 50X3 - 1000Y1 - 800Y2 - 900Y3 Subject to: 2X1 + 3X2 + 6X3 <= 600 } machining 6X1 + 3X2 + 4X3 <= 300 } grinding 5X1 + 6X2 + 2X3 <= 400 } assembly X1 - 50Y1 <= 0 X2 - 67Y2 <= 0 linking X3 - 75Y3 <= 0 All Yi must be binary Xi >= 0, i = 1, 2, 3 } Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-127 Potential Pitfall Do not use IF( ) functions to model the relationship between the Xi and Yi. – Suppose cell A5 represents X1 – Suppose cell A6 represents Y1 – You’ll want to let A6 = IF(A5>0,1,0) – This will not work with Solver! Treat the Yi just like any other variable. – Make them changing cells. – Use the linking constraints to enforce the proper relationship between the Xi and Yi. Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-128 Implementing the Model See file Fig6-21.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-129 Nonlinear Programming Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-130 The Portfolio Optimization Problem A financial planner wants to create the least risky portfolio with at least a 12% expected return using the following stocks. Annual Return Year IBC NMC NBS 1 11.2% 8.0% 10.9% 2 10.8% 9.2% 22.0% 3 11.6% 6.6% 37.9% 4 -1.6% 18.5% -11.8% 5 -4.1% 7.4% 12.9% 6 8.6% 13.0% -7.5% 7 6.8% 22.0% 9.3% 8 11.9% 14.0% 48.7% 9 12.0% 20.5% -1.9% 10 8.3% 14.0% 19.1% 11 6.0% 19.0% -3.4% 12 10.2% 9.0% 43.0% Avg 7.64% 13.43% 14.93% IBC NMC NBS Covariance Matrix IBC NMC NBS 0.00258 -0.00025 0.00440 -0.00025 0.00276 -0.00542 0.00440 -0.00542 0.03677 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-131 Defining the Decision Variables p1 = proportion of funds invested in IBC p2 = proportion of funds invested in NMC p3 = proportion of funds invested in NBS Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-132 Defining the Objective Minimize the portfolio variance (risk). n 1 n MIN: i =1 2 2 p i i 2 n i 1 j i 1 pp ij i j i2 the variance on investment i ij ji = the covariance between investments i and j Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-133 Defining the Constraints Expected return 0.0764 p1 + 0.1343 p2 + 0.1493 p3 >= 0.12 Proportions p1 + p2 + p3 = 1 p1, p2, p3 >= 0 p1, p2, p3 <= 1 Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-134 Implementing the Model See file Fig8-26.xls Spreadsheet Modeling and Decision Analysis, 3e, by Cliff Ragsdale. © 2001 South-Western/Thomson Learning. 2-135