Batch Replication
Purpose
Batch replication runs multiple independent headless simulations in parallel.
Each replication uses a different random seed, writes its own metrics, and the
batch driver writes a top-level summary.json with aggregate statistics. This
mode is useful when the research question depends on statistical metrics rather
than a single trajectory realization, such as repeated uncertainty
realizations, sensitivity analysis, or policy comparison.
Batch mode parallelizes across independent replications. It does not make one individual scenario trajectory faster; it improves experiment-level throughput when many seeds are needed.
Command
loft-sim batch -c example/scenarios/default/config/sim_config_preflight.xml \
--batch-runs 100 --batch-workers 16 \
--batch-output-dir outputs/batch/preflight_100x16_operational
Arguments
| Argument | Meaning |
|---|---|
-c, --config FILE |
Simulation configuration to replicate; defaults to example/scenarios/sample_demo/config/simulation_config.xml |
--batch-runs N |
Number of independent replications; defaults to 1 |
--batch-workers W |
Number of worker processes; defaults to min(N, CPU count) |
--batch-seed-base S |
First random seed; run i uses S + i - 1 |
--batch-output-dir DIR |
Directory for per-run configs, per-run metrics and XML outputs, and summary.json. A relative DIR is resolved against the folder that contains the loft package (the repository root in the editable install), not the current directory; without the option the batch writes to outputs/batch/<config name>_<timestamp>/ there |
--batch-disable-xml-outputs |
Disable XML output writers for timing-focused studies |
loft-sim run --batch takes the same arguments. If --batch-seed-base is not
provided, the base seed is read from the selected simulation config. Batch
mode rejects GUI and web visualization options because workers run headless. Per-run simulation_config.xml files are written in the
canonical effective config format; retired flat top-level keys are rejected by
the loader, so none appear.
Outputs
The batch output directory contains:
outputs/batch/preflight_100x16_operational/
|-- run_001/
| |-- simulation_config.xml
| |-- metrics.json
| |-- summary_output.xml
| |-- fcd_output.xml
| |-- tripinfo_output.xml
| |-- corridor_output.xml
| |-- safety_metrics_output.xml
| `-- preflight_schedule.xml
|-- run_002/
| `-- ... (same files)
`-- summary.json
Each run keeps the XML outputs its configuration enables, written into its own
run_NNN/ folder and named after the output kind (summary_output.xml,
fcd_output.xml, …) rather than the file names in the configuration. The
pre-flight configuration above enables six, about 27 MB per run.
--batch-disable-xml-outputs leaves only simulation_config.xml and
metrics.json in each run folder, and the metrics derived from the XML
outputs are then missing from metrics.json (see
Batch Metrics).
What each metrics.json and the top-level summary.json contain is
described under Batch Metrics.
Paper Benchmark
The numbers in this section were measured with the simulator version used for
the paper. The branch archive/paper-reproduction keeps that behaviour.
The simulator has been corrected since, so the current version gives different
plan and delivery counts for the same scenario and seeds. The paper case-study
pipeline lives under experiments/; generated timing and result files belong
under outputs/, which is ignored by Git.
The paper batch benchmark was run on a Linux x86_64 workstation with an AMD Ryzen 9 9950X processor using Python 3.13. The machine has 16 physical cores, 32 logical CPUs, and 123.5 GiB of system memory, or about 7.7 GiB per physical core. The benchmark used the pre-flight scenario with XML metric outputs enabled and ran 100 seeds on 16 worker processes. The batch completed 100 × 3600 s of simulated time in 549.9 s of wall-clock time, corresponding to an aggregate fast-time throughput of 654.7×.
Across the 100 seeds, the mean number of feasible strategic plans was 212.2 with a standard deviation of 12.7, and the mean number of completed deliveries was 184.6 with a standard deviation of 8.5. Medical-priority requests had zero strategic rejections across all 100 seeds, and the safety diagnostics reported zero same-corridor separation violations below 10 m and zero geofence violations.
Practical Notes
- Use
--batch-disable-xml-outputsfor timing studies or large sweeps where XML serialization is not part of the measurement. - Set
--batch-output-direxplicitly for named experiments or benchmark runs so results are easy to archive and compare. - Choose
--batch-workersbased on CPU availability and memory pressure. More workers increase throughput until the machine saturates. - Use fixed seed ranges when comparing policies so differences come from policy behavior rather than different random demand realizations.
- For an ACI-controlled policy, run each replication in its own process, give every controller the intended seed, and aggregate the resulting metrics. ACI sessions are intentionally explicit rather than embedded in the batch workers.