Examples
Small complete models, each loaded and run by examples_test.go so that
none can rot. Run one with:
go run ./cmd/variate run -f examples/compound.yaml
| File |
Shows |
compound.yaml |
the compound frequency × severity model: one source, one node, one function |
pump_station.yaml |
a reliability model: merged flows, a sequential selection, holding times in hours and days, per-time costs, a chained node |
filter.yaml |
a period-scoped probability: the block rate of a filter drawn once per period |
delays.yaml |
holding times, a per-time cost over the repair, and a capped bill |
sequential.yaml |
detection with a probability, then a sequential response: contained with an uncertain rate, else escalated, else lost; an undetected attack gets no response and a dearer breach |
templates.yaml |
a template instanced twice with one override, both wired to shared nodes |
regimes.yaml |
two regimes: frequent minor faults and rare critical failures a hundred times dearer, so the period total has two peaks; the plan sizes the run on the rare source |
register.yaml |
a register of a hundred risks, generated by web/models/register.py: the exceedance curve of the total is the cumulative risk profile and the breakdown ranks the risks; every rate is a gamma, so the exact curve is closed form in the rate |
blocks.yaml |
a reliability block diagram as a source: chillers two of three, pumps one of two and a control system in series, each with an MTBF and an MTTR, simulated exactly as a Markov chain of the units, the outage lasting as long as the chain is down (holding: outage); variate plan prints the stationary rate, system MTBF and unavailability |
renewal.yaml |
two sources that are not Poisson: a filter changed on every 500th pallet (every), and a press that cannot fail while under repair (repair); the plan shows each one's effective rate |
factor.yaml |
a shared factor: three risks whose rates move with one threat climate drawn once per period, so a bad year is bad for all of them; the dependence is exact in the variance, P(T = 0) and the transform |
seasonal.yaml |
a rate that varies by period: storm and burst-pipe claims over a monthly period, each following a twelve-value cycle (schedules); the series shows the cycle and the exact figures mix over it |
shift.yaml |
an eight-hour shift as the period: a truncated-normal demand, a labour rate drawn once per shift and shared by every job in it (scope: period), a flatter PERT (t: 2) and a truncated lognormal |
observed.yaml |
observed data as the model: the claim severity resampled from data/claims.csv beside the file (empirical), and a categorical for the claim class |
heavy.yaml |
heavy tails: a Pareto, a fatter Pareto held by an insurance limit (cap), and a generalised Pareto, with an aggregate deductible and a reinsurance layer as layers of the period total; the exact distribution applies with the cap, declines without it, and bounds each layer's mean |
sites.yaml |
two sites as two graphs in one model, their categories added, with the run's criteria, caps and the series set in the file; exponential, uniform, log-uniform, triangular and Weibull families |
counts.yaml |
discrete values where they mean something: damaged items per shipment binomial, resends geometric, an inspection Bernoulli, complaints negative binomial |
gograph/ |
a Go program that builds a graph with the API, for a domain module to copy |
Streaming rounds
Every model can stream its rounds, the path each event takes with the
values it books, filtered to the ones that matter. On the intrusion
model, the attacks that go undetected:
go run ./cmd/variate stream -f examples/sequential.yaml -n 200 --seed 3 --leaf undetected --rounds csv
seq,period,source,arrival,end,leaf,value,path
0,1,attack,1.5983697202386913,1.5983697202386913,undetected,3.02076639527292e+06,detect>undetected
1,1,attack,1.9916605692694858,1.9916605692694858,undetected,865805.8950442758,detect>undetected
--watch NODE keeps the rounds that pass through a node, --leaf LEAF
those that end at one, and --rounds jsonl gives each round as a JSON
object with its steps. variate run --rounds-out FILE writes the same
records to a file beside the summary.