- Introduction
- Project Structure
- CirclesUBI Implementation
- Simulation Components
- Installation
- Usage
- Current Status
- To-Do List
This project implements a simulation of the CirclesUBI (Universal Basic Income) system using the Mesa agent-based modeling framework and visualizes the results using Panel. The simulation models the creation, distribution, and transfer of a time-based currency within a network of trusted connections.
CirclesUBI is a decentralized Universal Basic Income system that uses personal currencies and a web of trust to create a fair and inclusive economy. This simulation aims to model and analyze the behavior of such a system under various conditions.
The project is organized into several key components:
ABM_simulation/
: Core implementation of the CirclesUBI system and agent-based modelmodel.py
: Mesa model implementation (CirclesNetwork)agents.py
: Definition of agent types (HumanAgent, HubAgent)logger.py
: Custom logging setup
run.py
: Configurable simulation runnervisualizer.py
: Data visualization for completed simulation runsplayground.py
: Interactive simulation playgrounddata/
: Directory for storing simulation output data
The ABM_simulation
module contains the core logic for the Circles currency system:
CirclesNetwork
: The main model class that sets up and runs the simulationHumanAgent
: Represents individual participants in the CirclesUBI systemHubAgent
: Represents hub nodes in the network (not fully implemented)
Key features include:
- Time-based currency issuance
- Dynamic creation of new agents
- Establishment of trust relationships
- Periodic currency minting
run.py
is a configurable simulation runner that allows users to define simulation parameters via a YAML configuration file. It provides the following functionality:
- Load simulation parameters from a YAML file
- Run multiple simulation instances
- Save simulation results (model data, agent data, and graph data) to CSV and JSON files
- Generate summary statistics across multiple runs
Usage: python run.py config_simulation/config.yaml
visualizer.py
is a Panel-based visualization tool for analyzing completed simulation runs. It offers:
- Selection of specific simulation runs from saved data
- Interactive plots for various metrics over time
- Network graph visualization
- Summary statistics display
Usage: python visualizer.py
playground.py
provides an interactive simulation playground for real-time experimentation. Features include:
- Adjustable simulation parameters (steps, update frequency, activation fraction)
- Real-time visualization of network graph, adjacency matrix, and various metrics
- Controls for starting, stopping, and continuing simulations
- Customizable log levels for debugging
Usage: python playground.py
-
Clone the repository:
git clone https://github.com/hdser/circlesubi-simulation.git cd circlesubi-simulation
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Run a configured simulation:
python run.py config_simulation/config.yaml
-
Visualize saved simulation results:
python visualizer.py
-
Launch the interactive playground:
python playground.py
-
Access the visualizations in your web browser at the URL provided in the console output.
The project is currently in active development. Key features implemented include:
- Basic CirclesUBI model with agent creation and trust relationship establishment
- Currency minting mechanism
- Data collection for various network and economic metrics
- Visualization tools for both completed runs and real-time simulations
However, several important features are still under development:
- Currency transfers between agents are not yet implemented
- Proper implementation of demurrage is pending
- Path finding for multi-hop transfers is not yet available
- The HubAgent class is defined but not fully integrated into the simulation
- Implement currency transfers between agents
- Develop a path-finding algorithm for multi-hop transfers
- Properly implement demurrage calculations
- Create a simulation mode with a fixed network size to focus on transfers and money flow
- Enhance summary statistics for multiple runs
- Implement more sophisticated trust relationship dynamics
- Add economic indicators and analysis tools
- Develop scenarios for testing different economic policies
- Optimize performance for larger-scale simulations
- Implement data export features for further analysis in external tools
- Create more detailed documentation and usage guides
- Develop unit tests and integration tests
- Add configuration options for different network topologies