©CopyrightJASSS MertEdaliandHakanYasarcan(2014) AMathematicalModeloftheBeerGame JournalofArtificialSocietiesandSocialSimulation 17(4)2 <http://jasss.soc.surrey.ac.uk/17/4/2.html> Received:29-Nov-2013Accepted:28-Mar-2014Published:31-Oct-2014 Abstract Thebeerproduction-distributiongame,inshort"TheBeerGame",isamultiplayerboardgame,whereeachindividualplayeractsasanindependentagent.Thegameiswidelyusedinmanagementeducation aimingtogiveanexperiencetotheparticipantsaboutthepotentialdynamicproblemsthatcanbeencounteredinsupplychainmanagement,suchasoscillationsandamplificationofoscillationsasonemoves fromdownstreamtowardsupstreamechelons.Thegameisalsousedinnumerousscientificstudies.Inthispaper,weconstructamathematicalmodelthatisanexactone-to-onereplicaoftheoriginalboard versionofTheBeerGame.Weapplymodelreplicationprinciplesanddiscussthedifficultieswefacedintheprocessofconstructingthemathematicalmodel.Accordingly,themodelispresentedinfullprecision includingnecessaryassumptions,explanations,andunitsforallparametersandvariables.Inaddition,theadjustableparametersarestated,theequationsgoverningtheartificialagents'decisionmaking processesarementioned,andanRcodeofthemodelisprovided.WealsoshortlydiscusshowtheRcodecanbeusedinexperimentationandhowitcanalsobeusedtocreateasingle-playerormulti-player beergameonacomputer.OurcodecanproducetheexactsamebenchmarkcostvaluesreportedbySterman(1989)verifyingthatitiscorrectlyimplemented.ThemathematicalmodelandtheRcodepresented inthispaperaimstofacilitatepotentialfuturestudiesbasedonTheBeerGame. Keywords: AcquisitionLag,ArtificialAgents,BeerGame,MathematicalModel,Replication,SystemDynamics Introduction 1.1 Thebeerproduction-distributiongame,inshort"TheBeerGame",isamultiplayerboardgame,whereeachindividualplayeractsasanindependentagent.ItwasfirstintroducedbyJayForrester'sSystem Dynamics(SD)researchgroupoftheSloanSchoolofManagementattheMassachusettsInstituteofTechnologyinthe1960s.TheBeerGameisanapplicationofSDmodelingandsimulationmethodology,which iswidelyusedinmanagementeducationandaimstogiveanexperiencetotheparticipantsaboutthepotentialdynamicproblemsthatcanbeencounteredinsupplychainmanagement,suchasoscillationsand amplificationofoscillationsasonemovesfromdownstreamtowardsupstreamechelons(Akkermans&Vos2003;Barlas2002;Chen&Samroengraja2000;Forrester1961,1971;Größleretal.2008;Sterman 2000).Adetaileddescriptionoftheoriginalbeergame,whichiswidelyplayedbynumerouspeoplewithdifferenteducationalbackgroundsandisalsousedinscientificstudies,isgiveninSterman(1989)and CrosonandDonohue(2006).WelistsomeoftheworkonTheBeerGametogiveanideaabouttherangeofstudiesbasedonthegame.Jacobs(2000)introducedtheinternet-basedversionofTheBeerGameand reportedthatthisversionofthegamesignificantlyreducedthetimerequiredtoplaythegame.Accordingtohim,themainreasonforthisdifferenceisthatintheboardversionofthegame,participantsmanually keeptherecordsofinventoriesandbacklogsandcalculatethetotalcost,butintheinternet-basedversionofthegame,thegamesoftwaretakescareofthesecalculationsanddoessoinafasterandmoreaccurate mannercomparedtohumanagentsparticipatinginthegame.DayandKumar(2010)usedmobilephonestorunthegameandreportedimprovedaccuracyandspeedduetotheautomatedcalculations. IndependentfromJacobs'work(2000),Samuretal.(2004,2005)developedamulti-playercomputerizedversionofTheBeerGame.Theyfirstpresentverificationrunstodemonstratethattheirmodelcorrectly representstheboardgame.Thentheyconcludethatparticipantswhoplayedtheboardgameweremoresuccessfulthanthosewhoplayedthecomputerizedversionofthegame.Thepotentialcausesforthisresult includedtheslowerpaceofprogressoftheboardversion,whichgivesmoretimetothinkabouttheorderquantity,andtherelativelymorerealisticenvironmentoftheboardversion.Steckeletal.(2004)examined theeffectofreducedcycletimesandtheeffectofsharedpoint-of-sale(POS)informationamongthesupplychainmembersinTheBeerGame.Theyreportedthatreducedcycletimesleadtoreducedcosts,which isanexpectedresult.TheyfurtherreportedaninterestingresultthatthebenefitofPOSinformationsharingdependsonthecustomerdemandpattern.Chaharsooghietal.(2008)proposedareinforcementlearning (RL)modelfororderingpoliciesinsupplychainsandusedTheBeerGamemodelasanexperimentalplatform.Kim(2009)extendedTheBeerGameintoasupplynetworkandconductedagent-basedsimulations inhisstudy.MosekildeandLaugesen(2007)conductedanextensivebifurcationanalysisandshowedthatTheBeerGamecanproducecomplexdynamics.Thomsenetal.(1991)alsoshowedthatitispossibleto obtaincomplexdynamicsfromTheBeerGame,includinghyperchaos. 1.2 TheBeerGameisafourechelonsupplychainconsistingofaretailer,wholesaler,distributor,andfactory,whereeachoneoftheseechelonsismanagedbyanindependentagent.Inthismulti-agentgame,thereis aninventorycontrolproblemforeachoneoftheseechelons.Duringthegame,everyhumanagentinateamoffourisresponsibleforoneofthefourechelonsandmanagestheassociatedinventorybyplacing orders.Theordersflowfromdownstreamechelonstowardsupstreamechelonsandcasesofbeerflowintheoppositedirection.Theaimofthegameistominimizetheaccumulatedtotalcostobtainedbythe participantsofateammanagingeachechelon.Theaccumulatedcostgeneratedbyeachindividualecheloniscalculatedattheendofthegamebyaddingupallinventoryholdingandbacklogcostsobtainedatthe endofeachsimulatedweek(Sterman1989). 1.3 Atthebeginningofanongoingresearchstudy,amathematicalmodelthatisanexactone-to-onereplicaoftheoriginalboardversionofTheBeerGame,wasneeded.Moreover,wedecidedtouseamodelthathad equationsorganizedandexecutedinexactlythesameorderasthe'fivesteps'oftheboardgame.Webelievedthatsuchamodelwouldfacilitatetheverificationofourresultsandalsopotentiallycontributetothe analysisandunderstandingoftheboardgame.Wewerenotabletofindacomputermodelintheliteraturethatprovidedsuchanexactreplicaoftheboardgame.Therefore,wefirstconstructedamathematical modelthatisindependentfromprogramminglanguagesbasedonthedescriptionsofTheBeerGameprovidedinSterman(1989).Later,wecodedthismodelinR [1].Themathematicalmodelisgiveninfulldetail inthesectionnamed"Mathematicalmodelofthebeergame". 1.4 Axelrod(1997,pp.20–21)notedthat:"Replicationisoneofthehallmarksofcumulativescience.Itisneededtoconfirmwhethertheclaimedresultsofagivensimulationarereliableinthesensethattheycanbe reproducedbysomeonestartingfromscratch."Therearemanyotherresearcherswhoalsoemphasizetheimportanceofreplicationasavalidationapproach(seeforexample,Edmonds&Hales2003,2005; Miodowniketal.2010;Wilensky&Rand2007).Modelreplicationrequiresasignificanteffortbecausecomplexdynamicmodelsarehighlysensitivetotheimplementationdetails(Merloneetal.2008).Inhispaper entitled"AdvancingtheArtofSimulationintheSocialSciences",Axelrod(1997)reportsproblemsthatwereencounteredinreplicatingsimulationmodelsdescribedinotherpublishedwork.AccordingtoAxelrod, someofthereplicationproblemsarecausedbyambiguities,gaps,anderrorsinthemodeldescriptions.DespiteallthedetailsprovidedbySterman(1989),asignificanteffortwasrequiredtoobtainaone-to-one mathematicalreplicaoftheboardversionofthegame,andweexperienceddifficultiessimilartotheonesexperiencedbyAxelrod(1997):(1)Stermanprovidedequationsforthegeneralstockmanagementtask, whichcanformabasisinobtainingTheBeerGameequations.However,theexactequationsforTheBeerGamearenotpresentinSterman'spaper,exceptfortheorderingequation.(2)Thereisanambiguityin thetie-breakingruleusedinroundingthevaluesoftheorders.Hence,weareforcedtoassumeatie-breakingruleinroundingthevalues.(3)Expectationformationisassumedtobeperformedinformallybya humanparticipantinhismindand,therefore,isnotlistedamongthefivestepsofTheBeerGame.However,inthemathematicalmodel,thedecisionmakingprocessisalsocapturedasapartofthemodeland, therefore,wehavetodetermineitsplaceamongthestepsofthegame.(4)Thereisanerrorregardingtheconceptualizationofthedelaydurations.Inthesectionnamed"Adiscussiononacquisitionlags",we explainthemisconceptualizationofthedurationofacquisitionlagsthatarepresentinthegameandtheerrorthatcanpotentiallybecausedbyit.NotethatNorthandMacal(2002)alsoreporteddifficultiesthatthey facedintheirBeerGamedockingprocess. 1.5 AlthoughTheBeerGameisanapplicationofSDmethodology,aone-to-oneSDmodelofthegamecannotbedirectlyobtainedbecausetheorderofcalculationsfollowedinthegameandtheorderofcalculations followedinSDmethodologywillnotmatchunlesstheorderofcalculationsinthecorrespondingSDmodeliscarefullyalteredbyintroducingadditionalvariablestothemodel.Thismismatchalsocontributestothe difficultyinobtainingacompletemathematicalmodelofthegame.NorthandMacal(2002)implementedTheBeerGameusingthreedifferentplatformsandtheyreportedsubtledifferencesintheoutputsofthose threedifferentimplementations,whichwethinkthosedifferencescouldonlybeeliminatedbysubstantialamountofadditionaleffort. 1.6 Inthesectionnamed"Rcodeofthemathematicalmodelasanexperimentalplatform",weprovideanRcode[1](RCoreTeam2013)ofthemathematicalmodelpresentedinthispapertoeasethesimulation replicationsofourmodel.Inthesamesection,wealsoshortlydiscusshowthecodecanbeusedinexperimentationandhowitcanbeusedtocreateasingle-playerormulti-playerbeergameonacomputer. 1.7 InSterman(1989),theanchor-and-adjustheuristicformulationthatissuggestedtobeusedindecisionmakingandtheanchor-and-adjustheuristicformulationthatisusedinmodelingtheparticipantbehaviorare slightlydifferent.Inthesectionnamed"Verificationofthemathematicalmodel",weexplainthedifferencesbetweenthetwoformulations,provideadifferentsetofequationsfortheanchor-and-adjustheuristic formulationthatisusedinmodelingtheparticipantbehavior,executethecorrespondingRcode[2]withtheoptimumbenchmarkparametervaluesgivenbySterman,andobtaintheexactsamebenchmarkcost valuesalsopresentedbyhim.ThisprocessverifiesthatourRcodeiscorrectlyimplementedanditalsovalidatesthatourmodelisacorrectandexactrepresentationoftheboardversionofTheBeerGame. Mathematicalmodelofthebeergame 2.1 Toconductthisresearch,wefirstconstructedamathematicalmodelofTheBeerGamebasedonafigureoftheboardgame(seeFigure1inthispaper),equations,thefivestepsofthegame,anddescriptions giveninSterman(1989). http://jasss.soc.surrey.ac.uk/17/4/2.html 1 19/10/2015 Figure1.TheBoardofTheBeerDistributionGame(Figure2inSterman1989,p.327) Parametersandinitialvaluesofthemathematicalmodel 2.2 sat i=1[week]fori=R,W,D,F (1) mdti=1[week]fori=R,W,D (2) st i=2[week]fori=W,D,F (3) plt =2[week] (4) Wheresat (1/αSinSterman1989)standsforthestockadjustmenttime ,mdtstandsforthemailingdelaytime,st standsfortheshipmenttime ,andplt standsfortheproductionleadtime.R,W,D,andF stand, respectively,fortheretailer,wholesaler,distributor,andfactoryechelons(Figure1).Notethatsat ,wsl,θ,andI*arethedecisionparameters(equations1,5,6,and10).Thedifferentsetsofvaluesofthese parametersrepresentthedifferentinstancesoftheanchor-and-adjustorderingpolicyand,togetherwiththedecisionmakingvariables(equations8,9,11–14,47–50,54–57,and63–68),theydefinehowtheartificial agentsmakedecisions.Notethatthedifferentsetsofvaluesfortheseparameterswillnotmakethemathematicalmodeldivertfrombeinganexactone-to-onereplicaoftheoriginalboardversionofTheBeer Game. wsli=1[dimensionless]fori=R,W,D,F (5) θi=0.2[1/week]fori=R,W,D,F (6) wsl(βinSterman1989)standsfortheweightofsupplylineandθ(alsoθinSterman1989)standsforthesmoothingfactorusedbyeachecheloninthegameinformingexpectationsusingthesimpleexponential smoothingforecastingmethod.Theoretically, θcantakeavaluebetween0and1. (7) Intheequationabove,ENDCDstandsfortheend-customerdemand.Tosavespace,theunitcaseisusedtorepresentacaseofbeer. EECD 0=4[case/week] (8) EOi,0 =4[case/week]fori=R,W,D (9) EECD standsfortheexpectedend-customerdemand ,whichisassumedtobecalculatedbytheretailer.EOrepresentsexpectedorderscalculatedbythewholesaler,distributor,andfactoryechelonsbasedonthe orderstheyreceivefromtheirrespectivecustomers(i.e.,theretailer'sordersreceivedbythewholesaler,thewholesaler'sordersreceivedbythedistributor,andthedistributor'sordersreceivedbythefactory). Ii* =0[case]fori=R,W,D,F (10) (11) (12) (13) (14) I*representsthedesiredinventory,andSL*standsforthedesiredsupplyline. 2.3 Bi,0 =0[case]fori=R,W,D,F (15) Ii,0 =12[case]fori=R,W,D,F (16) ITI1i,0 =4[case]fori=R,W,D (17) WIPI10=4[case] (18) ITI2i,0 =4[case]fori=R,W,D (19) WIPI20=4[case] (20) Theequations15through20representinitialbacklogs,initialinventories,andinitialin-transitinventories(i.e.,thevaluesofthestatevariablesatweekzero).ITI2(in-transitinventory2)representstheshippingdelay boxjustbeforetheinventorybox,andITI1(in-transitinventory1)representstheshippingdelayboxbeforethat(seeFigure1).ThevalueofITI1belongingtoanechelonisshiftedtoITI2ofthesameechelonafter onesimulatedweek.ITI2isaddedtotheinventory( I)orsubtractedfromthebacklog(B)afteraweek.Likewise,WIPI1andWIPI2standforwork-in-processinventories.WIPI1isthework-in-processinventoryofthe factorythatwillbeshiftedto WIPI2afteraweekandthatwilleventuallyreachtothefactory'sinventory.WIPI2isthework-in-processinventorythatwillbeaddedtothefactory'sinventory(IF)orsubtractedfromthe backlog( BF)afteraweek. O i,1 =4[case/week]fori=R,W,D (21) PSR 1=4[case/week] (22) IO i,1 =4[case/week]fori=W,D,F (23) O istandsforordersthatareplacedbyecheloni(retailer,wholesaler,anddistributor).PSR standsfortheproductionstartrate,whichistheproductionordergivenbythefactoryitself.IO istandsfortheincoming orders(theboxrighttotheboxofordersplacedinFigure1)thatarereceivedbyecheloni.Thepurchaseorders(O )placedbytheretailer,wholesaler,anddistributorandtheproductionorders(PSR )givenby factoryatweektareplacedforweek( t+1).Orders placedatweek(t+1)bytheretailer,wholesaler,anddistributorbecometheincomingorders(IO ),respectively,forthewholesaler,distributor,andfactoryat week(t+2).Therefore,theend-customerdemand(ENDCD),whichisgivenbyEquation7,orders(O ),andproductionstartrate(PSR )havenovalueatweekzero,buttheyareassignedavalueforthefirsttimeat week1. http://jasss.soc.surrey.ac.uk/17/4/2.html 2 19/10/2015 TC i,0 =0[$]fori=R,W,D,F (24) uihc=0.5[$/(week·case)] (25) ubc=1[$/(week·case)] (26) TC ,uihc,andubcstandforthetotalcostgeneratedbyanechelon,theunitinventoryholdingcost,andtheunitbacklogcost,respectively. 2.4 TheremainingmodelequationsaregiveninanorderbasedonthestepsofthegamepresentedinSterman(1989).Thissequenceshouldstrictlybefollowedwhileperformingcalculationstoensureanaccurate representationoftheboardversionofTheBeerGame(Figure1). 2.5 Afterinitializingtheboard,thegamefacilitatordeclaresthetimeasweek1,andthegamestartsfromStep1.Afterthecompletionofallsteps(attheendofStep5),thefacilitatoraddsoneweektothecurrenttime, declaresit,andthegamecontinuesrepeatingthesameprocess. Step1.Receiveinventoryandadvanceshippingdelays 2.6 2.7 InTheBeerGame,casesofbeerflowfromrighttoleft(i.e.,fromtheupperechelontothelower)andordersflowfromlefttoright(i.e.,fromlowerechelontotheupper).Inthefirststepofthegame,thein-transit inventory(work-in-processinventoryforthefactory)thatisimmediatelytotherightofaninventoryisaddedtotheinventorybytheparticipants.Afterthat,thecontentsoftherightmostin-transitinventoryboxesare shiftedtothenear-rightin-transitinventoryboxes,andthecontentsoftherightmostwork-in-processinventoryboxareshiftedtothenear-rightwork-in-processinventorybox.Asaresult,therightmostin-transit inventoryboxesandWIPI1becomeempty. Ii, t =Ii, t -1+ITI2i, t -1[case]fori=R,W,D (27) IF, t =IF, t -1+WIPI2t -1[case] (28) ITI2i, t =ITI1i, t -1[case]fori=R,W,D (29) WIPI2t =WIPI1t -1[case] (30) ITI1i, t =0[case]fori=R,W,D (31) WIPI1t =0[case] (32) Equations31and32areredundantinthesensethattheexclusionoftheseequationswillnotpreventthecorrectsimulationofthemathematicalmodel,butwepresenttheminordertofollowthesameexact processasintheboardversionofthegame. Step2.Fillorders 2.8 Inthisstep,eachecheloncalculatestheamountofbeertobeshippedtoitscustomer(i.e.,shipmentsfromretailertoendcustomer,fromwholesalertoretailer,fromdistributortowholesaler,andfromfactoryto distributor)byconsideringincomingordersfromthecustomer,thebacklogoforders,andtheinventoryofthatechelon.Aftercalculatingshipments(S),eachparticipant,exceptfortheretailer,puts shipmentstothe boxesontheirnearleft(i.e.,ITI1R,ITI1W,ITI1D,andWIPI1areupdated). (33) (34) (35) (36) 2.9 Theshipmentvariablesareflowvariablesinessence,andtheunitofthesevariablesis[case/week].However,weusestockvariablesthathave[case]astheirunitincalculatingtheshipmentvariables.Therefore, correctionsintheunitsarenecessary.Accordingly,(1/week)and(1week)areusedintheshipmentequations33–36.Thesecorrectionshavenoeffectonthenumericalvalues,buttheycorrecttheunits.Toeasily comprehendtheissue,consideracarthattraveledforonehourandcovered50milesinthisjourney.Insuchacase,theaveragespeedofthecarduringthatonehourwouldbe50milesperhour.Althoughthe unitsofthedistancecoveredbythecaranditsaveragespeedaredifferent,theirnumericalvaluesarenot.Notethat,forsimilarreasons,wealsousethesametypeofcorrectioninmanyoftheremaining equations.Asafurtherexplanation;inadiscretetimemodel,thesimulationtimestepbecomesequaltotheunittimeofthatsimulationmodel.Insuchamodel,whenanumericalvaluewithaunitof[items/time] accumulateforoneunittime,theresultingnumericalvaluewillnotchange,butitsunitwillbe[items]. ITI1i, t =Si, t ·(1week)[case]fori=R,W,D (37) WIPI1t =PSR t ·(1week)[case] (38) Step3.Recordinventoryorbacklogontherecordsheet 2.10 Afterfillingorders,participantseithercounttheirinventoriesiftheyhavechipsrepresentingthecasesofbeerintheirinventoryboxesorcalculatethebacklogsiftheyfailtosatisfythetotalityofthepastbacklogs andthecurrentordersreceivedfromtheircustomers.Theyrecordtheinventoryorbacklogontheirrecordsheets.Thisisrepresentedbytheequationsbelow: BR, t =BR, t -1+(ENDCDt −SENDC, t )·(1week)[case] (39) BW, t =BW, t -1+(IO W, t −SR, t )·(1week)[case] (40) BD, t =BD, t -1+(IO D, t −SW, t )·(1week)[case] (41) BF, t =BF, t -1+(IO F, t −SD, t )·(1week)[case] (42) IR, t =IR, t −SENDC, t ·(1week)[case] (43) IW, t =IW, t −SR, t ·(1week)[case] (44) ID, t =ID, t −SW, t ·(1week)[case] (45) IF, t =IF, t −SD, t ·(1week)[case] (46) Inthisstudy,theequalitysignisusedinassigningvaluestoparametersandvariables,anditdoesnotimplyamathematicalequality.Therefore,thesamevariablecanappearonleftandrightsidesofthesame equation(see,forexample,equations43–46). Expectationformation 2.11 Expectationformationisassumedtobeperformedinformallybyaparticipantinhismindand,therefore,isnotlistedamongthefivestepsofTheBeerGame.Sterman(1989)modeledtheexpectationformation processusingthesimpleexponentialsmoothingmethod(seeEquation9inSterman1989).Thisprocessisreflectedbytheequationsgivenbelow: EECD t =EECD t -1+θR·(ENDCDt −EECD t -1)·(1week)[case/week] (47) EOR, t =EOR, t -1+θW·(IO W, t −EOR, t -1)·(1week)[case/week] (48) EOW, t =EOW, t -1+θD·(IO D, t −EOW, t -1)·(1week)[case/week] (49) http://jasss.soc.surrey.ac.uk/17/4/2.html 3 19/10/2015 EOD, t =EOD, t -1+θF·(IO F, t −EOD, t -1)·(1week)[case/week] (50) Step4.Advancetheorderslips 2.12 Orders (O )placedbytheretailer,wholesaler,anddistributorbecomeincomingorders(IO ),respectively,forthewholesaler,distributor,andfactoryafteraweek. IO W, t +1=O R, t [case/week] (51) IO D, t +1=O W, t [case/week] (52) IO F, t +1=O D, t [case/week] (53) Step5.Placeorders 2.13 IntheboardversionofTheBeerGame,participantsplaceordersandproductionrequestsinthislaststep.AccordingtoSterman(1989),thedecisionmakingprocessofparticipantscanberepresentedbyusingthe anchor-and-adjustdecisionheuristic.Theequationsbelow(54–68)areallpartofthisheuristic,whichfinallyresultsinordersandproductionrequests.Theretailer,wholesaler,anddistributorplaceorders(equations 65–67)andthefactorydecidesontheproductionrequests(Equation68).SL*standsforthedesiredsupplyline,EIstandsfortheeffectiveinventory ,SLstandsforthesupplyline,SLAstandsforthesupplyline adjustment,IAstandsfortheinventoryadjustment ,andPSR standsfortheproductionstartrate.Theanchoroftheanchor-and-adjustheuristicistheexpectedlossfromthestock,whichisEECD t inEquation65, EOR,tinEquation66,EOW,tinEquation67,andEOD,tinEquation68. (54) (55) (56) (57) EIi, t =Ii, t −Bi, t [case]fori=R,W,D,F (58) SLR, t =IO W, t +1·(1week)+BW, t +ITI1R, t +ITI2R, t [case] (59) SLW, t =IO D, t +1·(1week)+BD, t +ITI1W, t +ITI2W, t [case] (60) SLD, t =IO F, t +1·(1week)+BF, t +ITI1D, t +ITI2D, t [case] (61) SLF, t =WIPI1t +WIPI2t [case] (62) (63) IAi, t =(Ii* −EIi, t )/sat i[case/week]fori=R,W,D,F (64) (65) (66) (67) (68) 2.14 Intheboardversionofthegame,humanagentsgiveorders.However,inourmodel,artificialagentsgiveordersasdescribedbyequations65–68.Allequationsbelongingtothefivestepsofthegame(equations 27–69)arecalculatedforthecurrentsimulatedweek,exceptfortheequationsforincomingorders(51–53),orders(65–67),andproductionstartrate(68).Theequationsfor incomingorders,orders,andproduction startratearecalculatedforthenextsimulatedweek.Intheboardversionofthegame,orderscanonlybeintegers.Theroundingfunction(||||)usedinequations65–68(andalsoequations72–75)reflectsthis aspectofthegame.Inroundingthevalues,weassumethatthe"roundhalfawayfromzero"tie-breakingruleisused. 2.15 Intheoriginalgame,theaccumulatedtotalcostofeachecheloniscalculatedattheendofthegamefromtherecordsheetkeptbytheparticipantmanagingthatechelon.Inthemathematicalmodel,the totalcostis calculatedattheendofeachsimulatedweekusingtheequationgivenbelow: TC i, t =TC i, t -1+(uihc·Ii, t +ubc·Bi, t )·(1week)[$]fori=R,W,D,F (69) 2.16 Afterthisfinalstep,thesimulatedtimeisincreasedbyoneweekandannouncedtotheparticipants.ThegamecontinuesbyrepeatingthewholeprocessstartingfromStep1untilStep5ofweek36iscompleted. Afterthesimulationends,themainperformancemeasure,whichisteamtotalcost(TTC),iscalculated. TTC=TC R,36 +TC W,36 +TC D,36 +TC F,36 [$] (70) Rcodeofthemathematicalmodelasanexperimentalplatform 3.1 TheRcode[1](RCoreTeam2013)ofthemathematicalmodelisreadytobeexecuted;oneneedstosimplycopythecodefromthetextfileandpasteittoRconsoleinordertoexecuteit.Asmentionedbefore, equations1,5,6,and10arethedecisionparameters(sat ,wsl,θ,andI*)thatdescribethedecisionmakingprocessesoftheartificialagents,andtheirdifferentvaluesrepresentdifferentinstancesoftheanchorand-adjustorderingpolicy.Hence,onecanchangethevaluesoftheseparametersinthecodewithoutmakingthemathematicalmodeldivertfrombeinganexactone-to-onereplicaoftheoriginalboardversionof TheBeerGame.Afterthechange,onecanre-executethecodetoobtainthecorrespondingcostvalues.TheweeklyvaluesofanyvariablecaneasilybedisplayedbysimplytypingthenameofthatvariableinR console.Inthisway,thecodeservesasanexperimentalplatform.Onecanalsogenerategraphicaloutputsusingthecode [3].Wesetsat =2,wsl=0.8,θ=0.4,andI*=0forallechelonstoobtaintheexample dynamicspresentedinfigures2–4. http://jasss.soc.surrey.ac.uk/17/4/2.html 4 19/10/2015 Figure2.AnexampleofInventoryDynamics Figure3.AnexampleofBacklogDynamics http://jasss.soc.surrey.ac.uk/17/4/2.html 5 19/10/2015 Figure4.AnexampleofDynamicsofOrders 3.2 Tocreatedifferentsettingsforasimulationexperimentwithoutalteringthemodelstructure,onecanchangetheendcustomerdemandpatterngivenbyEquation7andplaywiththeinitialvaluesofthestock variables,butthosechangeswillimplyadiversionfromtheoriginalsettingofTheBeerGame.Themodelstructurecanalsobealtered.Forexample,onecanchangethedelaytimes mdt(mailingdelaytime),st ( shipmenttime ),or plt (productionleadtime).However,suchachangewouldimplyanincreaseordecreaseinthenumberoftheassociatedvariables.Forinstance,ifonewantstoincreasetheshipmenttimeof anechelonfromtwoweekstothreeweeks,hemustintroduceonemorein-transitinventoryvariable(i.e.,ITI3).AnotherexamplecouldbetheadditionofproductioncapacitytoEquation68ortheadditionof shipmentcapacitiestoequations33–36. 3.3 Simulationexperimentscanalsobeconductedinanotherprogrammingenvironmentbyre-writingthecodeusingthatprogramminglanguage.Onecanalsodevelopamulti-playerbeergameusingaprogramming environmentthatsupportsuserinterfacecreation.Inthatcase,therespectiveorderequationsdescribingtheartificialagents'decisionmakingprocessesshouldberemovedfromthecodeandfourhumanagents wouldbeaskedtoinsertvaluesforordersofthefourechelons.Alternatively,asingle-playerversionofthegamecanbeconstructed.Inthiscase,ahumanagentwouldgiveordersforoneofthefourechelonsand threeartificialagentswouldcontroltheordersoftheremainingechelons. Adiscussiononacquisitionlags 4.1 InTheBeerGame,theacquisitionlagisthesummationofthemailingdelaytimeandshipmenttime fortheretailer,wholesaler,anddistributor,anditisdirectlyequaltotheproductionleadtimeforthefactory.In thegame,ordersplacedbyanechelon(i.e.,theretailer,wholesaler,ordistributor)atweek twillreachtheinventoryofthatechelonatweek(t+4)giventhatthesupplierofthatechelonhassufficientinventoryto fulfilltheorder.Forthefactory,ordersgivenatweektwillbereceivedatweek(t+3).Therefore,Sterman(1989)statesmanytimesinhispaperthattheacquisitionlagfortheretailer,wholesaler,anddistributoris atleast4weeks,anditisalways3weeksforthefactory.However,weclaimthatordersplacedatStep5ofweektareforweek( t+1)(seeequations21,22,65-68,and72-75).Therefore,slightlychangingthe game,byplacingordersatthebeginningofStep1ofweek(t+1)insteadofplacingthemattheendofStep5ofweekt,willmakenodifference.Accordingly,inourmathematicalmodel,theacquisitionlagsusedin calculatingthevaluesofthe desiredsupplylineare3,3,3,and2weeksfortheretailer,wholesaler,distributor,andfactory,respectively(seeequations2–4,11–14,and54–57).Inthedesiredsupplylineequations (11–14and54–57),whichcorrespondtoEquation7inSterman(1989),usingacquisitionlagsof4weeks(fortheretailer,wholesaler,anddistributor)and3weeks(forthefactory)insteadof3weeks(fortheretailer, wholesaler,anddistributor)and2weeks(forthefactory)willcreateasteady-stateerrorinthedynamics. Verificationofthemathematicalmodel 5.1 Afterconstructingaone-to-onemodelofTheBeerGame,weenteredtheoptimaldecisionparametervaluessuggestedbySterman(1989)intoourmodel.Theseparametervaluesare0,1,and1for θ(smoothing factor;alsoθinSterman1989),sat (stockadjustmenttime ;1/αSinSterman1989),andwsl(weightofsupplyline;βinSterman1989),respectively,forallechelons.TheotherdecisionparametergivenbySterman isS',whichisdefinedasI*(desiredinventory ;S* inSterman1989)plus wsltimesSL*(desiredsupplyline;SL*inSterman1989);seeEquation71andtheunnumberedS'equationinSterman(1989,p.334). StermangivestheoptimalvaluesofS'as28,28,28,and20fortheretailer,wholesaler,distributor,andfactoryechelons,respectively. Si'=Ii* +wsli·SLi* [case]fori=R,W,D,F 5.2 (71) Inourmathematicalmodel,theSL*valuesaredynamicallyupdatedastheexpectedordersfromthecustomerschange.Thus,S'shouldalsobeavariable.However,StermanusesconstantSL*andS'values.If theS'valueisusedinsteadofseparateI*andSL*valuesandifitisaconstant,theorderequations65–68becomeasfollows: (72) (73) (74) (75) 5.3 Aftersimulatingourmodelwiththeoptimumθ,sat ,wsl,andS'valuesusingtheorderequations72–75,weobtainedtheexactsamebenchmarkcostvaluesreportedbySterman,whichsupportsourclaimthatour modelisanexactrepresentationofTheBeerGame.NotethattheconceptualerrorregardingtheacquisitionlagshasnoeffectonthemodelusedbyStermaninoptimizingtheparametersbecauseS'isaconstant; itisnotdynamicallycalculatedduringtheoptimizationruns.TheRcodeofthemathematicalmodelthatismodifiedwithandfortheorderingequations72–75isalsoprovided[2].InthisversionoftheRcode,sat , wsl,θ,andS'arethedecisionparameters(equations1,5,6,and71).Thedifferentsetsofvaluesoftheseparametersrepresentthedifferentinstancesoftheanchor-and-adjustorderingpolicyand,togetherwiththe decisionmakingvariables(equations8,9,47–50,and72–75),theydefinehowtheartificialagentsmakedecisions. 5.4 Asafinalstepinverificationofthemathematicalmodel,wefirstremovetheorderingequationsfromtheRcode[1], [2]and,instead,insertpseudo-randomordersintothecode.Wealsoplaytheboardversionofthe gamewiththesamepseudo-randomorders.ThedynamicsobtainedfromtheRcodeandtheboardversionofthegameexactlymatch. Conclusions 6.1 Inthisstudy,weconstructedadetailedmathematicalmodelthatrepresentsandreplicatestheexactexecutionorderofthestepsoftheoriginalboardversionofTheBeerGame.Asapartoftheintroductionsection, wealsostatethedifficultiesthatwefacedintheconstructionprocessofsuchanexactone-to-onereplica.Oneofthemaindifficultiesisanerrorregardingtheconceptualizationofthedelaydurationsasexplainedin detailinthesectionnamed"Adiscussiononacquisitionlags".Wepresenttheconstructedmodelinfullprecisionincludingnecessaryassumptions,explanations,andunitsforallparametersandvariablesinthe sectionnamed"Mathematicalmodelofthebeergame". 6.2 AccordingtoAxelrod(1997),internalvalidity(i.e.,verification),usability,andextendibilityarethethreegoalsoftheprogrammingofasimulationmodel.Toincreasetheusabilityofthemodelpresentedinthispaper, westatedtheadjustableparameters,mentionedtheequationsgoverningtheartificialagents'decisionmakingprocesses,andwroteanRcode[1]ofthemodel.Forextendibility,inthesectionnamed"Rcodeofthe http://jasss.soc.surrey.ac.uk/17/4/2.html 6 19/10/2015 mathematicalmodelasanexperimentalplatform",weshortlydiscussedhowthecodecanbeusedinexperimentationandhowitcanbeusedtocreateasingle-playerormulti-playerbeergameonacomputer.For verification,wemodifiedsomeoftheequationsbelongingtothedecisionmakingformulationsoftheartificialagentsandpresentedtheminthesectionnamed"Verificationofthemathematicalmodel".Wealso modifiedtheRcodeaccordingly.Finally,weexecutedthemodifiedRcode [2]withtheoptimumbenchmarkparametervaluesgivenbySterman(1989)andobtainedtheexactsamebenchmarkcostvaluesalso presentedbyhimverifyingthatourRcodeiscorrectlyimplemented.ThisalsovalidatesthatourmodelisacorrectandexactrepresentationoftheboardversionofTheBeerGame. Acknowledgements TheauthorsthankDr.YamanBarlas,Dr.NigelGilbert,Dr.GönençYücel,andthesecondrefereeofthisarticlefortheirvaluablesuggestions. ThisresearchissupportedbyaMarieCurieInternationalReintegrationGrantwithinthe7thEuropeanCommunityFrameworkProgramme(grantagreementnumber:PIRG07-GA-2010-268272)andalsoby BogaziciUniversityResearchFund(grantno:6924-13A03P1). Notes 1TheRcodeofthemathematicalmodelcanbefoundathttp://www.openabm.org/model/4161/version/1/view 2TheRcodeofthemodifiedmathematicalmodelcanbefoundathttp://www.openabm.org/model/4163/version/1/view 3TheRcodeofthemathematicalmodel(codeforgraphicaloutputadded)canbefoundathttp://www.openabm.org/model/4166/version/1/view References AKKERMANS,H.&Vos,B.(2003).Amplificationinservicesupplychains:Anexploratorycasestudyfromthetelecomindustry.ProductionandOperationsManagement,12(2) ,204–223.[doi:10.1111/j.19375956.2003.tb00501.x] AXELROD,R.(1997).Advancingtheartofsimulationinthesocialsciences.Complexity,3(2) ,16–22.[doi:10.1002/(SICI)1099-0526(199711/12)3:2<16::AID-CPLX4>3.0.CO;2-K] BARLAS,Y.(2002).SystemDynamics:SystemicFeedbackModelingforPolicyAnalysis.InKnowledgeforSustainableDevelopment:AnInsightintotheEncyclopediaofLifeSupportSystems(pp.1131–1175). Paris,FranceandOxford,UK:UNESCO/EOLSS. CHAHARSOOGHI,S.K.,Heydari,J.&Zegordi,S.H.(2008).Areinforcementlearningmodelforsupplychainorderingmanagement:Anapplicationtothebeergame.DecisionSupportSystems,45(4) ,949–959. [doi:10.1016/j.dss.2008.03.007] CHEN,F.&Samroengraja,R.(2000).Thestationarybeergame. ProductionandOperationsManagement,9(1) ,19–30.[doi:10.1111/j.1937-5956.2000.tb00320.x] CROSON,R.&Donohue,K.(2006).Behavioralcausesofthebullwhipeffectandtheobservedvalueofinventoryinformation.ManagementScience,52(3) ,323–336.[doi:10.1287/mnsc.1050.0436] DAY,J.M.&Kumar,M.(2010).UsingSMStextmessagingtocreateindividualizedandinteractiveexperiencesinlargeclasses:Abeergameexample.DecisionSciencesJournalofInnovativeEducation,8(1) , 129–136.[doi:10.1111/j.1540-4609.2009.00247.x] EDMONDS,B.&Hales,D.(2003).Replication,ReplicationandReplication:SomeHardLessonsfromModelAlignment.JournalofArtificialSocietiesandSocialSimulation,6(4) ,11 <http://jasss.soc.surrey.ac.uk/6/4/11.html> EDMONDS,B.&Hales,D.(2005).ComputationalSimulationasTheoreticalExperiment.TheJournalofMathematicalSociology,29(3) ,209–232.[doi:10.1080/00222500590921283] FORRESTER,J.W.(1961).IndustrialDynamics.Waltham,MA:PegasusCommunications. FORRESTER,J.W.(1971).PrinciplesofSystems.Waltham,MA:PegasusCommunications. GRÖßLER,A.,Thun,J.H.&Milling,P.M.(2008).Systemdynamicsasastructuraltheoryinoperationsmanagement.ProductionandOperationsManagement,17(3) ,373–384.[doi:10.3401/poms.1080.0023] JACOBS,F.R.(2000).Playingthebeerdistributiongameovertheinternet.ProductionandOperationsManagement,9(1) ,31–39.[doi:10.1111/j.1937-5956.2000.tb00321.x] KIM,W.-S.(2009).EffectsofaTrustMechanismonComplexAdaptiveSupplyNetworks:AnAgent-BasedSocialSimulationStudy.JournalofArtificialSocietiesandSocialSimulation,12(3) ,4 <http://jasss.soc.surrey.ac.uk/12/3/4.html> MERLONE,U.,Sonnessa,M.&Terna,P.(2008).HorizontalandVerticalMultipleImplementationsinaModelofIndustrialDistricts.JournalofArtificialSocietiesandSocialSimulation,11(2) ,5 <http://jasss.soc.surrey.ac.uk/11/2/5.html> MIODOWNIK,D.,Cartrite,B.&Bhavnani,R.(2010).BetweenReplicationandDocking:"AdaptiveAgents,PoliticalInstitutions,andCivicTraditions"Revisited.JournalofArtificialSocietiesandSocialSimulation, 13(3) ,1<http://jasss.soc.surrey.ac.uk/13/3/1.html>. MOSEKILDE,E.&Laugesen,J.L.(2007).Nonlineardynamicphenomenainthebeermodel.SystemDynamicsReview,23(2–3),229–252.[doi:10.1002/sdr.378] NORTH,M.&Macal,C.(2002).TheBeerDock:ThreeandaHalfImplementationsoftheBeerDistributionGame.<http://backspaces.net/sun/SCSim/BeerDock.pdf>.Archivedat: <http://www.webcitation.org/6LUrLLIVQ>. RCORETEAM.(2013).R:Alanguageandenvironmentforstatisticalcomputing.RFoundationforStatisticalComputing.Vienna,Austria.<http://www.R-project.org/> SAMUR,M.G.,Eren,E.C.,Hancer,O.&Tunakan,B.B.(2004).TestingSimultaneousMultipleDecisionMakerCharacteristicsinaDynamicFeedbackEnvironment.B.Sc.Project,BogaziciUniversity. SAMUR,M.G.,Eren,E.C.,Hancer,O.&Tunakan,B.B.(2005).Acomputerizedbeergameanddecision-makingexperiments.InProceedingsofthe23rdInternationalSystemDynamicsConference.Boston,MA. STECKEL,J.H.,Gupta,S.&Banerji,A.(2004).Supplychaindecisionmaking:Willshortercycletimesandsharedpoint-of-saleinformationnecessarilyhelp?ManagementScience,50(4) ,458–464. [doi:10.1287/mnsc.1030.0169] STERMAN,J.D.(1989).Modelingmanagerialbehavior:misperceptionsoffeedbackinadynamicdecisionmakingexperiment.ManagementScience,35(3) ,321–339.[doi:10.1287/mnsc.35.3.321] STERMAN,J.D.(2000). BusinessDynamics:SystemsThinkingandModelingforaComplexWorld.Boston,MA:Irwin/McGraw-Hill. THOMSEN,J.S,Mosekilde,E.&Sterman,J.D.(1991).Hyperchaoticphenomenaindynamicdecisionmaking.InE.MosekildeandL.Mosekilde(Eds.),Complexity,Chaos,andBiologicalEvolution(pp.397–420). NewYork:PlenumPress.[doi:10.1007/978-1-4684-7847-1_30] WILENSKY,U.&Rand,W.(2007).MakingModelsMatch:ReplicatinganAgent-BasedModel.JournalofArtificialSocietiesandSocialSimulation,10(4) ,2<http://jasss.soc.surrey.ac.uk/10/4/2.html> http://jasss.soc.surrey.ac.uk/17/4/2.html 7 19/10/2015