Tutorial
This tutorial is a guided tour. Each chapter builds one model, introduces a handful of new ideas, and explains why the code is shaped the way it is. By the end you will have used every major feature of Cimba Python on problems that look like real work.
The first six chapters follow the upstream Cimba C tutorial, so if you
know the C library you will recognize the models. The seventh uses simulation
optimization to tune policy parameters. Every chapter has a matching,
self-contained script in the repository’s tutorial/ directory. The code on
these pages is pulled straight from those scripts, so what you read is exactly
what runs.
uv run python tutorial/tut_1_1.py
Ch. |
Model |
What you learn |
|---|---|---|
A single-server queue |
Models, inputs, processes, entities, outputs, the measurement window, logging, datasets, captures, composition, sweeps and parallel runs. Ends by driving the same queue with recorded data. |
|
Mice, rats and a cat |
Resources with capacity, priorities, preemption, interrupts, signals, process handles and model-internal randomness. |
|
An amusement park |
Dynamic models ( |
|
A weather-gated harbor |
Composing several models, references between siblings, conditions and predicates, process priorities, and comparing designs fairly. |
|
An assembly line |
Handing model objects between stores, captured histories, plotting, structure diagrams and finding a bottleneck. |
|
A multi-echelon supply chain |
Data-driven simulation: time-indexed |
|
Tuning a policy |
Letting Cimba find good parameter values, reading an honest estimate, comparing tuned policies, and searching a whole number of agents. |
If you only have half an hour, read chapter 1 and then chapter 6.