Extending a Model of the El Farol Problem in NetLogo
Introduction to Agent Based Modeling Module 3
Module 3 of the ABM course has us working on developing a model based on the El Farol Problem. I’ll spare rewriting the problem statement … here’s a slide
Instead of using a ML model or a ton of heuristic rules, we’re using a weighting of past weeks to make a prediction of future weeks. This is represented in the agents as a memory for the past two weeks, with a set of these weighted strategies to choose from. The weights for past weeks are generated randomly.
We determine successful agents as agents who go to the bar when it is not full. They’re *loyal* customers. We reward agents for attending bar when it is not full
This is a positive outcome for the bar owner. We could also remodel this to understand success for the individual agent maybe by measuring happiness over time. But that could get complicated for a simple excercise.
I’m going to be modifying the El Farol model that is included in NetLogo.
——
Adding Rewards to Agents
I’m creating a new reward parameter to help agents track success invididually. Success in our use case is when agents attend the bar but it’s not crowded.
I modify how the model tracks bar crowding to include the case where the bar is not crowded.
Then we give a reward to those attendees that are attending in uncrowded conditions.
Adding Visualization of Rewards to Agents
I add some visual representation of reward levels to agents.
Visualization helps convey the insights beyond raw data. One needs to see and understand the issue.
We are going to change the color of the agents as they earn more rewards.
When the agents decide to attend the bar, we then modify their color to reflect their rewards they have. The darkest red will have the most reward, while lighter shades indicate least reward.
set color scale-color red reward (max [reward] of turtles + 1) 0
Monitoring Statistics
I’m adding stats monitoring to give some more data to ingest for viewers of the model. We can now see the mean, median, min/max values for agent rewards in the system.
Plotting the Agent Data
I' added a rewards histogram to show a distribution of agent rewards.
Machine Learning in Agent Based Modeling
We could add ML to the agents to assist with decision making and strategy selection.
Bill Rand provided this diagram of how ML applies to an Agent Based Model
Instead of a bag of strategy approach, we could replace decision making with neural net, decision tree, or genetic algorithm and make the agents truly adaptive
Conclusion
I felt this exercise was great to understand a more complicated strategy switching method. The existing code was valuable to read through and gives me a few ideas for future projects.