ideasim
A simulator for ideological competition dynamics over historical timescales. Models how ideological currents compete, spread, go dormant, and re-emerge using replicator-mutator dynamics with dormancy, hybridization, and endogenous environment modification. The full system is a Piecewise Deterministic Markov Process (PDMP).
Quick Start
pip install ideasim
Run the default scenario (Europe 1800-2025):
ideasim simulate -o results.json
Export and edit the default configuration:
ideasim default-config -o my_config.json
# edit my_config.json ...
ideasim simulate my_config.json -o results.json
What It Models
ideasim simulates how ideological currents (liberalism, Marxism, traditionalism,
nationalism, and their hybrids) evolve over time. The model captures:
- Manifest adoption (x): observable adherence to ideologies on the simplex.
- Latent sympathy (y): hidden reservoirs of support that enable dormancy and re-emergence (the "martyrdom effect").
- Environment (e): exogenous conditions (GDP growth, inequality, media freedom, social media penetration, conflict) that shape ideological fitness.
- Stochastic events: hybridization (new ideologies from blending two parents), charismatic bursts, and parameter mutation.
For the full mathematical framework, see the paper/ directory or
the documentation.
Installation
From PyPI
pip install ideasim
From source (development)
git clone https://github.com/LeonardoSanBenitez/ideasim.git
cd ideasim
pip install -e ".[dev]"
Docker
docker compose build
docker compose run --rm simulator
Usage
Python API
from ideasim.defaults import load_default_config
from ideasim.engine import simulate
config = load_default_config()
result = simulate(config, seed=42)
print(f"Final shares: {result.final_shares}")
print(f"Events triggered: {len(result.events)}")
CLI
# Run with default parameters
ideasim simulate -o results.json
# Custom config
ideasim simulate my_config.json -o results.json
# Export default config for editing
ideasim default-config -o default_config.json
Running Tests
python -m pytest tests/ -v
Project Structure
ideasim/
ideasim/ # Python package
types.py # Core data types (Ideology, SimulationConfig, etc.)
engine.py # PDMP simulation engine (RK4 + stochastic events)
defaults.py # Loads default scenario from JSON data file
io.py # JSON serialization/deserialization
cli.py # Command-line interface
sensitivity.py # Sensitivity analysis (OAT + LHS)
validation.py # Input validation
health.py # Health checks
evaluation/ # Validation against observed data (ParlGov)
data/
default_scenario.json
tests/ # Test suite (104 tests)
paper/ # LaTeX paper
scripts/ # Shell scripts for Docker workflows
Contributing
Contributions are welcome. Please see CONTRIBUTING.md for guidelines on setting up the development environment, running tests, and submitting pull requests.
Citation
If you use ideasim in your research, please cite:
@software{ideasim,
title = {ideasim: Ideological Dynamics Simulator},
author = {San Benitez, Leonardo},
year = {2026},
url = {https://github.com/LeonardoSanBenitez/ideasim},
}
License
Apache License 2.0. See LICENSE for details.
Metadata
Release files for ideasim 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ideasim-0.1.0.tar.gz | 57.7 kB | With provenance | Details for ideasim-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ideasim-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ideasim-0.1.0-py3-none-any.whl |
Total release size: 109.2 kB
Release files / ideasim-0.1.0.tar.gz
| Download URL | ideasim-0.1.0.tar.gz |
|---|---|
| Size | 57.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebcea30c373ff99a2197ad38a1d75a7c7523cde29b2b8f1b693d3a59a2ef8ae7
|
|
BLAKE2b-256 checksum How to use checksums |
a0f325dfc6a7bae18e1a434cb4af8b7b696d7123963589c1b0c8316490a77220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logRelease files / ideasim-0.1.0-py3-none-any.whl
| Download URL | ideasim-0.1.0-py3-none-any.whl |
|---|---|
| Size | 51.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b04f4811fcd92789f7384bca8f3cc57414378afaff2e2b8fd67efef8921d792f
|
|
BLAKE2b-256 checksum How to use checksums |
95694ea63ca6dd4dba3412f22fa65487f5e701edc09fc3d9de5cd886ebcea45c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logSecurity for ideasim 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ideasim-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.