A discrete simulation library for simulating Complex Adaptive
Systems.
Specifically, simul
is a discrete-event simulator using incremental
time progression, with M/M/c
queues for interactions
between agents.
Usage
Warning
Experimental and unstable. Almost all APIs are expected to change.
Barebones basic example
[]
= "0.1"
use Simulation;
use *;
// Runs a simulation with a producer that produces work at every tick of
// discrete time (period=1), and a consumer that cannot keep up (can only
// process that work every third tick).
let mut simulation = new
Poisson-distributed example w/ Plotting
Here's an example of an outputted graph from a simulation run. In this
simulation, we show the average waiting time of customers in a line at a
cafe. The customers arrive at a Poisson-distributed arrival rate
(lambda<-60.0
) and a Poisson-distributed coffee-serving rate with the
same distribution.
This simulation maps to the real world by assuming one tick of discrete-simulation time is equal to one second.
Basically, the barista serves coffees at around 60 seconds per drink and the customers arrive at about the same rate, both modeled by a stochastic Poisson generator.
This simulation has a halt_check
condition of the simulation's time
being equal to 60*60*12
, representing a full 12-hour day of the cafe
being open.
This is a code example for generating the above, from main.rs
:
use *;
use Poisson;
use *;
use *;
use PathBuf;