Generate or convert a family¶
Generation lives in MAMUT-routing-tools, deliberately as a library: the CLI is per-instance
(generate single → derive-vrptw → derive-td), and a family is a per-campaign script calling the library so the
campaign's decisions are code under version control.
The Poryos2026 pipeline (mamut_routing_tools.family)¶
Per base instance (city × n × sampling method), three stages, each recorded in every artifact's generator block:
build_base(stagegenerate-base): full-city road graph, trimmed to the union of pinned free-flow fastest-path edges, both distance matrices, the indexed geo road cache; publishes the three slim CVRP metric instances (euclidean,shortest,fastest) plus thegeo,roadanddistances-*sidecars into the collection.derive_vrptw(stagederive-vrptw): name-seeded service times and time windows over the published fastest matrix; three TW sets (td-shared, the one the TD twins share;tightandspread, static only).build_td(stagebuild-td): aligns the six traffic overlays (bprandwavemodels × three intensities), materializes canonical ATFs, certifies anchor routes under every overlay, applies minimal shared deadline lifts, emits the twelve sha-pinned TD twins. Hard gates: the publisheddistances-fastestequals the road graph's free-flow times after rounding, and the post-lift audit holds for every overlay. Since tools 0.6.0 the stage is all or nothing: preconditions are checked first, the VRPTW file, overlays and twins are written into a staging tree (<collection>/.mamut-staging/), one TDVRPTW twin per overlay is loaded from it with full sha256 checks, and only then is anything published. A rebuild with new traffic re-materializes the ATF pins (an existingatf_sha256is reused only underreuse_trafficand only when it pins the same graph and overlay), and a re-run audits from the pre-lift windows, sometadata.tw_repairis reproduced rather than erased.
Naming and tree layout are in family/naming.py; family.materialize_distances rebuilds pinned matrices;
generation.bulk.generate_bulk_instances / preflight_rows drive many bases from a row table.
# the per-instance CLI, for one base
mamut-tools osm fetch-city Lyon --country France --profile generation --osm-dir work/osmdata # -> work/osmdata/Lyon.osm
mamut-tools generate single Lyon --osm-path work/osmdata/Lyon.osm --n 200 --output-dir work --vrptw
mamut-tools generate derive-td <folder> <base> --all # folder and base name as printed by `generate single`
The per-instance path uses the same anchor discipline as the family: derive-vrptw stores capacity-, horizon- and
window-feasible anchor_routes, and derive-td certifies the windows along them, splitting a route that no longer
returns by the horizon under traffic. generate single never overwrites a different instance of the same name
silently: it reports unchanged, writes <name>-2 (renamed), or with --replace purges the old instance and its
twins and BKS (replaced).
The Mamut2026 design layer (mamut_routing_tools.campaign)¶
Before generating, decide which instances make a set worth reporting on:
city_profile: measure each city's road-network distortion from the Euclidean plane and stratify.poi_capacity: measure how many POI-only customers a city can supply (the 35 curated amenity categories).ladder: the size ladder (geometric n from 100 to 1000, one per rung) and rung → city → method assignment.design: enumerate a balanced candidate pool and evaluate cheaply (selection and demands, no matrices).select: max-min spread over the descriptor space under the coverage quotas ofquotas.py.
Then generation.single / family.build_base produce the artifacts. Record the plan files (profiles, capacities,
ladder) with the campaign script; the collection README documents the achieved coverage.
Converting an external distribution¶
conversion/blauth2024.py is the template: a pure relabeling (no numeric transformation, so the canonical bytes and atf_sha256 pins are identical on any machine), the family contract spelled out in the module docstring (time unit, horizon, depot window, service, capacity, fleet, objective and its constants), per-instance assertions for every assumption, and a pointer to the design note. The command is mamut-tools convert blauth2024 <upstream-checkout> <output>. Older TD conversions (Ari2018, Vu2020, Rifki2020, Lera2026) predate the tools and are documented in their family READMEs.
Memory and time¶
Distance matrices are computed in Dijkstra chunks of 256 sources; a 5000-source run over a 100k-vertex graph is
several GB of float64. City extracts run to ~150 MB of XML and are parsed incrementally. Large Overpass downloads
are tiled with a persistent tile cache so an interrupted fetch resumes. Parallelism is per city
(ProcessPoolExecutor) in the campaign steps.
After generating: validate every instance and BKS with the lib, run the BKS campaign, then add the family.