Home
Help
Resources
Extensions
FAQ
NetLogo Publications
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

## NetLogo User Community Models

## WHAT IS IT?
This is an extension to the El Farol bar problem. This model includes a random strategy to show that guessing the number of patrons at the El Farol bar can be an optimal strategy.

El Farol is a bar in Santa Fe, New Mexico. The bar is popular --- especially on Thursday nights when they offer Irish music --- but sometimes becomes overcrowded and unpleasant. In fact, if the patrons of the bar think it will be overcrowded they stay home; otherwise they go enjoy themselves at El Farol. This model explores what happens to the overall attendance at the bar on these popular Thursday evenings, as the patrons use different strategies for determining how crowded they think the bar will be.

In this extended version of El Farol the story goes that the owner of the bar tired of patrons complaining about the bar being overcrowded and installed an ugly statue that the bar owner called the coin flipper god. On the statue there is a big sign proclaiming with big letters:
"I am the god of El farol I always know if the bar will be overcrowed. Pray to me to find out. You can offer a prayer to me by flipping a coin, if the coin reads "head" the bar will not be pleasant if you the coin reads "tails" the bra will be overcrowded. My godly powers will guide thee coin."
As patrons jokingly started using the "prayer" to the el farol "god" the patrons quickly discovered that the statue indeed had the power to predict attendance in the El Farol bar, at least as long as enough patrons believed in the "god".

The model builds heavily on Uri Wilensky original NetLogo implementation of El Farol.
El Farol was originally put forth by Brian Arthur (1994) as an example of how one might model economic systems of boundedly rational agents who use inductive reasoning.

## HOW IT WORKS

An agent will go to the bar on Thursday night if they think that there will not be more than a certain number of people there --- a number given by the OVERCROWDING-THRESHOLD. To predict the attendance for any given week, each agent has access to a set of prediction strategies, including one random strategy, and the actual attendance figures of the bar from previous Thursdays. A strategy is represented as a list of weights that determines how the agent believes that each time period of the historical data affects the attendance prediction for the current week and one dummy weight tied to a single random variable. This definition of a strategy is loosely based on an implementation of Arthur's model as revised by David Fogel et al. (1999). The agent decides which one of its strategies to use by determining which one would have done the best had they used it in the preceding weeks.
The random strategy is available to all agents and uses a uniform distribution to determine how many patrons will show up for thursday night. Each patron using this random strategy will have a unique prediction on how many patrons attend. There is no randomness applied in any of the prediction strategies.

The number of potential strategies an agent has is given by NUMBER-STRATEGIES, and these potential strategies are distributed randomly to the agents during SETUP, but at any one tick each agent will only utilize one strategy, based on its previous ability to predict the attendance of the bar. The length of the attendance history the agents can use for a prediction or evaluation of a strategy is given by MEMORY-SIZE.

The model has been extended with COIN-MEAN and COIN-GAP. These variables define a uniform distribution with mean of COIN-MEAN from COIN-MEAN - COIN-GAP to COIN-MEAN + COIN_GAP. The random strategy is considered optimal if the actual number of patrons in the bar fall between COIN-MEAN - COIN-GAP to COIN-MEAN + COIN-GAP . COIN-ERROR-PREMIUM is percentage applied to error calculations when finding optimal strategy in the EL Farol Bar problem.

The HISTORICAL-MEAN and HISTORICAL-GAP determine how historical values are created. The distribution used or historical value is a uniform distribution between HISTORICAL-MEAN - HISTORICAL-GAP to HISTORICAL-MEAN + HISTORICAL-GAP.

## HOW TO USE IT

To use the model, set the NUMBER-STRATEGIES, OVERCROWDING-THRESHOLD, MEMORY size, COIN-MEAN, COIN-GAP, COIN-ERROR-PREMIUM, HISTORICAL-MEAN, HISTORICAL-GAP, press SETUP, and then GO.

The Bar Attendence plot shows the average attendance at the bar over time. The coin flippers plot shows the number of patrons using the random strategy of "coin flipping".
The patrons using the random strategy are colored yellow while thise trying to predict the future are marked white.

## THINGS TO NOTICE

The green part of the world represents the homes of the patrons, while the blue part of the world represents the El Farol Bar. White patrons are using prediction strategies while yellow agents use the random strategy of "coin flipping".

## THINGS TO TRY

Try running the model with different settings of COIN-GAP, COIN-MEAN and COIN-ERROR-PREMIUM and notice when the random "coin flipping" strategy is used.
Try to find out what parameters determine when the random "coin flipping" is the only used strategy by patrons.

## EXTENDING THE MODEL

Experiment with different random distributions. Try to find a strategy that is better than the random strategy of "coin flipping".
The current implementation makes a distinction between the random strategy and the prediction strategies, consider adding the random variable to the prediction strategies.

## CREDITS AND REFERENCES

Based heavily on the original NetLogo model by Uri Wilensky

Based on the original

This model is inspired by a paper by W. Brian Arthur. "Inductive Reasoning and Bounded Rationality", W. Brian Arthur, The American Economic Review, 1994, v84n2, p406-411.

David Fogel et al. also built a version of this model using a genetic algorithm. "Inductive reasoning and bounded rationality reconsidered", Fogel, D.B.; Chellapilla, K.; Angeline, P.J., IEEE Transactions on Evolutionary Computation, 1999, v3n2, p142-146.

## HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

* Rolf Stenholm (2014). NetLogo El Farol Attack of the coin flippers.
* Rand, W. and Wilensky, U. (2007). NetLogo El Farol model. http://ccl.northwestern.edu/netlogo/models/ElFarol. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
* Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.