A working, extensible algorithm digital twin and discrete-event simulation studio.
It is designed for experimentation rather than fixed animations: create a scenario, edit its JSON model, run it as a live twin, replay every state frame, compare multiple runs, and export the results.
- Shared virtual-time simulation architecture
- Deterministic event queue for resource workflows
- Live WebSocket frame streaming
- Time-travel replay with state inspection
- Scenario import/export and persistent scenario library
- Automatic scenario generation with scale and seed
- Built-in domains:
- Graph: BFS, Dijkstra, A*
- CPU scheduling: FCFS, Round Robin
- Generic resource-aware DAG workflows
- Local plugin SDK (
user_plugins/) - Experiment history persisted to
output/runs/ - Side-by-side comparison with automatic metric winners
- Export comparison data as:
- PNG
- CSV
- JSON
- ZIP bundle containing all formats
- Fully self-contained browser UI; no Node.js build step and no CDN dependency
- FastAPI OpenAPI docs at
/docs
- Extract the project.
- Double-click
setup_windows.bat. - Open
http://127.0.0.1:8000if the browser does not open automatically.
Later launches:
start_windows.batPython 3.11 or 3.12 is recommended.
python -m venv .venvWindows PowerShell:
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python run.pyLinux/macOS:
source .venv/bin/activate
pip install -r requirements.txt
python run.pyThen visit:
http://127.0.0.1:8000
Every scenario has this shape:
{
"name": "My Experiment",
"description": "What I am testing",
"domain": "workflow",
"algorithm": "resource_aware",
"config": {},
"tags": ["custom"],
"playback_delay_ms": 50
}The config object is domain-specific and fully editable.
Example:
{
"resources": {"cpu": 8, "gpu": 2, "ram": 64},
"tasks": [
{
"id": "load_data",
"duration": 3,
"dependencies": [],
"demands": {"cpu": 1, "gpu": 0, "ram": 8},
"priority": 3
},
{
"id": "train",
"duration": 12,
"dependencies": ["load_data"],
"demands": {"cpu": 4, "gpu": 2, "ram": 32},
"priority": 5
}
]
}Resource names are arbitrary. You can model cpu, gpu, ram, workers, robots, machines, bandwidth, or your own capacity units.
Copy:
user_plugins/example_counter.py
Create a class derived from:
SimulationPluginExpose a module-level instance:
PLUGIN = MyPlugin()Restart the server. The domain and its algorithms are discovered automatically and appear in the UI.
Local plugins are trusted executable Python code. The web API intentionally does not accept executable plugin uploads.
- Run at least two experiments.
- Open Compare & Export.
- Select completed runs.
- Click Compare Selected.
- Choose a metric.
- Export PNG, PDF, CSV, JSON, or the complete ZIP bundle.
algotwin_x_studio/
├── app/
│ ├── exports.py
│ ├── main.py
│ ├── manager.py
│ ├── models.py
│ ├── scenario_generator.py
│ └── storage.py
├── engine/
│ ├── custom_loader.py
│ ├── kernel.py
│ ├── registry.py
│ └── plugins/
│ ├── base.py
│ ├── graph.py
│ ├── scheduling.py
│ └── workflow.py
├── user_plugins/
│ └── example_counter.py
├── static/
│ ├── index.html
│ ├── styles.css
│ └── app.js
├── scenarios/
├── output/
│ ├── exports/
│ └── runs/
├── tests/
├── requirements.txt
├── requirements-dev.txt
├── run.py
├── setup_windows.bat
├── start_windows.bat
└── setup_linux.sh
GET /api/healthGET /api/domainsPOST /api/scenarios/validatePOST /api/scenarios/generatePOST /api/scenarios/savePOST /api/runs/startGET /api/runsGET /api/runs/{run_id}WS /ws/runs/{run_id}POST /api/compareGET /api/exports/comparison
pip install -r requirements-dev.txt
pytest -qThis release is an end-to-end MVP. It does not yet attempt cycle-accurate CPU simulation, container orchestration fidelity, or production multi-tenant sandboxing. Those should be separate later phases rather than pretending the MVP already provides them.