Economixim

An agent-based economy simulation written in Python.

PythonMesaNumPyPandasMatplotlibSeaborn
View on GitHub

Economixim: Agent-Based Economic Simulation

Economixim is an agent-based model (ABM) that simulates a mixed economy with interactions between firms, households, and government. The simulation focuses on emergent market behaviors such as price adjustments, inventory management, employment decisions, and consumer spending patterns.

Overview

By modeling microeconomic behaviors of individual agents, the simulation explores how these lead to macroeconomic outcomes like market equilibrium, price adjustments, and inventory dynamics. This project demonstrates how complex economic phenomena can emerge from simple rules governing individual agent behavior.

Key Features

Firm Agents

The simulation includes sophisticated firm agents that:

  • Production Management: Adjust production levels based on inventory and demand using weighted moving averages
  • Dynamic Pricing: Make strategic price adjustments based on market conditions, inventory levels, and demand trends
  • Employment Decisions: Manage staffing based on revenue per employee and efficiency metrics
  • Inventory Control: Track and respond to both short-term and long-term demand trends
  • Product Differentiation: Different behaviors for necessity vs. luxury goods

Household Agents

Household agents represent consumers and workers in the economy:

  • Consumption Decisions: Make purchasing choices based on income, prices, and preferences
  • Labor Supply: Decide how much labor to supply to firms based on wages and utility
  • Budget Management: Allocate income between consumption and savings
  • Demand Generation: Create market demand that drives firm production decisions
  • Utility Optimization: Maximize utility through consumption and leisure choices

Government Agents

Government agents implement fiscal and regulatory policies:

  • Taxation Policies: Collect taxes from firms and households to fund public services
  • Public Spending: Allocate government revenue for public goods and services
  • Regulation: Implement market regulations and economic policies
  • Economic Stabilization: Use fiscal tools to influence economic outcomes
  • Policy Implementation: Execute various economic interventions and reforms

Intermediary Firm Agents

Specialized intermediary firms facilitate economic transactions:

  • Market Facilitation: Enable transactions between different agent types
  • Service Provision: Provide specialized services to other agents
  • Supply Chain Management: Coordinate complex production networks
  • Financial Services: Offer financial intermediation and credit services
  • Market Information: Provide market data and analysis to other agents

Market Dynamics

The interaction between all agent types creates complex market dynamics:

  • Price Formation: Emergent pricing through firm supply decisions and household demand
  • Labor Market: Employment matching between firms and household labor supply
  • Fiscal Policy Effects: Government taxation and spending impacts on market behavior
  • Intermediary Services: Facilitation of complex economic transactions
  • Market Equilibrium: Self-organizing balance through agent interactions
  • Economic Cycles: Emergent business cycles from agent behavior patterns

Technical Implementation

Built using the Mesa framework for agent-based modeling in Python. The project includes:

  • Agent Types: Firm agents, household agents, government agents, and intermediary firm agents
  • Data Analysis Tools: Comprehensive analysis using Pandas for data manipulation
  • Visualization: Time series analysis, distribution analysis, and correlation analysis using Matplotlib and Seaborn
  • Economic Metrics: Tracks inventory levels, demand trends, price dynamics, and employment patterns

Project Structure

The simulation is organized into modular components:

  • agents/: Individual agent definitions (firms, households, government)
  • model/: Core economic model orchestrating agent interactions
  • data/: Analysis scripts and saved simulation output
  • utils/: Helper functions for Gini coefficient calculation, data saving, and reporting

Research Value

This project serves as both a learning tool for understanding economic systems and a research platform for exploring policy effects, market dynamics, and the emergence of macroeconomic patterns from microeconomic behaviors. The simulation can be configured to test different economic scenarios and policy interventions.