Project Info
Inspiration
I was born and raised in Palma de Mallorca, a city that is currently facing an existential threat. To the world, it is a vacation paradise; to locals, it is a closed door. With rents rising 19% year-over-year and local wages stagnating at ~€23,000 (12% below the Spanish average), over 40% of the local workforce is now priced out of their own city. Traditional policy is too slow—by the time a subsidy is approved, families are already evicted. With this project I wanted to ask: What if city governance was autonomous and worked real-time?
What it does
The project tries to be a Closed-Loop Economic Digital Twin of Palma that doesn't just simulate the crisis but solves it autonomously. Simulates: A Walrasian Auction engine models the interaction between 1,100 synthetic agents (Locals vs. Expats) and 1,100 housing units across 5 real neighborhoods, anchored in 2026 INE (Spanish National Statistics Institute) wage/rent benchmarks. Simulates: A Walrasian Auction engine models the interaction between 1,100 synthetic agents (Locals vs. Expats) and 1,100 housing units across 5 real neighborhoods, anchored in 2026 INE (Spanish National Statistics Institute) wage/rent benchmarks. Monitors: A Fetch.ai Regulator Agent runs infinitely in the background, auditing the market state every 5 seconds to simulate a real societal market. Monitors: A Fetch.ai Regulator Agent runs infinitely in the background, auditing the market state every 5 seconds to simulate a real societal market. Acts: If the families displaced hits a critical threshold (e.g., >300 families), the Regulator triggers a Visa Settlement Agent to inject targeted liquidity (vouchers) via a simulated payment rail to affected families. Acts: If the families displaced hits a critical threshold (e.g., >300 families), the Regulator triggers a Visa Settlement Agent to inject targeted liquidity (vouchers) via a simulated payment rail to affected families. Heals: The system creates a feedback loop where agent actions actively stabilize market prices in real-time, creating a dynamic equilibrium. Heals: The system creates a feedback loop where agent actions actively stabilize market prices in real-time, creating a dynamic equilibrium. How I built it We architected a Multi-Agent System (MAS) where economic theory meets decentralized infrastructure. 1. The Math: Walrasian Tâtonnement At the core of my simulation is a solver that iteratively finds the market-clearing price vector $p$ for a set of zones $Z$. Each agent $i$ maximizes their utility function: $$ U_i(z) = \alpha_i \cdot \text{Pref}_{i,z} - \beta_i \left( \frac{p_z \cdot \text{BasePrice}_z}{\text{Income}_i + \text{Subsidy}} \right) $$ Where $\alpha$ and $\beta$ represent the trade-off between location preference and budget constraints. 2. The Agency: Fetch.ai uAgents I deployed two different identities as agents: The Regulator: An autonomous auditor that reads the simulation state. The Bank (Visa): A settlement agent that executes transactions. They perform a cryptographic handshake to authorize funds without human intervention. 3. The Visuals: Streamlit & PyDeck I built a 3D Geospatial Command Center that visualizes Effective Rent (what locals pay) vs. Market Rent. The map updates dynamically, showing "Red Zones" turning "Cyan" as the agents successfully intervene. Challenges I ran into The Inflationary Trap: Initially, injecting vouchers caused "Landlord Agents" to raise prices, negating aid. I had to implement "Market Entropy" and "Agent Stability Bonuses" to simulate a realistic tug-of-war between inflation and social liquidity. Python 3.14/Pydantic V1 Conflict: The uagents framework faced type-evaluation issues with the newest Python 3.14 release. I resolved this by architecting a version-pinned, optimized Python 3.12 virtual environment. Asynchronous Synchronization: Ensuring a Streamlit frontend could reflect real-time transactions occurring between two independent Fetch.ai agents required a custom JSON-based "Self-Healing Handshake" protocol. Accomplishments that I am proud of Closed-Loop MAS: Achieving a system where agent decisions mathematically alter the "physics" of the economic simulation in real-time. The "Wobble": Successfully modeling market volatility, where displacement numbers realistically fluctuate based on landlord greed and external economic shocks. 100% Autonomous Settlement: Building a verifiable ledger where every subsidy batch is cryptographically authorized by the Regulator. What I learned I learned about dynamic equilibrium, making AI agents interact in a real world situation and the importance of high-frequency intervention in crisis.
What's next
Deploying the Visa Agent on Modal for serverless scaling and integrating real Fetch.ai Wallet transactions to allow citizens to receive actual stablecoin subsidies directly to their mobile devices. Extending the map to the whole Mallorca island and for global capabilities.
Analysis
View
Metric
No commits on this project resolved to a GitHub account.
Technology
- PythonIn code
- StreamlitClaimed
1 of 2 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
16 KB
Source files
6
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
PauRoca06/Palma-Housing-Equilibrium-Simulation
12 files · 429 KB · @ d282150
Structure
Application logic
9 files · 75%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python100%
- Markdown0%
Share of indexed source by file size. Binary and vendored files are excluded.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.