Skip to content

input_uncertainty_frame

Python reference for nagasim.uncertainty.input_uncertainty_frame.

Each KPI's run-to-run interval, its interval with the inputs' uncertainty, and the inputs' share of the spread, as a DataFrame with one row per KPI.

Parameters:

Name Type Description Default
layout dict or str

The model.

required
inputs list of dict

{"path", "values"} per input, as input_uncertainty takes them.

required
**kwargs

kpis, resamples, replications, seed, run_length, warmup, workers, should_stop and overrides: see input_uncertainty, which does the work.

{}

Returns:

Type Description
DataFrame

Columns kpi, mean, run_lo, run_hi, input_lo, input_hi, input_share, resamples_used (NaN where undefined: fewer than 2 replications or 2 usable resamples). .attrs holds the rest of the answer: completed, measure, runs, resamples, replications, seed, inputs, notes. Errors are those of input_uncertainty.

See Also

input_uncertainty : The same answer as a nested dict (its released return type, D1322).

Examples:

>>> import random
>>> from nagasim import build as nb, uncertainty
>>> m = nb.Model(time_limit=300, warmup=30)
>>> m.add_resource(name="Server", capacity=1)
'Server'
>>> arrive = m.create("arrive", distribution=nb.Exponential(rate=0.9))
>>> _ = arrive >> m.process("serve", resource_name="Server",
...                         distribution=nb.Exponential(rate=1.0)) >> m.dispose()
>>> rng = random.Random(0)
>>> gaps = [round(rng.expovariate(0.9), 3) for _ in range(30)]
>>> table = uncertainty.input_uncertainty_frame(
...     m.to_dict(), [{"path": "blocks.arrive.params.distribution", "values": gaps}],
...     kpis=["system/Total Entities Completed"], resamples=2, replications=2)
>>> list(table.columns)[:3], table.attrs["runs"]
(['kpi', 'mean', 'run_lo'], 6)