Designing Large Scale Supply Chain Linear Programs in Spreadsheets

6
COMMUNICATIONS OF THE ACM August 2007/Vol. 50, No. 8 59 Developing techniques to create a complete supply chain model across an entire product line. Large-Scale Supply Chain By Larry J. LeBlanc and Michael R. Galbreth A supply chain is a network of facilities for activities such as raw materials pro- curement, finished goods manufactur- ing, 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. Spreadsheets Designing Linear Programs in

Transcript of Designing Large Scale Supply Chain Linear Programs in Spreadsheets

Page 1: Designing Large Scale Supply Chain Linear Programs in Spreadsheets

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

Developing techniques to create a complete supply chain model across an entire product line.

Large-ScaleSupply Chain

By Larry J. LeBlanc and Michael R. Galbreth

A supply chain is a network of facilitiesfor activities such as raw materials pro-curement, finished goods manufactur-ing, and distribution of products tocustomers. Because of competitive

pressures, many organizations have expanded theirsupply chains to include international sites formore economical production and/or increasedsales. The result has been increasingly complexsupply chain management problems.

Spreadsheets

Designing

Linear Programs in

Page 2: Designing Large Scale Supply Chain Linear Programs in Spreadsheets

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

One approach to dealing with suchcomplexities is the use of a linearprogram (LP), a type of optimiza-tion model for applications such asminimizing costs or maximizingprofits. Unfortunately, in the pastLPs were explained in algebraic terms, which wasconfusing to many non-specialists. Recently, how-ever, the awareness of LPs by non-technical seniormanagers has greatly increased because they can beexplained more intuitively using spreadsheets. Giventhe advent of spreadsheets for LPs, more managersare approving the use of the now-familiar linear pro-gramming approach for minimizing supply chaincosts. As a result, supply chain LP models havebecome one of the most common LPs being solved.

Table 1 shows some of the organizations thathave used spreadsheet-basedoptimization models [3]; see[4–6] for descriptions of otherapplications of LP for supplychain management. Because ofthis increasing use, the abilityto design an optimizationmodel within a spreadsheet isimportant. However, spread-sheets have inherent limitationswhen dealing with large-scalemodels, and a direct approachbased on standard proceduresrecommended in textbooks isgenerally not successful.

In this article, we discuss somecommon difficulties encountered during the devel-opment of practical spreadsheet optimization mod-els for supply chain management and describeefficient procedures for overcoming these prob-lems. Our approach uses Microsoft Excel’s stan-dard features extensively, but augments thespreadsheet with customized Visual Basic for

Applications (the VBA program-ming language within Excel). Ourspecific contributions include:

• A discussion of the limits of pre-vious “best” techniques forspreadsheet supply chain linearprogramming and the presenta-tion of new techniques for suc-cessfully implementing largersupply chain spreadsheet LPsthan were previously thoughtpossible;

• The use of filters for extractingapplicable data when differentmodifications of a basic LP mustbe solved;

• Examples of the use of VBA to increase the effi-ciency of a spreadsheet supply chain LP;

• An example of the trade-off between easy-to-develop and slow-to-run—a concept that is well-known in procedural programming but novel inthe spreadsheet context; and

• An example of an important large-scale supplychain optimization problem that was imple-mented using LP in a spreadsheet.

This work was motivated by our recent develop-ment of a large-scale multi-period supply chain LPfor Nu-kote International, and we will use thatmodel as a basis for illustration.1 Nu-kote is the

world’s largest independent remanufacturer of car-tridges for printers, copiers, and fax machines. Nu-kote managers who would be using the LP modelspecifically requested that we develop it in Excel,but our initial attempts at an Excel-based LP werenot successful due to the sheer size of the problem.However, using the techniques described in thisarticle we succeeded in developing an LP that is

LeBlanc fig 1 (8/07)

Table 1. Some companies that have used LPs in spreadsheets.

LeBlanc table 1 (8/07)

American Express

Caterpillar

Con-Agra

DuPont

Ford

Hewlett Packard

International Paper

Merrill Lynch

Valero Energy

Wells Fargo

AT&T

Chevron

ConocoPhillips

EDS

General Motors

Honeywell

Johnson & Johnson

Microsoft

Verizon

Weyerhaeuser

Boeing

CitiGroup

Dell

Exxon Mobil

Georgia Pacific

Intel

Kmart/Sears

Northrop Grumman

Visteon

Bristol Myers Squibb

Coca-Cola

Dow Chemical

Federal Express

Goldman Sachs

IBM

Lockheed

Pepsi-Cola

Wachovia

Figure 1. Inefficient supply

chain LP using rectangular ranges

for changing cells.

Table 1. Some companies that have

used LPs in spreadsheets.

1Nu-kote’s proprietary information has been disguised.

Page 3: Designing Large Scale Supply Chain Linear Programs in Spreadsheets

being successfully used to support strategic deci-sions in a global supply chain, and that has resultedin savings of approximately $1 million in its firstyear of use.

LP MODELS FOR SUPPLY CHAINS

In a supply chain LP, changing cells (also calleddecision variables) typically represent shipments ofraw materials from suppliers to manufacturing sitesand finished goods from manufacturing sites tocustomers. Constraints often prevent the totalshipped out of each manufacturing site fromexceeding its capacity and require the total shippedinto each customer siteto equal that site’sdemand. Table 2 showsthe structure of our sup-ply chain LP for Nu-kote. In addition to thestatic structure depictedin Table 2, we usedweekly time periods tokeep track of when theindividual shipmentsoriginate and terminate.Changing cells referringto weekly shipmentsthat are possible giventhe shipping lead timesare said to be feasible. Aspreadsheet LP requirespassing constraints to asolution “engine,” suchas Excel’s built in Solveror one of the upgraded versions available [2, 7].Ranges containing changing cells and the total costfunction must also be passed to the Solver, whichreturns the optimal values for the changing cells.

The size of a supply chain LP is normally givenby the numbers of variables and constraints, butthe size of a spreadsheet LP can also be expressed interms of the number of rows and columns or by thefile size in megabytes. A large-scale model is gener-ally considered to have tens of thousands of rows.Our Nu-kote LP had approximately 68,500 vari-ables and 1,400 constraints and was solved for eachof 86 different cartridges. The spreadsheet hadmore than 30,000 rows, 229 columns, and wasover 50MB in size.2 For complex models on thisscale, common events such as the recalculation ofcell formulas can be extremely time-consuming,

and have even caused our Excel LPs to crash.3

MODELING DIFFICULTIES AND THEIR RESOLUTION

Efficient Specification of Changing Cells. Whendeveloping a spreadsheet optimization model forsupply chain management, it is convenient to userectangular ranges for changing cells, since row andcolumn sums represent flow in and flow out in anatural manner. For example, Figure 1 shows ourinitial design of a supply chain LP for shipmentsfrom manufacturing sites to customers in weeks1–78. Manufacturing sites are China and Thailandand are shown in B7:C162, and customers are A

and B, as shown inD5:FC6. Changing cellsin D7:FC162 specify theshipments from Chinaand Thailand to cus-tomers A and B in eachweek. Thus, the rectan-gular range consists offour quadrants—one foreach manufacturingsite/customer combina-tion. The row sums incolumn FD give the totalflow (shipments) out ofthe corresponding manu-facturing sites in eachweek, and the columnsums in row 163 give thetotal flow into the cus-

tomer sites in each week. These sums are parts ofconstraints that the total amounts shipped out ofmanufacturing sites cannot exceed the capacity ineach week, and totals shipped into customer sitesmust equal the demand in each week.

Unfortunately, the inherent limitations in thisapproach make it unusable for large-scale applica-tions. Note from D6:FC6 in Figure 1 that 2•78 =156 columns are used just to specify the flows offinished goods to demand locations for variousweeks. Since Excel 2003 has only 256 columns ineach worksheet, this space-intensive approachseverely restricts the number of columns availablein this worksheet for other parts of the model.Obviously, problems with more than 256 optionscannot be modeled using a single rectangularrange.4 Note also that only the unshaded changingcells in D7:FC162 are needed because of shipping

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

Table 2. Supply chain LP model.

LeBlanc table 2 (8/07)

Materials Sources

Atlanta

St. Louis China A

Thailand B

Europe Broker

Asia Broker

U.S. Broker

Manufacturing Facilities

CustomerLocations

Table 2. Supply chain LP model.

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

3This is evidenced by “Microsoft Excel has encountered an error and must close.”4Even when the column limit is increased, as in Excel 2007, rectangular ranges stillresult 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.

Page 4: Designing Large Scale Supply Chain Linear Programs in Spreadsheets

lead times between pairs ofsites. For example, China tocustomer A takes seven weeks,so K7 (week 1 from China toCustomer A for week 8) is thefirst feasible changing cell. Theunneeded cells greatly slow thesolution process for large-scalemodels. However, when storinga rectangular range in Excel,this wasted space is unavoid-able.

The feasible (non-shaded)changing cells in Figure 1 consist of approximately 300 separate ranges5—K7:CC7,CJ7:FC7, L8:CC8, CK8:FC8,M9:CC9, and so forth. Passing ranges of changingcells to Solver manually requires selecting eachindividual range in turn and then clicking an“Add” button. This is far too time-consuming anderror prone, and it is even diffi-cult using a programming lan-guage such as VBA. For thesereasons it is much more effi-cient to use columns for thechanging cells, coefficients,labels, and formulas. Thisallows the changing cells to bepassed to Solver as a singlerange of cells. The use of thecolumns structure for changingcells can be seen for the case ofraw materials shipments in theleft half of Figure 2a (cellsA4:K30820)

Facilitating Multiple Runsof LP Models. Typically, a sup-ply chain spreadsheet LP issolved for various proposedmanufacturing and shippinglead times (due to premiumpayments for expedited manu-facturing and air freight) andfor proposed new suppliers andmanufacturing sites. The flexi-bility to make such adjustmentseasily is an important character-istic of any supply chain model(see Fischer et al. [1] for a gen-eral discussion of the benefits

of development flexibility).Since the feasible changing cells depend on the

specific lead times and sites included in the model,all potential cells for labels, coefficients, formulas,and changing cells must be included for any possi-ble set of lead times and for all vendors and manu-facturing sites. An Excel filter can then be used toextract only the allowable cells for the actual lead

times and sites specified by the user in the model;this is shown in Figure 2a.

This approach works well for small and evenmoderately large problems. Unfortunately, it can

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

LeBlanc fig 2a (8/07)- 26.5 picas width

F g g y pand later filtering for feasible rows.

LeBlanc fig 2b (8/07)

Figure 2b. Input data, VBA output, and VBA code to generate data only for applicable lead times.

For i = 1 To NumSources ' 5 sources: Atlanta, St. Louis, & Asia, Europe, US BrokersSource = ShipTimeAnchor.Offset(i, 0) 'ShipTimeAnchor is C24 in sheet at above left

For j = 1 To NumDests '2 destinations: China and ThailandDest = ShipTimeAnchor.Offset(0, j) 'Dest and LeadTime are also definedLeadTime = ShipTimeAnchor.Offset(i, j) 'relative to C24.

SourceWeek = 1ManufactureWeek = 1Do While SourceWeek <= HorizonWeeks 'HorizonWeeks = 78-----------------------------------------------------

Do While ManufactureWeek <= HorizonWeeks '=================================== If ManufactureWeek >= SourceWeek + LeadTime Then LastRow = LastRow + 1

Range("A" & LastRow) = SourceWeek & " " & Source 'These ranges are in the work-Range("B" & LastRow) = ManufactureWeek & " " & Dest ‘sheet shown at above right

End IfManufactureWeek = ManufactureWeek + 1

Loop '=================================================================== SourceWeek = SourceWeek + 1

ManufactureWeek = SourceWeek 'ManufactureWeek always starts at SourceWeek Loop '------------------------------------------------------------------------------------------------------------------------------- Next jNext i

'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 BRange("C7:F7").CopyRange("C8:F" & LastRow).PasteSpecial Paste:=xlPasteFormulas

End Sub

Output From VBAInput To VBA

Figure 2b. Input data,VBA output, and VBAcode to generate data

only for applicable lead times.

Figure 2a. Storing datafor any possible lead

times and later filteringfor feasible rows.

5The exact number depends on the shipping lead times.

Page 5: Designing Large Scale Supply Chain Linear Programs in Spreadsheets

lead to implementation failure for large-scale mod-els. The resulting Excel file contains columns forboth the original data (for any set of possible leadtimes and allowable sites) and the filtered data(which is feasible for the specified lead times andallowable sites). In our large-scale supply chain

application for Nu-kote, theresulting Excel file size, in com-bination with the inefficienciesdiscussed next, dramaticallyslowed Solver performance andeven caused Excel crashes. Pro-jected solution time for the LPmodel (if Excel did not crash)was greater than 27 hours.

Model size can be greatlyreduced by foregoing the conve-nience of duplicate data storage(the original data for any leadtimes and sites, and the filtereddata for the user-specified leadtimes and sites). To accomplishthis, VBA within Excel can beused to generate labels, coeffi-cients, changing cells, and for-mulas only for shipments thatare feasible for the given leadtimes. This is seen by noting theequivalence of the right side ofFigure 2a (filtered data) with theright side of Figure 2b (outputfrom VBA). With this auto-mated approach, only the dataneeded is generated, and thewasted storage of duplicate datais eliminated.

Representative VBA code for generating thesetypes of columns is shown in Figure 2b. It loops overall sources and destinations, looking up the shippingtime between each pair. It then uses two “Do While”nested loops over all possible weeks for sourcing thematerial (SourceWeek) and manufacturing it (Man-ufactureWeek). Whenever the manufacturing weekis at least as large as the source week plus the ship-ping lead time, concise output is written to columns

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

LeBlanc fig 3a (8/07)

Figure 3a. Excel’s SUMIF worksheet function vs. the direct sum equivalent.

To sum units supplied to 10 China, we could use =SUMIF($B$7:$B$26823, I16, $G$7:$G$26823)

^^^^^^^^^^^^^^ !!!! **************^^^ If any week/site in $B$3:$B$26823!!!! Equals the week/site in I16 (10 China)*** Sum the corresponding cell in $G$7:$G$26823

However, a much more efficient approach is =G9 + G79 + G148 + …. (nearly 100 potential cell references)

LeBlanc fig 3b (8/07)

Figure 3b. The VBA code for producing the customized formula =G9 + G79 + G148 + … in cell J16 of Figure 3a.

Function MySumIF(MyRange As Range, MyCriteria As String, MySumRangeCol As String) As String For Each MyCell In MyRange 'Loop over cells in column B If MyCell.Value=MyCriteria Then MySumIF=MySumIF& "+" & MySumRangeCol & MyCell.Row Next MyCellEnd Function If these are equal, concatenate “+G” and

the row number to the end of MySumIf

B7:B26823 “10 China” “G”

Figure 3a. Excel’s SUMIF worksheet function vs. thedirect sum equivalent.

Figure 3b. The VBA code for producing the customized formula =G9+ G79 + G148 + … in cell J16 of Figure 3a.

the data needed is generated, and the WASTEDSTORAGE OF DUPLICATE

DATA IS ELIMINATED.

With this automated approach, only

Page 6: Designing Large Scale Supply Chain Linear Programs in Spreadsheets

A and B one row a time. VBA then simply copies theexisting cost formulas in C7:F7, which look up var-ious costs, down to all rows for which labels havebeen created.

It has been considered best practice to useExcel’s SUMIF worksheet function in supply chainLPs to implement capacity, demand, and flow con-servation constraints. This function adds the cellsin one range whenever cells in another range meetthe given criteria. For example, a manufacturingcapacity constraint can be written using this func-tion to sum all changing cells that refer to ship-ments into the given site. However, this approachis not workable for large-scale models. Our initialsupply chain LP for Nu-kote had SUMIF func-tions in more than 1,000 cells, and each of thesecompared and summed the values in nearly 60,000other cells. This massive recalculation at each ofnumerous iterations of the solution algorithm wastoo time-consuming, even for Frontline Systems’state-of-the-art Large-Scale LP solver with the pre-mium solver platform.

To overcome the problem of excessive recalcula-tion time with the SUMIF worksheet functions,each SUMIF can be replaced with the direct equiv-alent sum of the specific cells. Figure 3a shows thenew formulas for the week 10 China capacity con-straint in cell J16. This completely eliminates theproblems with Solver crashing due to excessiverecalculation time. However, this formula involvesthe exact specification of multiple single-cell rangesin formulas in more than 1,000 cells. Each formulais unique, so none can be “copied and pasted” toother cells. This is far too error-prone and time-consuming to perform manually, but a VBA proce-dure within Excel can be used to produce theseformulas.

Figure 3b shows the VBA code for producingthe customized formula =G9 + G79 + G148 + …in cell J16 of Figure 3a. This function uses onlyfive lines of code to look at each cell in the rangeB7:B26823 (the actual range is passed to the func-tion). The function concatenates a “+” and the ref-erence to the corresponding cell in column G eachtime a match is found to the given criteria (MyCri-teria = “10 China”). This same function is used tocreate the unique Excel formulas in the rest of column J in Figure 3a.

Obviously, this customized approach is morecomplex than simply using SUMIFs. Thus, as iscommon in other programming environments,there is a trade-off between programming ease andmodel efficiency when developing spreadsheet-based supply chain LPs. We recommend using the

SUMIF approach initially. If the runtime is exces-sive, then the VBA-driven approach described pre-viously should be used.

CONCLUSION

We have outlined approaches to developing a large-scale supply chain LP using Microsoft Excel. Thetechniques described here have been proven effec-tive in the creation of a valuable application forNu-kote, International. The efficiency of theseapproaches allows developers to create a completesupply chain LP model, including all of the inputdata, in a single Excel workbook. Given the famil-iarity of many managers with the Excel softwarepackage, this exclusive use of Excel can signifi-cantly increase users’ comfort level with, and there-fore use of, advanced LPs for supply chainmanagement. Illustrative of this situation is thefact that our original LP model was intended foruse with only a few major product types, but theseefficiency improvements prompted management toexpand its use to support decisions regarding theentire line of 86 products. Total solution time forall 86 LPs was only 4 hours and 15 minutes, withno Excel crashing. This is down from the estimated27 hours (if Excel did not crash) before ourenhancements.

REFERENCES1. Fischer, G., Giaccardi, E., Ye, Y., Sutcliffe, A.G., and Mehandjiev, N.

Meta-Design: A manifesto for end-user development. Commun. ACM47, 9 (Sept. 2004), 33–37.

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-kote’s spread-

sheet linear programming models for optimizing transportation. Inter-faces 34, 2 (Feb. 2004), 139–146.

5. Prior, R. et al. Menlo Worldwide Forwarding optimizes its networkrouting. Interfaces 34, 1 (Jan. 2004), 26–38.

6. Tyagi, R., Kalish, P., Akbay, K., and Munshaw, G. GE Plastics opti-mizes the two-echelon global fulfillment network at its high perfor-mance polymers division. Interfaces 34, 5 (May 2005), 359–366.

7. What’s Best!; www.lindo.com/wbf.html.

Larry J. LeBlanc ([email protected]) is aprofessor of operations management and information technology at theOwen Graduate School of Management, Vanderbilt University,Nashville, TN.Michael R. Galbreth ([email protected]) is an assistantprofessor 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 class-room use is granted without fee provided that copies are not made or distributed forprofit or commercial advantage and that copies bear this notice and the full citation onthe first page. To copy otherwise, to republish, to post on servers or to redistribute tolists, requires prior specific permission and/or a fee.

© 2007 ACM 0001-0782/07/0800 $5.00

c

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