mamut_routing_tools.family¶
Benchmark-family generation: publish the whole family into a marker-rooted collection tree (slim CVRP / VRPTW instances, shared geo / road / traffic / distances sidecars, and the TDVRP/TDVRPTW twins of the road-graph v2 td model).
Relocated from mamut_routing_publish.td_generation: generation
now lives in the generation tool. Consumes the TD bridge produced by
mamut_routing_tools.td.traffic plus the stage-1 sampling intermediates from
mamut_routing_tools.generation.
build_base
¶
build_base(
*,
graph: BridgeGraph,
nodes: BridgeNodes,
meta: dict[str, Any],
manifest: dict[str, Any],
city: str,
method_tag: str,
collection_root: str | Path,
sample_step: float = DEFAULT_SAMPLE_STEP,
extension_end: float = DEFAULT_EXTENSION_END,
generated_at: str | None = None,
force: bool = False,
family: str = FAMILY,
commit_distances: bool = True,
) -> BuiltBase | None
Publish the base: road + geo + distances sidecars and the 3 CVRP instances.
commit_distances=False computes and hashes the distance matrices exactly
as usual, records the pins in every instance's arc_costs_source, and then
does not write the two .distances-*.json.gz files. The instance is a
complete descriptor that a consumer regenerates its matrices for, verified
against the pins -- the treatment the Blauth2024 family already uses for its
oversized sidecars. It implies pin_shortest_paths, since a regenerated
shortest matrix has to come from the published road graph.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/family/family.py
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | |
build_td
¶
build_td(
*,
collection_root: str | Path,
graph: BridgeGraph,
speeds_by_combo: dict[tuple[str, str], BridgeSpeeds],
city: str,
num_customers: int,
method_tag: str,
generated_at: str | None = None,
force: bool = False,
verify: bool = True,
tdvrptw_only: bool = False,
reuse_traffic: bool = False,
family: str = FAMILY,
route_count: int | None = None,
) -> BuiltTDBase | None
Publish the TD layer of a base: 6 overlays, TW lift, 12 slim twins.
All or nothing: preconditions are checked before anything is written, every
new file (the finalized VRPTW instance, the rebuilt overlays, the twins) is
written into a :class:~mamut_routing_tools.staging.StagedTree, and with
verify one TDVRPTW twin per overlay is loaded from the staging tree with
full sha256 checks before the files replace the live ones. A failure leaves
the collection as it was.
reuse_traffic (implied by tdvrptw_only) keeps the published
overlays and the TDVRP twins' metadata; both must exist. An existing
atf_sha256 is reused only when it pins exactly this road graph and
overlay (:func:_reusable_atf_pin), otherwise the ATFs are materialized
and hashed. The windows are audited from their pre-lift values
(:func:_pre_lift_windows), so re-running the build reproduces the
tw_repair record rather than erasing it.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/family/family.py
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | |
capacity_lower_bound
¶
Return the standard capacity lower bound, excluding the depot demand.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/family/family.py
derive_vrptw
¶
derive_vrptw(
*,
collection_root: str | Path,
city: str,
num_customers: int,
method_tag: str,
tw_set: str = TW_SET_TD_SHARED,
generated_at: str | None = None,
force: bool = False,
family: str = FAMILY,
route_count: int | None = None,
) -> tuple[str, Path]
Emit one VRPTW TW-set instance of a base.
td-shared emits the candidate finalized by build_td (audit +
minimal shared TW repair); the static-only sets (tight, spread)
are final as written and never touched by build_td. Returns
(action, path) with action in derived / kept / annotated
(the latter: an existing td-shared instance received the tw_set
metadata block in place, windows untouched).
Source code in MAMUT-routing-tools/src/mamut_routing_tools/family/family.py
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | |
materialize_distances
¶
materialize_distances(
instance_path: str | Path,
*,
collection_root: str | Path | None = None,
force: bool = False,
) -> dict[str, Any]
Rebuild an instance's distance sidecar from its published road graph.
The counterpart of build_base(commit_distances=False). Large instances
ship as descriptors: the .vrp.json records the sidecar's path and its
sha256, and the bytes themselves are regenerated locally rather than stored.
This recomputes them from the committed .road.json.gz and refuses to
write anything whose digest does not match the recorded pin, so a
materialized sidecar is exactly the one the instance was published against.
Returns a record describing what happened; status is written,
kept (already present) or euclidean (nothing to do -- that variant
derives its costs from the coordinates).
Source code in MAMUT-routing-tools/src/mamut_routing_tools/family/family.py
sampling_seed
¶
Stage-1 sampling seed, derived from the base name (recorded provenance; reproducible under the pinned Julia toolchain only).
simplify_tolerance_for
¶
Frozen family policy: 1.0 s for n <= 100, 2.0 s for n >= 500.
base_instance_name
¶
base_instance_name(
city: str,
n: int,
method_tag: str,
family: str = FAMILY,
*,
route_count: int | None = None,
) -> str
<family>-<city>-n<N>[-k<K>]-<method>.
route_count is the bin-packing minimum fleet. It is only written into the
name for families in :data:FAMILIES_WITH_FLEET_IN_NAME, and passing it for
a family that does not want it is a caller error rather than a silent no-op:
a name that sometimes carries k and sometimes does not is unparseable.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/family/naming.py
family_prefix
¶
A family's base-name prefix: its name minus the trailing release year.
Poryos2026 -> poryos, Mamut2026 -> mamut. A rule rather than a
lookup table, so adding a family means picking a name and nothing else.
Source code in MAMUT-routing-tools/src/mamut_routing_tools/family/naming.py
vrptw_instance_name
¶
TD-paired set: the bare base name; static-only sets: <base>-tw-<set>.