Run and compare¶
Run a model, compare scenarios and search for the best settings.
naga examples¶
usage: naga examples [-h] [--path]
List the models that ship in the package. A command that takes a model path
also takes one of these names: naga run single_server.
options:
-h, --help show this help message and exit
--path print the folder they are in instead
naga plugins¶
usage: naga plugins [-h]
List the plugins this process loaded, failed to load and scanned. Read-only;
--no-plugins before the command turns them all off.
options:
-h, --help show this help message and exit
naga run¶
usage: naga run [-h] [--version] [--replications REPLICATIONS] [--seed SEED]
[--warmup WARMUP] [--run-length RUN_LENGTH] [--start ISO]
[--until ISO] [--timezone IANA] [--workers WORKERS]
[--logic MODULE] [--controllers MODULE[:NAME]] [--pace FACTOR]
[--out OUT] [--report REPORT] [--export FORMAT:PATH]
[--player PATH] [--asked FILE] [--lang {en,it}] [--state FILE]
[--log-level {kpi,series,full,study,explore,replay}]
[--no-logs] [--raw] [--json] [--no-checks]
model
Run a Naga model headless.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
options:
-h, --help show this help message and exit
--version show program's version number and exit
--replications REPLICATIONS
default: the model's own 'simulation.replications'
--seed SEED
--warmup WARMUP default: the model's own 'simulation.warmup'
--run-length RUN_LENGTH
0 = run until the queue drains; default: the model's
own 'simulation.time_limit'
--start ISO real instant model time 0 stands for, e.g.
2026-01-05T06:00:00 ; overrides the model's own
'simulation.calendar.start'
--until ISO run until this real instant instead of a length; needs
a calendar start, from the model or from --start
--timezone IANA IANA timezone for --start/--until and for weekday
schedules (default: the model's own, else UTC)
--workers WORKERS replications to run in parallel processes, or 'auto'
(default: 1)
--logic MODULE take LOGIC block classes from this importable module
first (a dotted name on PYTHONPATH), then from
nagasim.core.custom_logic
--controllers MODULE[:NAME]
drive the Policy-mode DECIDE blocks with the dict
{decision point: controller} NAME (default
CONTROLLERS) of this importable module (a dotted name
on PYTHONPATH)
--pace FACTOR keep pace with the wall clock: FACTOR model seconds
per wall second, converted from the model's time unit
(1 = real time, 60 = one model minute per second);
late events are counted, and the results are the
unpaced run's
--out OUT write the 10-sheet results workbook here
--report REPORT write an HTML report here
--export FORMAT:PATH write with a registered exporter, e.g. json:out.json;
repeatable. See nagasim.exporters.EXPORTER_REGISTRY
for the built-in formats (xlsx/csv/html/json/player)
plus any plugin ones
--player PATH write a shareable HTML player of the first replication
here: one self-contained file that replays the run in
a browser, with no server (the same as --export
player:PATH)
--asked FILE with --player or --export player:PATH: recorded
answers for the trust card: a study version's
asked.json, or a file of the editor's answers store;
its input-data and parameter rows quote them instead
of 'not measured'
--lang {en,it} with --player or --export player:PATH: the language of
the page (default en)
--state FILE start from this state document (`naga state take`):
the run's clock starts where the state was taken and
its statistics cover the run from there
--log-level {kpi,series,full,study,explore,replay}
what the run records: kpi (the summary frames), series
(plus the time series), full (plus the per-event logs,
the default), or a profile: study = kpi, explore =
full, replay = full with the trace of the first
replication recorded for --player and --export; a
frame below the level is left out, not empty
--no-logs do not record the per-event entity/resource/store
logs: faster and much smaller on a long run, and every
summary statistic is unchanged -- only the three flat
log sheets come back empty (not with --log-level,
which leaves frames out instead)
--raw print the per-replication system frame instead of the
summary
--json print {kpis, checks, replications, log_level} as JSON
instead of the summary
--no-checks skip the law checks (the WARN lines)
naga scenarios¶
usage: naga scenarios [-h] [--scenario SCENARIOS]
[--replications REPLICATIONS] [--run-length RUN_LENGTH]
[--warmup WARMUP] [--seed SEED] [--workers WORKERS]
[--no-crn] [--kpi KEY] [--all] [--out OUT]
[--report REPORT] [--player PATH] [--asked FILE]
[--lang {en,it}]
model
Run named scenarios headless and compare them.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
options:
-h, --help show this help message and exit
--scenario SCENARIOS scenario name to run (default: all); may repeat
--replications REPLICATIONS
default: the model's own 'simulation.replications'
--run-length RUN_LENGTH
default: the model's own 'simulation.time_limit'
--warmup WARMUP default: the model's own 'simulation.warmup'
--seed SEED
--workers WORKERS replications to run in parallel processes, or 'auto'
(default: 1)
--no-crn disjoint seeds per scenario (Welch's interval) instead
of paired CRN
--kpi KEY show this KPI (a key such as system/Avg Throughput
Time or cost/Robot/Amount); may repeat. Default: the
system KPIs `naga run` prints
--all show every KPI of every family (the table --out
writes)
--out OUT write the comparison table here (.xlsx or .csv);
always every KPI
--report REPORT write an HTML report here
--player PATH write a shareable HTML player here: the first
replication of every scenario, run again with its seed
and recorded, in one self-contained file with a
scenario switch
--asked FILE with --player: recorded answers for the trust card: a
study version's asked.json, or a file of the editor's
answers store; its input-data and parameter rows quote
them instead of 'not measured'
--lang {en,it} with --player: the language of the page (default en)
naga explain¶
usage: naga explain [-h] [--set PATH=VALUE] [--replications REPLICATIONS]
[--seed SEED]
model kpi
Rank the measured contributors to a KPI, each with its 95% interval, and
suggest one what-if test of the top one. With --set, compare the baseline and
the changed model on paired seeds instead.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
kpi e.g. 'system/Avg Throughput Time', 'system/Throughput
(per time unit)' or 'resource/<name>/Usage %
(snapshot)'
options:
-h, --help show this help message and exit
--set PATH=VALUE an override (the scenario path grammar); may repeat.
The value is read as JSON, else as text
--replications REPLICATIONS
replications (default 5); with --set the first count,
doubled up to 50 until the KPI's difference is clear
--seed SEED
naga invest¶
usage: naga invest [-h] [--replications REPLICATIONS] [--seed SEED]
[--csv CSV]
model
Run every scenario and print payback, NPV and ROI against the baseline of the
model's investment section.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
options:
-h, --help show this help message and exit
--replications REPLICATIONS
default: the model's own 'simulation.replications'
--seed SEED
--csv CSV write the table here as CSV
naga fit¶
usage: naga fit [-h] [--column COLUMN] [--top TOP] [--shift] [--json JSON]
data
Fit candidate distributions to a data column.
positional arguments:
data CSV/TSV/TXT or XLSX file
options:
-h, --help show this help message and exit
--column COLUMN default: the first numeric column
--top TOP ranking rows to print
--shift fit a free location offset for positive-support families
--json JSON write the full ranking + best spec here
naga uncertainty¶
usage: naga uncertainty [-h] --data PATH=FILE[:COLUMN] [--kpi KPI]
[--resamples RESAMPLES] [--replications REPLICATIONS]
[--seed SEED] [--run-length RUN_LENGTH]
[--warmup WARMUP] [--out OUT] [--bin-width BIN_WIDTH]
[--cycle CYCLE]
model
How much of each KPI's spread comes from the data its inputs were fitted to:
each input's data is resampled and refitted, the model run per resample on the
same seeds, and each KPI gets its run-to-run 95% interval, its interval with
the inputs' uncertainty, and the inputs' share.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
options:
-h, --help show this help message and exit
--data PATH=FILE[:COLUMN]
an input and its data: a '...distribution' field and a
sample, or 'schedules.<name>.points' and arrival
timestamps; may repeat
--kpi KPI a KPI key (e.g. 'system/Avg Throughput Time'); may
repeat. Default: every system KPI
--resamples RESAMPLES
bootstrap resamples (default 20)
--replications REPLICATIONS
replications per resample, the same seeds for each
(default 5)
--seed SEED
--run-length RUN_LENGTH
--warmup WARMUP
--out OUT write the KPI table (one row per KPI) here (.xlsx or
.csv)
--bin-width BIN_WIDTH
an arrival table's bin width, in base time units
--cycle CYCLE an arrival table's cycle (e.g. one day), in base time
units
naga doe¶
usage: naga doe [-h] --factor FACTORS --response RESPONSE
[--replications REPLICATIONS] [--run-length RUN_LENGTH]
[--warmup WARMUP] [--seed SEED] [--logic MODULE]
[--controllers MODULE[:NAME]] [--workers WORKERS] [--out OUT]
[--report REPORT] [--design DESIGN] [--no-crn]
[--surrogate {linear,quadratic,auto}] [--dataset DATASET]
model
Run a design of experiments over model parameters.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
options:
-h, --help show this help message and exit
--factor FACTORS a factor, as 'path=kind:low:high[:step]' or
'path=cat:a|b|c'. kind is float/int/cat. Several
comma-separated paths before the '=' are driven with
the same value. May repeat. Example:
'resources.Agents.capacity=int:3:6'
--response RESPONSE the KPI key to analyse, e.g. 'system/Avg Throughput
Time'
--replications REPLICATIONS
replications per design point (default: 5)
--run-length RUN_LENGTH
default: the model's own 'simulation.time_limit'
--warmup WARMUP default: the model's own 'simulation.warmup'
--seed SEED
--logic MODULE take LOGIC block classes from this importable module
first (a dotted name on PYTHONPATH), then from
nagasim.core.custom_logic
--controllers MODULE[:NAME]
drive the Policy-mode DECIDE blocks with the dict
{decision point: controller} NAME (default
CONTROLLERS) of this importable module (a dotted name
on PYTHONPATH)
--workers WORKERS replications to run in parallel processes (default: 1)
--out OUT write the result table here (.xlsx or .csv)
--report REPORT write an HTML report here
--design DESIGN full[:levels] (default full:2), lhs:<n>, or oat
--no-crn give each design point its own seed block instead of
CRN
--surrogate {linear,quadratic,auto}
fit a response surface over the design; included in
--report as its own section
--dataset DATASET write one row per (design point, replication) here, as
factors + responses + seed (.csv, or .parquet if
available)
naga optimize¶
usage: naga optimize [-h] --factor FACTORS --response RESPONSE
[--replications REPLICATIONS] [--run-length RUN_LENGTH]
[--warmup WARMUP] [--seed SEED] [--logic MODULE]
[--controllers MODULE[:NAME]] [--workers WORKERS]
[--out OUT] [--report REPORT] [--goal {min,max}]
[--budget BUDGET] [--constraint CONSTRAINTS]
[--method {auto,pattern,optuna,optuna-gp,optuna-nsga2}]
[--objective KPI:min|max] [--indifference INDIFFERENCE]
[--min-improvement MIN_IMPROVEMENT]
[--statistic mean|pNN] [--penalty KPI:WEIGHT]
[--holdout N] [--holdout-seed HOLDOUT_SEED] [--baseline]
model
Search model parameters for the best KPI within a replication budget.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
options:
-h, --help show this help message and exit
--factor FACTORS a factor, as 'path=kind:low:high[:step]' or
'path=cat:a|b|c'. kind is float/int/cat. Several
comma-separated paths before the '=' are driven with
the same value. May repeat. Example:
'resources.Agents.capacity=int:3:6'
--response RESPONSE the KPI key to analyse, e.g. 'system/Avg Throughput
Time'
--replications REPLICATIONS
replications per design point (default: 5)
--run-length RUN_LENGTH
default: the model's own 'simulation.time_limit'
--warmup WARMUP default: the model's own 'simulation.warmup'
--seed SEED
--logic MODULE take LOGIC block classes from this importable module
first (a dotted name on PYTHONPATH), then from
nagasim.core.custom_logic
--controllers MODULE[:NAME]
drive the Policy-mode DECIDE blocks with the dict
{decision point: controller} NAME (default
CONTROLLERS) of this importable module (a dotted name
on PYTHONPATH)
--workers WORKERS replications to run in parallel processes (default: 1)
--out OUT write the result table here (.xlsx or .csv)
--report REPORT write an HTML report here
--goal {min,max}
--budget BUDGET total replications the search may spend (default: 300)
--constraint CONSTRAINTS
a KPI constraint, as '<kpi key><=<value>' or '<kpi
key>>=<value>'. May repeat. Example:
'resource/Agents/Usage % (snapshot)<=85'
--method {auto,pattern,optuna,optuna-gp,optuna-nsga2}
--objective KPI:min|max
an objective of --method optuna-nsga2 (give at least
two)
--indifference INDIFFERENCE
the smallest difference worth detecting in the final
ranking-and-selection step (default: 5% of the best
mean)
--min-improvement MIN_IMPROVEMENT
relative gain a move must reach before the search
widens that factor's step (default: 0.01 = 1% of the
objective). 0 widens on any significant gain
--statistic mean|pNN the objective over a point's replications: mean
(default) or a percentile such as p95
--penalty KPI:WEIGHT charge WEIGHT x mean(KPI) against the objective (added
when minimising, subtracted when maximising);
repeatable
--holdout N evaluate the final points (and --baseline) on N seeds
the search never used, from --holdout-seed
--holdout-seed HOLDOUT_SEED
first holdout seed (default: --seed + 1000000)
--baseline evaluate the model's own factor values first (trial 0)
naga policy-eval¶
usage: naga policy-eval [-h] --policy POLICY
(--controller {random,roundrobin,shortest} | --policy-file POLICY_FILE)
[--reward {neg_wip,throughput,neg_time_in_system}]
[--episodes EPISODES] --horizon HORIZON [--seed SEED]
model
Evaluate a controller against a Policy-mode DECIDE.
positional arguments:
model path to the model JSON, or a bundled model's name
(naga examples)
options:
-h, --help show this help message and exit
--policy POLICY decision-point name
--controller {random,roundrobin,shortest}
built-in controller to evaluate
--policy-file POLICY_FILE
data-only JSON policy (table or linear, see
nagasim.policyfile)
--reward {neg_wip,throughput,neg_time_in_system}
--episodes EPISODES
--horizon HORIZON
--seed SEED