mamut_routing_tools.generation.vrptw¶
VRPTW derivation from generated CVRP instances (port of the workbench route_centered / reachable_interval time-window synthesis).
Both methods persist capacity-, horizon- (and window-) feasible anchor
routes in the derivation manifest; derive-td certifies the windows
along them under traffic. route_centered centres each window on the
customer's free-flow visit time along those routes (the family's
construct_anchor_routes); before 0.6.0 it used a single capacity-agnostic
nearest-neighbour tour, which ran past the horizon beyond about 80
customers and left most windows equal to the whole feasible interval.
stable_seed
¶
Deterministic cross-run seed from arbitrary parts (replaces Julia's
hash(tuple); values differ from Julia by design, determinism within
Python is the contract).
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/vrptw.py
generate_tw_route_centered
¶
generate_tw_route_centered(
rng: Random,
travel_times: list[list[int]],
service_times: list[int],
horizon_start: int,
horizon_end: int,
*,
demands: list[int],
capacity: int,
depot: int = 0,
width_ratio_mean: float = 0.2,
width_ratio_std: float = 0.08,
) -> tuple[list[tuple[int, int]], list[list[int]], float]
Windows centred on free-flow visits along capacity-and-horizon-feasible anchor routes.
Returns (time_windows, anchor_routes, width_ratio_mean). The rng draws
(one width per customer, in index order) are unchanged, so a seed still
gives the same widths; only the centres moved to the feasible routes.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/vrptw.py
cvrptw_text
¶
cvrptw_text(
parsed: ParsedCvrpInstance,
instance_name: str,
comment: str,
service_times: list[int],
time_windows: list[tuple[int, int]],
) -> str
The CVRPTW .vrp text :func:write_cvrptw_vrp writes.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/vrptw.py
derive_vrptw_from_cvrp
¶
derive_vrptw_from_cvrp(
folder: str | Path,
base: str,
*,
tw_method: str = DEFAULT_TW_METHOD,
horizon_start: int = HORIZON_START,
horizon_end: int = HORIZON_END,
place_slug: str = "",
source_seed: int = 0,
) -> dict[str, Any]
Derive the fastest-metric VRPTW twin next to a generated CVRP base.
Reads <base>_fastest.vrp, synthesizes service times + time windows on
the fastest travel times, and writes <base>_fastest.cvrptw.vrp plus a
<base>_vrptw_manifest.json describing the derivation.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/generation/vrptw.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |