YourSim Studio — Whitepaper
A visual studio for discrete-event simulation and design optimization of service, queue, and network systems.
1. The problem
Capacity and service-design questions are everywhere: how many check-in desks, ER beds, tellers, machines, or branch routers does a system need to keep waits acceptable — at the lowest cost? These systems are stochastic queueing networks: work arrives randomly, waits in lines, and competes for limited resources with priorities, finite buffers, abandonment, failures, and routing. Closed-form queueing formulas (M/M/1, M/M/c, Erlang) answer only the simplest cases; spreadsheets can't capture the dynamics. The rigorous tool is discrete-event simulation (DES) — but DES has historically meant specialist desktop software or hand-written code, out of reach for most analysts.
YourSim Studio makes DES visual, browser-based, and free — and pairs it with an automatic design optimizer, so the tool doesn't just tell you how a design behaves, it finds a better one.
2. Approach
Discrete-event simulation. A model is a directed graph of blocks. Entities (customers, packets, jobs) are created by sources, wait in queues, are served by resources, and routed/transformed by branches, delays, batches, and assemblies until they reach a sink. The simulation advances event-by-event along an ordered event calendar; statistics are accumulated with a warm-up cutoff and reported as means with 95% confidence intervals across independent replications, plus percentiles (p50/p90/p95) and over-time series.
Design optimization via the Cross-Entropy method. Given decision variables (server counts, buffer capacities), a cost per unit, and service constraints (e.g. p95 wait ≤ 5 min), the optimizer searches for the cheapest feasible design. It uses the Cross-Entropy (CE) method (Rubinstein): sample candidate designs from a distribution, simulate and score each (cost + penalty for constraint violations), keep the elite, and refit the distribution toward them — repeating until it converges. Candidates are compared under common random numbers for low-variance, fair comparison.
Modelling at scale. Real topologies repeat (30 branches, hundreds of sites). Studio represents these with groups that collapse to a single node and replicate (×N); at run time they expand — flattening into N copies under a node budget, or aggregating beyond it. Large populations (e.g. 100k clients) are modelled as rate-based sources, not literal nodes.
3. Architecture
Studio is a React + MUI single-page application. The simulation core — the open-source YourSim Engine (@plantagoai/yoursim-engine, MIT, zero dependencies) — runs in a Web Worker, so long runs never block the UI. The same engine powers the CLI and can be embedded anywhere JavaScript runs.
The app is organized in clear layers: a canvas editor (React Flow) for building and grouping models; an experiment runner and KPI dashboard; an optimize view with a live convergence + search-distribution display; a presentation ("watch") mode that animates the recorded run and exports an MP4; and an AI companion that runs through a managed backend (it stores no model content) to help build, explain, and tune models in plain English. Models are the user's — persisted locally and optionally to their account. A plain-English Story can be auto-drafted on every view, and results export to JSON / PDF / MP4.
4. Validation
The engine is validated against analytical queueing theory wherever closed forms exist. Examples (within simulation CI of theory): an M/M/1 at ρ≈0.79 reproduces utilization 0.794 and mean queue wait ≈ 30.8; M/M/c matches the Erlang-C waits; a preemptive-priority model matches the M/M/1 preemptive-resume per-class sojourn; a resource with failures matches its availability U/(U+R). Runs are deterministic (seeded), so results are reproducible and auditable. A test suite of 140+ engine cases asserts these analytical results, not merely that the code runs.
5. Use cases & worked models
Studio ships templates spanning every modelling feature: an airport check-in (textbook M/M/c), a hospital ER with triage and shared bed pools, a bank branch with priority and reneging, a factory line with assembly, machine failures and preemption, a restaurant with batched parties and balking, M/M/1 / M/M/c teaching models, and a global corporate network (device populations → branch ×30 → WAN → data center). Typical questions: minimum desks to keep p95 wait under target, bed count that bounds left-without-being-seen, router capacity to hold latency under SLA.
6. Limitations
Studio targets queueing-network DES, not agent-based or continuous/system-dynamics modelling. The optimizer tunes integer capacities (servers/buffers) against cost and service constraints — not arbitrary structural search. Group replication is single-entry/single-exit per group in v1, with approximate deep nesting. The AI companion uses a metered managed model. These are deliberate scope choices that keep the tool fast, learnable, and trustworthy.
7. Open core
The engine is open source (MIT) and on public npm; the Studio app is free to use. Build with the app, or drop the engine into your own code or pipeline.
- App: yoursim.plantagoai.com
- Engine + docs: yoursim-engine.plantagoai.com ·
npm i @plantagoai/yoursim-engine - See also: the one-pager, tutorial, example models, and Cross-Entropy theory.