4.1: Simple economy#
Learning objectives
Understand agent-based modelling (ABM):
Define the basic concepts and structure of agent-based models.
Explain how agents interact within a model and how these interactions can simulate complex systems.
Familiarize with the Mesa Library:
Learn how to use the Mesa library for creating and running agent-based models.
Identify the different components of Mesa, including agents and models.
Differentiate between agent and model level properties.
Initialise a model with a specified number of agents.
Customize agent properties such as initial wealth and interaction rules.
Data Collection and Analysis:
Collect data from the model using Mesa’s DataCollector.
Utilize Pandas DataFrames for data storage and manipulation.
Analyse the collected data to understand the dynamics of the model.
Model Experimentation:
Experiment with different parameters and observe their effects on the model’s behaviour.
Assess the impact of randomness on the model.
Evaluate the effect of different agent ordering techniques on individual and system-level properties.
Visualisation and Animation:
Create basic visualisations and animations to represent model data.
Apply libraries like Matplotlib and Seaborn to enhance data visualisation.
The code is based on the Mesa tutorial model found here. This model provides a simplified representation of an economy and allows us to explore various aspects of wealth distribution and dynamics.
In this model, we simulate a population of agents, each representing an individual in the economy. These agents interact with each other and exchange money based on predefined rules.
The economy starts with a specified number of agents, each with a random initial wealth. The agents can take a random amount of money from another agent, up to a maximum limit. If an agent has enough money, they can give some of it to another agent.
The model progresses in discrete time steps. In each step, an agent is randomly selected, and they interact with another randomly selected agent. The amount of money exchanged is determined randomly within the limits set for each agent.
As the simulation progresses, the distribution of wealth among the agents may change. Some agents may accumulate more wealth, while others may lose wealth. This model allows us to study the dynamics of wealth distribution and observe how it evolves over time.*
Here is the whole model in one picture. Every trader below starts with the same handful of coins, and all they ever do is hand a coin to someone else at random. Before you run it, predict what becomes of a crowd of equals when the only rule is fair, random exchange: does everyone stay roughly equal, or does the distribution pull apart?
DataCollector to measure the very spread you are watching here.Key takeaways#
Key takeaways
The simple economy isolates exchange: agents begin equally, transfer one unit at random, and can still produce unequal outcomes.
Repeated runs and distribution plots are needed because one random history cannot support a general conclusion.
The exercises use this small model to introduce DataFrames, reporters, random seeds, and activation order.
Begin with 4.1.1: Exercises to build, run, test, and extend the model.