mamut_routing_tools.generation.artifacts¶
The files that belong to a generated instance, and its content identity.
A generated base <city>_<abbr>-n<N>-k<K>[<suffix>] owns every file named
<base>_... (the three metric .vrp / .vrp.json, _meta.json,
_manifest.json, the VRPTW twin and its manifest, BKS files), its derive-td
sidecars <base>.road.json.gz / <base>.traffic-<sub>.json.gz and TD
twins <base>-<model>-<intensity>[.tdvrp].vrp.json. Sibling bases share a
prefix (...-k2 and ...-k25, ...-k2-2), so ownership is an exact
pattern match, never startswith(base).
Two generations are the same instance when their three CVRPLIB files agree
past the NAME line (coordinates, demands, capacity and the three
matrices): :func:instance_content_sha256. Timestamps live in the JSON files
and are not part of the identity.
belongs_to_base
¶
Whether the file name is one of base's artifacts (and not a sibling base's).
instance_artifact_paths
¶
Every file of folder that belongs to base, sorted.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/artifacts.py
purge_instance_artifacts
¶
Delete every artifact of base (instance files and everything derived from them).
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/artifacts.py
vrp_text_sha256
¶
sha256 of a CVRPLIB text without its NAME line (the name is not content).
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/artifacts.py
content_sha256_of_texts
¶
Content identity of an instance from its three metric .vrp texts.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/artifacts.py
instance_content_sha256
¶
Content identity of the instance base on disk; None when its .vrp files are absent.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/artifacts.py
claim_lock
¶
claim_lock(
folder: str | Path,
*,
timeout_s: float = 120.0,
stale_after_s: float = 600.0,
) -> Iterator[None]
Serialize name claims in folder across threads and processes.
Held while a generation decides which base name it writes and writes it,
so two jobs regenerating the same configuration cannot both take (or both
overwrite) the same name. A lock file older than stale_after_s is a
crashed holder's and is broken.