Thursday, April 27, 2006

Repast Model of the Week: The Beer Game

I thought it would be quite useful to keep track of the Repast models I find, I have found by looking at other peoples code a good way of learning about Repast. It is also a bit of an experiment, how many models are out there.

For the models I intend to create an executable created using exe4J (a simple piece of software that converts jar files into executables, if you like the idea of this you can download a free trial version). Initially I wanted to use Java Web Start but I have been having issues creating an executable jar with only the code needed and not all the other Java classes. I have tried using Repasts’ JarBuilder but I cant seem to get it to work (if you know how to create a simple jar especially using JarBuilder please drop me a line).

For each model I also intend to supply as much information as possible, i.e. who created the model, where I downloaded it from (i.e. the source code) and related articles and links that I find along the way as I not trying to take credit of the models.

The Beer Game
The "beer game" agent-based model is a classic supply chain exercise. Created by Michael North to illustrate how the ABM approach can be used and to show how a simple model can reveal important insights. North recreates Sterman’s “Beer Game” simulation from its original Systems Dynamics implementation (Sterman 1989) to an agent-based simulation using Repast.

The supply chain consists of four stages: factories, distributors, wholesalers, and retailers who respond to customers’ demand by executing behaviors. The flows of goods and information in the form of orders between stages (agents) as well as physical shipments are included in the model, but the flows of payments and the additional complexities of pricing, negotiation, and financial accounting that this would entail are not included. However, Macal and North (2005) note that these aspects of supply chain agent behavior could easily be incorporated in the agent-based version of the supply chain model. supply chain agents only have access to local information. Within the model no agent has a global view of the supply chain or is in a position to optimize the system as a whole. Agents adopt decision rules that only this local information in making their decisions.

“The goal of the agents in the model is to manage their inventory in such a way as to minimize their costs through judicious decisions based on how much to order each period. When inventories are too low and there is a danger of running out of stock, agents order more; when inventories are too large and agents incur high inventory holding costs, agents order less. Each agent incurs a cost when holding stock in inventory, the inventory holding charge. Agents also incur a backorder charge when they receive an order and cannot immediately meet that order because they have no stock. Each agent strikes a delicate balance between having too much inventory, which runs up inventory holding costs, and too little inventory, which puts the agent at a greater risk of running out of stock and incurring excessive backorder charges (Macal and North, 2005)”.

“The results of the agent-based supply chain model exactly duplicate the results from Sterman’s original Beer Game Simulation. The “Bull-Whip” effect, observed in real supply chains, is observed even in this highly simplified supply chain model (Macal and North 2005)”. Macal and North (2005) also note this agent-based model is a very useful foundation for more realistic models of supply chains, such as models based on supply network topologies and alternative agent decision rules.

Further information

The original source code of the model can be found
While further information on the model including a UML diagram of the model structure can be found at

To run a verision of the model click here (Sorry it will only work in Windows). For instructions on how to run a Repast model see the Repast website.

No comments: