DECISION MODELING WITH MICROSOFT EXCEL Chapter 5 LINEAR OPTIMIZATION: APPLICATIONS Part 2 Copyright 2001 Prentice Hall Dynamic Models Single time period models (such as those previously covered) are called static models because time is not a factor other than to define units of measure. Dynamic models (or multiperiod models) are defined for multiple time periods (a more realistic abstraction of reality). Many managerial decision models involve decision making over time in which future decisions are influenced by decisions made in earlier time periods. In this model, each time period will have its own performance measure, unified into a single measure (e.g., Net Present Value). The timing of events must be very precisely defined. Dynamic Models Dynamic Inventory Models Dynamic inventory models (multiperiod inventory models) apply to inventories of materials, cash, employees, etc. carried from one time period to the next. This is a deterministic model because we assume the demand (i.e., number of orders to be satisfied) in each future time period to be known at the beginning of period 1. Dynamic Inventory Models For example, a producer of polyurethane has a stock of orders for the next 6 weeks. di denotes the known demand in gallons for week i di > 0 assumes that returns of orders are not allowed for all i Ci denotes the cost of producing a gallon during week i Ki denotes the maximum amount that can be produced in week i hi denotes the per unit cost of holding inventory in stock at the end of week i I0 initial inventory at the beginning of period 1 (no holding charge is assessed) The goal is to find a production and inventoryholding plan that satisfies the known delivery schedule over the next 6 weeks at a min. total cost. First, develop an expression for the inventory on hand at the end of each period. Let Ii denote the inventory on hand at the end of week i xi gallons of polyurethane produced in week i So, for any week t, the inventory equation is: Inventory at end of week t It = It-1 + xt - dt Production in t Inventory at beginning of t Demand in t Assuming no shrinkage; inventory week t-1 = week t So, for week 1: I1 = I0 + x1 – d1 For week 2: I2 = I1 + x2 – d2 = I0 + x1 – d1 + x2 – d2 2 2 = I0 + Sxi – Sdi i=1 I1 i=1 New Inventory = Old Inventory + Production - Demand For any week t: t It = I0 + S(xi – di ) i=1 It is known as a consequential or definitional variable because it is defined in terms of other decision variables (the xi values) in the model. Note that the condition that demand in a time period t must be satisfied is equivalent to the condition that inventory It at the end of the time period t must be nonnegative (as shown below). Inventory Ki = constraint on production di xi Ii-1 Ii Beginning of week i End of week i Time Verbal Model Minimize production costs + inventory costs Subject to: Inventory at the end of week t > 0 t = 1, 2, 3, …, 6 Production in week t < Kt t = 1, 2, 3, …, 6 Production in week t > 0 t = 1, 2, 3, …, 6 Symbolic Model xt production in week t 6 6 t=1 t=1 Min S Ct xt + S ht It s.t. It = It-1 + xt – dt t = 1, 2, 3, …, 6 xt < Kt xt > 0, It > 0 The cost in time period t is determined by all production decisions in time periods 1 through t as t shown in the following equation: I = I + S(x – d ) t 0 i=1 i i Dynamic Models A Dynamic Inventory Model AutoPower generators are assembled in Singapore from imported parts, tested in Singapore, and exported to AutoPower’s Asian customers needing uninterrupted electric power. The following monthly data are available: Delivery Requirements Production Capacity Jan. Feb. Mar. Apr. 58 36 34 59 60 62 64 66 Unit Production Costs (000s) $28 $27 $27.8 $29 Unit Inventory Holding Cost $300 $300 $300 $300 It is the possibility of holding inventory from one month to the next that makes this model a dynamic inventory model as opposed to a collection of four static models. AutoPower’s goal is to produce and deliver the required number of generators over the 4 month interval at the lowest 4 month cost (the January beginning inventory is 15 generators). Note in the following Excel spreadsheet model: one column is devoted to each time period the ending inventory values are consequential (definitional) variables the beginning inventory is equal to the previous month’s ending inventory Here is the Excel spreadsheet model after Solving: =C6+C8-C9 =C4*(C8+C10)/2 =C10 =C3*C6 Note that any shrinkage can be accommodated by multiplying the ending inventory in a given month by a fraction (e.g., .99) to produce the next month’s beginning inventory (showing a 1% shrinkage). There are two fundamental decisions that must be addressed in every dynamic model: 1. The planning horizon (the overall time interval covered by the model; e.g., 4 months). 2. The number of discrete time epochs to include within that interval (e.g., 1 month intervals within the 4 month horizon). The length of the planning horizon means that the model cannot take into account any production or delivery requirement beyond that length. In choosing the time epochs, note that finer time grids allow more precise measurements of actual movements of inventory, producing more accurate inventory cost tacking within the model. Dynamic Models Note that you can add realism to the model by using finer time grids and longer planning horizons. The temptation to do this is called the “curse of dimensionality.” Adding each new column adds a new dimension to the model in terms of new decision variables, decision and consequential variable linkages across time, and parameters to be considered. Dynamic Models Every dynamic model must also pay attention to what are called “edge conditions.” Edge conditions refer to the set of parameters that must be specified at the beginning and end of time in the model (i.e., the initial and ending inventory). The beginning edge condition is usually not difficult to find. However, the ending edge condition is more troublesome because it must stand as a reasonable starting condition or proxy for all of time beyond the planning horizon (e.g., AutoPower used 7 as the ending inventory). The spreadsheet below shows the Solver results when each month is treated as a separate static month. The resulting production quantity in excess of the required shipments in a month raises total cost. It is for this reason that static models are referred to as myopic because they ignore any consequences of current decisions upon future payoff. Here is the Solver Sensitivity Report for the original dynamic model. Note that the shadow prices appear in the Reduced Cost column, hence, no range information is given for those shadow prices. This Excel Spreadsheet shows the results of making each month’s Beginning Inventory a decision variable instead of a consequential variable. An added constraint specifies that the Beginning Inventory be no more than the previous month’s Ending Inventory. This way of specifying the constraints changes the Sensitivity Report as reflected in the shadow prices and coefficient ranging. Also, modeling inventory as a decision variable isolates the unit costs into separate production coefficients and inventory coefficients, thereby making the objective function coefficients appear as originally specified in the spreadsheet model. Dynamic Models The Dynamic Inventory Model Recasted as a Transportation Model A dynamic model can be modeled as a transportation model with the sources (From) representing decisions in a given time period and the destinations (To) representing one or more time periods affected, either in the current time period or a later one. Unit production cost per month and delivery cost per future month (including holding cost for each additional month). These cells contain huge costs, forcing Solver to avoid assigning any positive amounts in the corresponding gray cells in the Shipments decisions block. They represent time reversal decisions that are impossible and so must be avoided by Solver. Here is the Solver program for optimization: Here is the Sensitivity Analysis for the model: A Dynamic Production Scheduling and Inventory Control Model Bumles, Inc. uses part of its capacity in its Mexican plant to make hand-painted teapots. The following information is available: One teapot takes 0.5 hours to paint. There are 30 painters available. Teapots are made on Thursday, Friday and Saturday. Not all 30 painters will be engaged but if they are, they are available to work any part of an 8hour day, 2 days a week. A painter can be assigned to any 2 day schedule and is paid for 16 hours, no matter what. Slack time is spent on cleaning the plant. Revenue (ignoring labor costs) for 1 teapot is equal to $15. All teapots produced in a week must be shipped that week. It costs $0.50 to carry a teapot in ending inventory from one day to the next. A unit of lost demand results in a penalty of $1/unit on Thurs., $3 on Fri. and $5 on Sat. Painters are paid $8 per hour. Weekly demand is 100 on Thurs., 300 on Fri. and 600 on Sat. Here is the resulting spreadsheet model. A Dynamic Cash Management Model Winston-Salem Development Corporation (WSDC) is trying to complete its investment plans for the next two years. Currently, WSDC has $2,000,000 on hand and available for investment. The following table gives the cash income from previous investments: Income 6 MONTHS 12 MONTHS 18 MONTHS $500,000 $400,000 $380,000 There are 2 development projects in which WSDC is considering participation along with other nonWSDC investors. 1. Foster City Development: If WSDC participated at a 100% level, the projected cash flow would be: Income INITIAL 6 MONTHS 12 MONTHS 18 MONTHS 24 MONTHS $- 1,000,000 $- 700,000 $ 1,800,000 $ 400,000 $ 600,000 In order to participate at the 100% level, WSDC would have to lay out $1,000,000 immediately and $700,000 again in 6 months. 2. Take over the operation of an old MiddleIncome Housing on the condition that certain initial repairs be made. At 100% participation, the cash flow would be: Income INITIAL 6 MONTHS 12 MONTHS 18 MONTHS 24 MONTHS $- 800,000 $ 500,000 $- 200,000 $- 700,000 $ 2,000,000 WSDC can participate in either project at a level less than 100%. The cash flows would be adjusted proportionally and outside investors would make up the difference. Now WSDC must decide how much of the $2,000,000 on hand should be invested in each of the projects and how much should simply be invested in a 6month CD for the 7% semiannual return. The goal (objective function) is to maximize the cash on hand at the end of 24 months. The decision variables are: F = fractional participation in Foster City project M = fractional participation in Middle-Income Housing project S1 = initial surplus funds to be invested in a 7% CD S2 = 6 mts. surplus funds to be invested in a 7% CD S3 = 12 mts. surplus funds to be invested in a 7%CD S4 = 18 mts. surplus funds to be invested in a 7%CD The constraints in this model must say that at the beginning of each of the four 6-month periods: cash invested < cash on hand The first constraint must say: Initial investment < initial funds on hand 1,000,000F + 800,000M + S1 < 2,000,000 Because of the interest paid, S1 becomes 1.07S1 after 6 months, and similarly for S2, S3, and S4: 700,000F + S2 < 500,000M + 1.07S1 + 500,000 200,000M + S3 < 1,800,000F + 1.07S2 + 400,000 700,000M + S4 < 400,000F + 1.07S3 + 380,000 These constraints provide material balance of the cash flows from one time period to another. Here is the symbolic model for this LP dynamic cash management model: Max 600,000F + 2,000,000M + 1.07S4 s.t. 1,000,000F + 800,000M + S1 < 2,000,000 700,000F - 500,000M – 1.07S1 + S2 < 500,000 -1,800,000F + 200,000M – 1.07S2 + S3 < 400,000 - 400,000F + 700,000M – 1.07S3 + S4 < 380,000 F < 1 and M < 1 F > 0, M > 0, Si > 0, i = 1,2,3,4 Here is the optimal solution: Here are the formulas and Solver Parameters: Here is the partial Sensitivity Analysis: As can be seen from these results, both investment projects are attractive with WSDC participating fully, and from the Sensitivity Report, the marginal return to WSDCs initial funds is 31% over 24 months. A Financial and Production Planning Model The AutoPower Europe production model for its diesel powered UPS generators is a product-mix model for deciding how many of its two models, BigGen and SmallGen, to produce and sell in each of the coming months in view of a number of constraints. The following information is relevant to this model: 1. The financial data on each BigGen and SmallGen sold is: Product Sales Per Unit Contribution Price Material Margin $000’s and Labor $000’s $000’s BigGen 80 75 5 SmallGen 24 20 4 2. Each product is put through machining and assembly operations in two production departments, called A and B. Dept. A has 150 hours available each month. Dept. B has 160 hours available each month. 3. Each BigGen produced uses 10 hours of machining in Dept. A and 20 hours of machining in Dept. B. Each SmallGen uses 15 hours in Dept. A and 10 hours in Dept. B. 4. Testing is performed in an independent third department. Each BigGen is given 30 hours of testing and each SmallGen is given 10. AutoPower’s labor contract mandates that the total labor hours devoted to testing cannot fall below 135 hours each month. Now, let B be the number of BigGen’s to produce each month and S be the number of SmallGen’s, here is the symbolic model: Max 5B + 4S (Profit in $000’s) s.t. 10B + 15S < 150 (hours in department A) 20B + 10S < 160 (hours in department B) 30B + 10S > 135 (testing hours) B, S > 0 Here are the results of the Solved model. A Financial and Production Planning Model Financial Considerations The previous AutoPower model ignored important financial considerations. Specifically, AutoPower must incur the material and direct labor costs in the next month, whereas payments will not be forthcoming for another 3 months. AutoPower has budgeted $100,000 of cash on hand to cover the current material and labor costs and plans to borrow any additional funds needed (at an annual interest rate of 16%). In order to hedge against downside risks, the bank has limited the total due to the bank (principal plus interest) to be no more than 2/3 of the sum of AutoPower’s cash on hand and accounts receivable. If present value of net cash flow is maximized, fewer BigGen’s and more SamllGen’s should be produced (because of high material and labor costs). Also, the committee cannot agree on a discount rate of 12%, 16% or 20%. AutoPower needs to formulate a new objective function, determine how much to borrow (if any), and devise a production plan incorporating this new information. Now, let D = debt (i.e., total borrowed in $000s). The net cash flow next month in $ will be: D – 75B – 20S The net cash flow three months later (after payments are received) will be: 80B + 24S – 1.040D Discount factor a (based on the annual discount rate R) is equal to: a= 1 1+R/4 AutoPower can borrow at 16% per annum (4% for 3 months. The objective is to Max. present value of net cash flow, so the objective function (in $000s) becomes: Max 1D – 75B – 20S + a (80B + 24S – 1.040D) Additional constraints required are: 1. Since the total uses of funds cannot exceed the total sources of funds, the inequality is: Material and labor costs < debt + cash on hand 75E + 20F < D + 100 2. The bank requires that the total amount due the bank must be no greater than 2/3 of the cash on hand plus the accounts receivable: debt + interest < 2/3(cash on hand + accts. rec.) D + .04D < 2/3(100 + 80B + 24S) 1.5(D + .04D) < 100 + 80B + 24S Here is the production and financial model Excel spreadsheet with optimal solution for the case R=20%. The surplus funds can be invested to earn 20% interest while the cost of the funds is only 16%. AutoPower Europe should borrow $279.49 thousand and reduce production of BigGens. Here are the Solver parameters: A Financial and Production Planning Model Effect of Financial Considerations Inserting the financial considerations in the original production mix model leads to a different plan and a smaller profit. The objective function in the production and finance model is less because future cash flows are discounted and interest costs of borrowing are included. SolverTable1 can be used to show the profits based on varying values of R (discount rate). If R is < 16%, borrow $192.50 If R is > 16%, borrow $279.49 If R is = 16%, then there are alternative optimal solutions where D lies between $192.50 and $279.49. SolverTable1 can be used to show the payment delays between zero and 4 months to illustrate the benefit to AutoPower Europe of improving its accounts receivables by encouraging its customers to pay invoices promptly. % Improvement = (Profit – 30.162)/30.162 If AutoPower’s customers paid for their generators in one month instead of delaying 3 months, their profit would increase by more than 40% per month. Network Models Transportation and assignment models are members of a more general class of models called network models. Network models involve from-to sources and destinations. Applied to management logistics and distribution, network models are important because: They can be applied to a wide variety of real world models. Flows may represent physical quantities, Internet data packets, cash, airplanes, cars, ships, products, … Network Models A Capacitated Transshipment Model Zigwell Inc. is AutoPower’s largest US distributor of UPS generators in five Midwestern states. Zigwell has 10 BigGen’s at site 1 These generators must be delivered to construction sites in two cities denoted 3 and 4 3 BigGen’s are required at site 3 and 7 are required at site 4 Because of prearranged schedules concerning drivers available, these generators may be distributed only according to any of the following alternative routes. -3 Supply 3 +10 1 2 This is a network diagram or network flow diagram. Each arrow is called an arc or branch. Each site is termed a node. 4 5 -7 There are many allowable routes. Which of these allowable routes is selected will be determined by: cij uij the costs (per unit) of traversing the routes the capacities along the routes Costs are primarily due to fuel, tolls, and the cost of the driver for the average time it takes to traverse the arc. Because of pre-established agreements with the teamsters, Zigwell must change drivers at each site it encounters on a route. Because of limitations on the current availability of drivers, there is an upper bound, uij, on the number of generators that may traverse an arc. The arc capacities (uij) and costs (cij) have been added to the network model. -3 3 c23 u23 +10 1 c12 u12 2 c24 u24 c34 u34 c43 u43 4 c25 u25 5 -7 u53 c53 Network Models A Capacitated Transshipment Model LP Formulation of the Model The goal is to find a shipment plan that satisfies the demands at minimum cost, subject to the capacity constraints. The capacitated transshipment model is basically identical to the transportation model except that: 1. Any plant or warehouse can ship to any other plant or warehouse 2. There can be upper and/or lower bounds (capacities) on each shipment (branch) The decision variables are: xij = total number of BigGen’s sent on arc (i, j) = flow from node i to node j The model becomes: Min c12x12 + c23x23 + c24x24 + c25x25 + c34x34 + c43x43 + c53x53 + c54x54 s.t. +x12 = 10 -x12 + x23 + x24 + x25 = 0 -x23 – x43 – x53 + x34 = -3 -x24 + x43 – x34 – x54 = -7 -x25 + x53 + x54 = 0 0 < xij < uij all arcs (i, j) in the network Properties of the Model 1. xij is associated with each of the 8 arcs in the network. Therefore, there are 8 corresponding variables: x12, x23, x24, x25, x34, x43, x53, and x54 The objective is to minimize total cost. 2. There is one material flow balance equation associated with each node in the network. For example: Total flow out of node 1 is 10 units Total flow out of node 2 minus the total flow into node 2 is zero (i.e., total flow out must equal total flow into node 2 ). Total flow out of node 3 must be 3 units less than the total flow into node 3 . Intermediate nodes that are neither supply points nor demand points are often termed transshipment nodes. 3. The positive right-hand sides correspond to nodes that are net suppliers (origins). The negative right-hand sides correspond to nodes that are net destinations. The zero right-hand sides correspond to nodes that have neither supply nor demand. The sum of all right-hand-side terms is zero (i.e., total supply in the network equals total demand). In general, flow balance for a given node, j, is: Total flow out of node j – total flow into node j = supply at node j Negative supply is a requirement. Nodes with negative supply are called destinations, sinks, or demand points. Nodes with positive supply are called origins, sources, or supply points. Nodes with zero supply are called transshipment points. 4. A small model can be optimized with Solver. Here is the Excel formulation and optimal solution for the transshipment model. =C10*J3 =SUM(C10:C14) =Sum(C10:G10) =H10-C15; Note that you can use the TRANSPOSE function. Highlight cells C16:G16 and enter =TRANSPOSE(H10:H14)-C15:G15 Here are the Solver Parameters: Network Models A Capacitated Transshipment Model Integer Optimal Solutions The integer property of the network model can be stated thus: If all the RHS terms and arc capacities, uij, are integers in the capacitated transshipment model, there will always be an integer-valued optimal solution to this model. Network Models A Capacitated Transshipment Model Efficient Solution Procedures The structure of this model makes it possible to apply special solution methods and software that optimize the model much more quickly than the more general simplex method used by Solver. This makes it possible to optimize very large scale network models quickly and cheaply. Network Models A Shortest-Route Model The shortest-route model refers to a network for which each arc (i,j) has an associated number, cij, which is interpreted as the distance (or cost, or time) from node i to node j. A route or path between two nodes is any sequence of arcs connecting the two nodes. The objective is to find the shortest (or least-cost or least-time) routes from a specific node to each of the other nodes in the network. In this example, Aaron Drunner makes frequent wine deliveries to 7 different sites: Note that the arcs are undirected (flow is permitted in either direction). 7 Distance between 1 nodes. 2 8 6 3 7 4 H Home Base 1 3 3 4 1 1 1 6 2 3 5 2 The goal is to minimize overall costs by making sure that any future delivery to any given site is made along the shortest route to that site. The goal is to minimize overall costs by finding the shortest route from node H to any of the other 7 nodes. Note that in this model, the task is to find an optimal route, not optimal xij’s. The following Excel model finds the shortest path between any two nodes. The starting and ending nodes are specified by the values 1 and –1, respectively. Indicator variables (cells C3:J10) are used to signify the node-arc connectivity. The decision variables are constrained to be between 0 and 1 and the objective function (U21) minimizes total distance. Here is the Excel formulation and optimal solution for the shortest route model. Here are the Solver Parameters: Network Models An Equipment Replacement Model In this example, Michael Carr is responsible for obtaining a high speed printing press for his newspaper company. In a given year he must choose between purchasing: New Printing Press high annual acquisition cost Old Printing Press no annual acquisition cost low initial maintenance cost high initial maintenance cost Assume a 4-year time horizon. Let: cij denote the cost of buying new equipment at the beginning of year i, i = 1, 2, 3, 4 and maintaining it to the beginning of year j, j = 2, 3, 4, 5 Three alternative feasible policies are: 1. Buying new equipment at the beginning of each year. Total (acquisition + maintenance) cost = c12 + c23 + c34 + c45 2. Buy new equipment only at the beginning of year 1 and maintain it through all successive years. Total (buying + maintenance) cost = c15 3. Buy new equipment at the beginning of years 1 and 4. Total cost = c14 + c45 The solution to this model is obtained by finding the shortest (i.e., minimum cost) route from node 1 to node 5 of the network. Each node on the shortest route denotes a replacement, that is, a year at which new equipment should be bought. Here is the network model for this problem. c15 c14 c35 c13 1 c12 2 c23 3 c24 c34 4 c45 5 c25 Assume the following costs: $1,600,000 purchase cost $500,000 maintenance cost in purchase year $1,000,000, $1,500,000, and $2,200,000 for each additional year the equipment is kept Here is the Excel spreadsheet and solution. Indicator variables used Cost Parameters to signify the node-arc connectivity Cost consequences of Time reversals buying and that have no maintaining a printing meaning press beginning in one year and continuing to Costs a terminal year. associated Represents beginning year with decisions (1) and ending year (-1) Here are the Solver Parameters: The optimal strategy is to buy a printing press at the beginning of year 1 and keep it for 2 years, replacing it at the beginning of year 3 with a new printing press which he keeps until the beginning of year 5 for a total 4-year cost of $6.2 million. Network Models A Maximal Flow Model In the maximal-flow model, there is a single source node (the input node) and a single sink node (the output node). The goal is to find the maximum amount of total flow that can be routed through a physical network (from source to sink) in a unit of time. The amount of flow per unit time on each arc is limited by capacity restrictions. The only requirement is that for each node (other than the source or the sink): flow out of the node = flow into the node Network Models A Maximal Flow Model An Application of Maximal-Flow: The Urban Development Planning Commission The UDPC (Urban Development Planning Commission) is an ad hoc special interest study group. The group’s current responsibility is to coordinate the construction of the new subway system with the state’s highway maintenance department. Because the new subway system is being built near the city’s beltway, the eastbound traffic on the beltway must be detoured. The proposed network of alternative routes and the different speed limits and traffic patterns (producing different flow capacities) are given below: 6 0 Detour 2 4 6 Detour 0 2 Begins Ends 0 0 4 1 Indicates 0 capacity in the direction of the arrow. 6 Indicates a capacity of 0 1 6000 vehicles3per hour in 0 4 2 5 the direction0 of 3the arrow. 0 6 0 Here is the Solved Excel model: The optimal solution is a maximal flow of 8000 vehicles per hour. Translating the Excel solution to the original network diagram gives the following traffic pattern: 6 2 4 6 4 8 1 6 2 4 2 5 3 2 8 As is common in network models, there are alternative optimal solutions to the model: