Skip to content

archtecgr/PortusSIM

Repository files navigation

PortusSIM

An agent-based model of ancient economies, designed for archaeological exploration. Built with Python and PySide6 (Qt).

What it models

A small classical/Roman-era town where merchants of three social classes (elite, middle, poor) move around a grid, trade with each other when they meet, build trust over repeated successful trades, earn daily income from their work, pay daily expenses and can go bankrupt if they run out of money.

Despite simple rules, the model produces emergent inequality, social mobility, bankruptcy patterns and class stratification, phenomena directly relevant to archaeological evidence.

Installation

  1. Install Python 3.9 or later.
  2. From the project folder, install dependencies:
    pip install -r requirements.txt
    
    This installs PySide6 (Qt for Python) and matplotlib.

Running

python main.py

Features

  • Modern Qt-based interface with light and dark themes (Ctrl+T)
  • Dockable Parameters panel — drag the header to undock or reposition
  • Five chart tabs: trajectories, distribution, histogram, bankruptcies, summary
  • Multi-run averaging for proper statistical analysis
  • CSV and JSON export for further analysis in Excel, R, or Python
  • Configuration save/load for reproducible experiments
  • Live progress with elapsed time and ETA
  • Hover tooltips explaining every parameter
  • Input validation with helpful error messages

Project structure

market_town/
├── main.py                    ← entry point
├── simulation/                ← model logic (Qt-independent)
│   ├── merchant.py            ← Merchant agent
│   ├── town.py                ← population builder
│   └── engine.py              ← simulation loop
├── ui/                        ← Qt user interface
│   ├── main_window.py         ← main window with docks/menus/toolbar
│   ├── controls_panel.py      ← parameter controls
│   ├── results_panel.py       ← chart tabs
│   ├── parameter_row.py       ← reusable slider+spinbox widget
│   ├── worker.py              ← background simulation thread
│   └── styles.py              ← Qt stylesheet generator
├── data/                      ← data handling
│   ├── config.py              ← defaults, themes, validation
│   └── exporter.py            ← CSV/JSON export
└── results/                   ← saved output (auto-created)

Keyboard shortcuts

  • F5 — Run simulation
  • Ctrl+T — Toggle light/dark theme
  • Ctrl+S — Save configuration
  • Ctrl+O — Load configuration
  • Ctrl+Q — Quit

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages