simular
Unified Simulation Engine for Deterministic, Reproducible Simulations
Live Demo | Documentation | Crates.io
Overview
Simular provides a unified framework for physics, Monte Carlo, and optimization simulations with guaranteed reproducibility. Built on Toyota Production System principles:
- Poka-Yoke — Type-safe units prevent dimension errors
- Jidoka — Automatic anomaly detection (NaN, energy drift, constraint violations)
- Heijunka — Work-stealing scheduler for balanced computation
- Mieruka — Real-time visualization (TUI + WebAssembly)
Features
- Deterministic — Same seed = bit-identical results across platforms
- High Precision — Symplectic integrators conserve energy < 1e-9 over 100 orbits
- Multi-Platform — Native Rust + 37KB gzipped WebAssembly
- Real-time Monitoring — Jidoka status, physics invariants, performance metrics
Installation
With WebAssembly support:
Quick Start
Orbit Simulation
use ;
let config = SimulationConfig ;
let result = run_simulation?;
println!;
println!;
Monte Carlo Pi Estimation
use *;
use MonteCarloEngine;
let mut rng = new; // Deterministic!
let engine = with_samples;
let result = engine.run_nd;
println!;
Jidoka Guards
use ;
let config = JidokaConfig ;
let mut guard = new;
// Automatic anomaly detection after each step
match guard.check
Examples
# Orbit visualization (TUI)
# Monte Carlo estimation
# Physics simulation
# Jidoka anomaly detection
Modules
| Module | Description |
|---|---|
orbit |
N-body gravitational physics with symplectic integrators |
monte_carlo |
Stochastic sampling with variance reduction |
optimization |
Bayesian optimization with Gaussian processes |
engine |
Core: SimState, SimRng, JidokaGuard, Scheduler |
Architecture
simular/
├── src/
│ ├── orbit/ # Yoshida integrator, Kepler scenarios, WASM bindings
│ ├── domains/ # Monte Carlo, Optimization, ML
│ ├── engine/ # Core runtime: RNG, Jidoka, Scheduler
│ └── visualization/# TUI rendering
├── web/ # WebAssembly demo
└── tests/ # Property-based tests, probar integration
Performance
| Metric | Value |
|---|---|
| WASM Size | 37KB gzipped |
| Energy Conservation | < 1e-9 relative drift (100 orbits) |
| Integrator | Yoshida 4th-order symplectic |
| Determinism | Bit-identical across platforms |
Benchmarks
Run benchmarks with:
Effect Sizes (Cohen's d)
All benchmarks report effect sizes using Cohen's d:
| Benchmark | Cohen's d | Interpretation |
|---|---|---|
| TSP GRASP vs Random | 1.85 | Large |
| Symplectic vs Euler | 2.31 | Large |
| Monte Carlo Convergence | 0.95 | Large |
Effect size interpretation:
- d < 0.2: Negligible
- d = 0.2-0.5: Small
- d = 0.5-0.8: Medium
- d > 0.8: Large
See benches/README.md for methodology.
Contributing
Contributions are welcome! Please see our Contributing Guide for:
- Development setup
- Coding standards (Toyota TPS, JPL Power of 10)
- Testing requirements (95% coverage, 80% mutation score)
- Pull request process
Links
- Live Demo: https://interactive.paiml.com/simular-orbit/
- Crates.io: https://crates.io/crates/simular
- Documentation: https://docs.rs/simular
- GitHub: https://github.com/paiml/simular
- Changelog: CHANGELOG.md
License
MIT License - see LICENSE for details.