You are on page 1of 6

Designing

Linear Programs in

Large-Scale Supply Chain Spreadsheets


Developing techniques to create a complete supply chain model across an entire product line.
supply chain is a network of facilities for activities such as raw materials procurement, finished goods manufacturing, and distribution of products to customers. Because of competitive pressures, many organizations have expanded their supply chains to include international sites for more economical production and/or increased sales. The result has been increasingly complex supply chain management problems.
By Larry J. LeBlanc and Michael R. Galbreth

COMMUNICATIONS OF THE ACM August 2007/Vol. 50, No. 8

59

Applications (the VBA programming language within Excel). Our specific contributions include: A discussion of the limits of previous best techniques for spreadsheet supply chain linear programming and the presentation of new techniques for successfully implementing larger supply chain spreadsheet LPs than were previously thought possible; The use of filters for extracting applicable data when different modifications of a basic LP must be solved; Examples of the use of VBA to increase the efficiency of a spreadsheet supply chain LP; An example of the trade-off between easy-todevelop and slow-to-runa concept that is wellknown in procedural programming but novel in the spreadsheet context; and An example of an important large-scale supply chain optimization problem that was implemented using LP in a spreadsheet.

Figure 1. One approach to dealing with such Inefficient supply complexities is the use of a linear (8/07) LP using LeBlanc fig 1 chain program (LP), a type of optimiza- rectangular ranges for changing tion model for applications such as cells. minimizing costs or maximizing profits. Unfortunately, in the past LPs were explained in algebraic terms, which was confusing to many non-specialists. Recently, however, the awareness of LPs by non-technical senior managers has greatly increased because they can be explained more intuitively using spreadsheets. Given the advent of spreadsheets for LPs, more managers are approving the use of the now-familiar linear programming approach for minimizing Table 1. Some companies that have used LPs inour recent developsupply chain This work was motivated by spreadsheets. costs. As a result, supply chain LP models have ment of a large-scale multi-period supply chain LP become one of the most common LPs being solved. for Nu-kote International, and we will use that Table 1 shows some of the organizations that model as a basis for illustration.1 Nu-kote is the have used spreadsheet-based American Express AT&T Boeing Bristol Myers Squibb optimization models [3]; see Caterpillar Chevron CitiGroup Coca-Cola [46] for descriptions of other ConocoPhillips Con-Agra Dell Dow Chemical applications of LP for supply EDS DuPont Exxon Mobil Federal Express chain management. Because of Ford General Motors Georgia Pacific Goldman Sachs this increasing use, the ability Hewlett Packard Honeywell Intel IBM to design an optimization International Paper Johnson & Johnson Kmart/Sears Lockheed model within a spreadsheet is Merrill Lynch Microsoft Northrop Grumman Pepsi-Cola important. However, spreadValero Energy Verizon Visteon Wachovia sheets have inherent limitations Wells Fargo Weyerhaeuser when dealing with large-scale models, and a direct approach Table 1. Some worlds largest independent remanufacturer of carbased on standard procedures companies that have recommended in textbooks is used LPs in tridges for printers, copiers, and fax machines. Nuspreadsheets. kote managers who 1 (8/07) using the LP model generally not successful. LeBlanc table would be specifically requested that we develop it in Excel, In this article, we discuss some common difficulties encountered during the devel- but our initial attempts at an Excel-based LP were opment of practical spreadsheet optimization mod- not successful due to the sheer size of the problem. els for supply chain management and describe However, using the techniques described in this efficient procedures for overcoming these prob- article we succeeded in developing an LP that is lems. Our approach uses Microsoft Excels standard features extensively, but augments the spreadsheet with customized Visual Basic for 1Nu-kotes proprietary information has been disguised.

60

August 2007/Vol. 50, No. 8 COMMUNICATIONS OF THE ACM

MODELING DIFFICULTIES AND THEIR RESOLUTION Efficient Specification of Changing Cells. When developing a spreadsheet optimization model for LP MODELS FOR SUPPLY CHAINS supply chain management, it is convenient to use In a supply chain LP, changing cells (also called rectangular ranges for changing cells, since row and decision variables) typically represent shipments of column sums represent flow in and flow out in a raw materials from suppliers to manufacturing sites natural manner. For example, Figure 1 shows our and finished goods from manufacturing sites Supply chaindesign of a supply chain LP for shipments Table 2. to initial LP model. customers. Constraints often prevent the total from manufacturing sites to customers in weeks shipped out of each manufacturing site from 178. Manufacturing sites are China and Thailand exceeding its capacity and require the total shipped and are shown in B7:C162, and customers are A into each customer site and B, as shown in to equal that sites D5:FC6. Changing cells demand. Table 2 shows in D7:FC162 specify the Materials Manufacturing Customer the structure of our supshipments from China Sources Facilities Locations ply chain LP for Nuand Thailand to cuskote. In addition to the tomers A and B in each Atlanta static structure depicted week. Thus, the rectanin Table 2, we used gular range consists of St. Louis China A weekly time periods to four quadrantsone for keep track of when the each manufacturing individual shipments site/customer combinaAsia Broker Thailand B originate and terminate. tion. The row sums in Changing cells referring column FD give the total to weekly shipments flow (shipments) out of Europe Broker that are possible given the corresponding manuthe shipping lead times facturing sites in each U.S. Broker are said to be feasible. A week, and the column spreadsheet LP requires sums in row 163 give the passing constraints to a total flow into the cussolution engine, such Table 2. Supply chain LP model. tomer sites in each week. These sums are parts of as Excels built in Solver constraints that the total amounts shipped out of or one of the upgraded versions available [2, 7]. manufacturing sites cannot exceed the capacity in Ranges containing changing cells and the total cost each week, and totals shipped into customer sites function must also be passed to the Solver, which must equal the demand in each week. LeBlanc table 2 (8/07) returns the optimal values for the changing cells. Unfortunately, the inherent limitations in this The size of a supply chain LP is normally given approach make it unusable for large-scale applicaby the numbers of variables and constraints, but tions. Note from D6:FC6 in Figure 1 that 278 = the size of a spreadsheet LP can also be expressed in 156 columns are used just to specify the flows of terms of the number of rows and columns or by the finished goods to demand locations for various file size in megabytes. A large-scale model is gener- weeks. Since Excel 2003 has only 256 columns in ally considered to have tens of thousands of rows. each worksheet, this space-intensive approach Our Nu-kote LP had approximately 68,500 vari- severely restricts the number of columns available ables and 1,400 constraints and was solved for each in this worksheet for other parts of the model. of 86 different cartridges. The spreadsheet had Obviously, problems with more than 256 options more than 30,000 rows, 229 columns, and was cannot be modeled using a single rectangular over 50MB in size.2 For complex models on this range.4 Note also that only the unshaded changing scale, common events such as the recalculation of cells in D7:FC162 are needed because of shipping cell formulas can be extremely time-consuming,
2

being successfully used to support strategic decisions in a global supply chain, and that has resulted in savings of approximately $1 million in its first year of use.

and have even caused our Excel LPs to crash.3

Frontline Systems [2] provides several solver engines capable of handling problems of this size. for the Nu-kote implementation, we chose Frontlines Large Scale SQP Solver.

Even when the column limit is increased, as in Excel 2007, rectangular ranges still result in inefficient use of space in the spreadsheet, and they can cause other issues, such as the difficulties in specifying changing cells as described here.

3 This is evidenced by Microsoft Excel has encountered an error and must close. 4

COMMUNICATIONS OF THE ACM August 2007/Vol. 50, No. 8

61

and later filtering for feasible rows.

lead times between pairs of sites. For example, China to customer A takes seven weeks, so K7 (week 1 from China to Customer A for week 8) is the first feasible changing cell. The unneeded cells greatly slow the solution process for large-scale models. However, when storing a rectangular range in Excel, this wasted space is unavoidable. The feasible (non-shaded) changing cells in Figure 1 Figure 2a. Storing data of development flexibility). for consist of approximately times any possible lead Since the feasible changing cells depend on the and later filtering 5 300 separate ranges K7:CC7, for feasible rows. specific 2a (8/07)- 26.5 picas width the model, LeBlanc fig lead times and sites included in CJ7:FC7, L8:CC8, CK8:FC8, all potential cells for labels, coefficients, formulas, Figure Input data, VBA output, and VBA code any M9:CC9, and so forth. Passing ranges of changing2b.and changing cells must be included for to possigenerate set of only for applicable all vendors and manucells to Solver manually requires selecting each ble data lead times and for lead times. individual range in turn and then clicking an facturing sites. An Excel filter can then be used to Add button. This is far too time-consuming and extract only the allowable cells for the actual lead error prone, and it is even difficult using a programming language such as VBA. For these reasons it is much more efficient to use columns for the changing cells, coefficients, labels, and formulas. This allows the changing cells to be passed to Solver as a single range of cells. The use of the columns structure for changing Input To VBA Output From VBA cells can be seen for the case of raw materials shipments in the For i = 1 To NumSources ' 5 sources: Atlanta, St. Louis, & Asia, Europe, US Brokers Source = ShipTimeAnchor.Offset(i, 0) 'ShipTimeAnchor is C24 in sheet at above left left half of Figure 2a (cells For j = 1 To NumDests '2 destinations: China and Thailand Dest = ShipTimeAnchor.Offset(0, j) 'Dest and LeadTime are also defined A4:K30820) LeadTime = ShipTimeAnchor.Offset(i, j) 'relative to C24. SourceWeek = 1 Facilitating Multiple Runs ManufactureWeek = 1 Do While SourceWeek <= HorizonWeeks 'HorizonWeeks = 78----------------------------------------------------of LP Models. Typically, a supDo While ManufactureWeek <= HorizonWeeks '=================================== If ManufactureWeek >= SourceWeek + LeadTime Then ply chain spreadsheet LP is LastRow = LastRow + 1 solved for various proposed Range("A" & LastRow) = SourceWeek & " " & Source 'These ranges are in the workRange("B" & LastRow) = ManufactureWeek & " " & Dest sheet shown at above right manufacturing and shipping End If ManufactureWeek = ManufactureWeek + 1 lead times (due to premium Loop '=================================================================== SourceWeek = SourceWeek + 1 payments for expedited manuManufactureWeek = SourceWeek 'ManufactureWeek always starts at SourceWeek Loop '------------------------------------------------------------------------------------------------------------------------------facturing and air freight) and Next j for proposed new suppliers and Next i manufacturing sites. The flexi'Copy and paste special Excel cost formulas (not the borders) from row 7 to the new range. These existing formulas look up the costs using the labels just generated in columns A and B bility to make such adjustments Range("C7:F7").Copy Range("C8:F" & LastRow).PasteSpecial Paste:=xlPasteFormulas easily is an important characterEnd Sub istic of any supply chain model (see Fischer et al. [1] for a general discussion of the benefits Figure 2b. Input data, times and sites specified by the user in the model; VBA output, and VBA this is shown in Figure 2a. code to generate data This approach2b (8/07) for small and even only for applicable LeBlanc fig works well 5 lead times. moderately large problems. Unfortunately, it can The exact number depends on the shipping lead times.
62
August 2007/Vol. 50, No. 8 COMMUNICATIONS OF THE ACM

Figure 3a. Excels SUMIF worksheet function vs. the direct sum equivalent.

application for Nu-kote, the resulting Excel file size, in combination with the inefficiencies discussed next, dramatically slowed Solver performance and even caused Excel crashes. Projected solution time for the LP model (if Excel did not crash) was greater than 27 hours. Model size can be greatly reduced by foregoing the convenience of duplicate data storage (the original data for any lead times and sites, and the filtered To sum units supplied to 10 China, we could use data for the user-specified lead =SUMIF($B$7:$B$26823, I16, $G$7:$G$26823) times and sites). To accomplish ^^^^^^^^^^^^^^ !!!! ************** Figure 3a. Excels SUMIF this, VBA within Excel can be ^^^ If any week/site in $B$3:$B$26823 worksheet function vs. the The VBA code for producing the customized Figure 3b. !!!! Equals the week/site in I16 (10 China) used to generate labels, coeffidirect sum equivalent. formula =G9 + G79 +the corresponding in cell J16 of Figure 3a. *** Sum G148 + cell in $G$7:$G$26823 cients, changing cells, and forHowever, a much more efficient approach is mulas only for shipments that =G9 + G79 + G148 + . (nearly 100 potential cell references) are feasible for the given lead times. This is seen by noting the equivalence of the right side of B7:B26823 10 China G Figure 2a (filtered data) with the Function MySumIF(MyRange As Range, MyCriteria As String, MySumRangeCol As String) As String right side of Figure 2b (output LeBlanc fig'Loop over cells in column B 3a (8/07) For Each MyCell In MyRange If MyCell.Value=MyCriteria Then MySumIF=MySumIF& "+" & MySumRangeCol & MyCell.Row from VBA). With this autoNext MyCell mated approach, only the data End Function If these are equal, concatenate +G and needed is generated, and the the row number to the end of MySumIf wasted storage of duplicate data is eliminated. Figure 3b. The VBA code for producing the customized formula =G9 Representative VBA code for generating these + G79 + G148 + in cell J16 of Figure 3a. types of columns is shown in Figure 2b. It loops over all sources and destinations, looking up the shipping lead to implementation failure for large-scale mod- time between each pair. It then uses two Do While els. The resulting Excel file contains columns for nested loops over all possible weeks for sourcing the LeBlanc fig 3b (8/07) both the original data (for any set of possible lead material (SourceWeek) and manufacturing it (Mantimes and allowable sites) and the filtered data ufactureWeek). Whenever the manufacturing week (which is feasible for the specified lead times and is at least as large as the source week plus the shipallowable sites). In our large-scale supply chain ping lead time, concise output is written to columns

With this automated approach, only the data needed is generated, and the

WASTED STORAGE OF DUPLICATE DATA IS ELIMINATED.

COMMUNICATIONS OF THE ACM August 2007/Vol. 50, No. 8

63

A and B one row a time. VBA then simply copies the existing cost formulas in C7:F7, which look up various costs, down to all rows for which labels have been created. It has been considered best practice to use Excels SUMIF worksheet function in supply chain LPs to implement capacity, demand, and flow conservation constraints. This function adds the cells in one range whenever cells in another range meet the given criteria. For example, a manufacturing capacity constraint can be written using this function to sum all changing cells that refer to shipments into the given site. However, this approach is not workable for large-scale models. Our initial supply chain LP for Nu-kote had SUMIF functions in more than 1,000 cells, and each of these compared and summed the values in nearly 60,000 other cells. This massive recalculation at each of numerous iterations of the solution algorithm was too time-consuming, even for Frontline Systems state-of-the-art Large-Scale LP solver with the premium solver platform. To overcome the problem of excessive recalculation time with the SUMIF worksheet functions, each SUMIF can be replaced with the direct equivalent sum of the specific cells. Figure 3a shows the new formulas for the week 10 China capacity constraint in cell J16. This completely eliminates the problems with Solver crashing due to excessive recalculation time. However, this formula involves the exact specification of multiple single-cell ranges in formulas in more than 1,000 cells. Each formula is unique, so none can be copied and pasted to other cells. This is far too error-prone and timeconsuming to perform manually, but a VBA procedure within Excel can be used to produce these formulas. Figure 3b shows the VBA code for producing the customized formula =G9 + G79 + G148 + in cell J16 of Figure 3a. This function uses only five lines of code to look at each cell in the range B7:B26823 (the actual range is passed to the function). The function concatenates a + and the reference to the corresponding cell in column G each time a match is found to the given criteria (MyCriteria = 10 China). This same function is used to create the unique Excel formulas in the rest of column J in Figure 3a. Obviously, this customized approach is more complex than simply using SUMIFs. Thus, as is common in other programming environments, there is a trade-off between programming ease and model efficiency when developing spreadsheetbased supply chain LPs. We recommend using the
64
August 2007/Vol. 50, No. 8 COMMUNICATIONS OF THE ACM

SUMIF approach initially. If the runtime is excessive, then the VBA-driven approach described previously should be used.
CONCLUSION We have outlined approaches to developing a largescale supply chain LP using Microsoft Excel. The techniques described here have been proven effective in the creation of a valuable application for Nu-kote, International. The efficiency of these approaches allows developers to create a complete supply chain LP model, including all of the input data, in a single Excel workbook. Given the familiarity of many managers with the Excel software package, this exclusive use of Excel can significantly increase users comfort level with, and therefore use of, advanced LPs for supply chain management. Illustrative of this situation is the fact that our original LP model was intended for use with only a few major product types, but these efficiency improvements prompted management to expand its use to support decisions regarding the entire line of 86 products. Total solution time for all 86 LPs was only 4 hours and 15 minutes, with no Excel crashing. This is down from the estimated 27 hours (if Excel did not crash) before our enhancements. c
REFERENCES
1. Fischer, G., Giaccardi, E., Ye, Y., Sutcliffe, A.G., and Mehandjiev, N. Meta-Design: A manifesto for end-user development. Commun. ACM 47, 9 (Sept. 2004), 3337. 2. Frontline Systems, Inc.; www.solver.com/. 3. Fylstra, D., president, Frontline Systems, Inc. Private communication, 2005. 4. LeBlanc, L., Hill, J., Greenwell, G., and Czesnat, A. Nu-kotes spreadsheet linear programming models for optimizing transportation. Interfaces 34, 2 (Feb. 2004), 139146. 5. Prior, R. et al. Menlo Worldwide Forwarding optimizes its network routing. Interfaces 34, 1 (Jan. 2004), 2638. 6. Tyagi, R., Kalish, P., Akbay, K., and Munshaw, G. GE Plastics optimizes the two-echelon global fulfillment network at its high performance polymers division. Interfaces 34, 5 (May 2005), 359366. 7. Whats Best!; www.lindo.com/wbf.html.

Larry J. LeBlanc (Larry.LeBlanc@Owen.Vanderbilt.edu) is a


professor of operations management and information technology at the Owen Graduate School of Management, Vanderbilt University, Nashville, TN. Michael R. Galbreth (galbreth@moore.sc.edu) is an assistant professor of management science at the Moore School of Business, University of South Carolina, Columbia, SC.
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee.

2007 ACM 0001-0782/07/0800 $5.00

You might also like