# showmaker2021/mtl_diffu_guide architecture

> Architecture diagram of the GitHub repository showmaker2021/mtl_diffu_guide, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/showmaker2021/mtl_diffu_guide
- Repository: https://github.com/showmaker2021/mtl_diffu_guide

## Overview

SOLID trains and evaluates neural vehicle-routing policies across 16 VRP variants. The main workflow selects a problem environment and model, learns or runs a route-construction policy, then reports solution scores; evaluation can also use external benchmark datasets. The graph preserves the documented single-task, multi-task, mixture-of-experts, mixed, and slot-diffusion model families, plus the listed classical baselines. Some trainer/model dispatch details are unsampled, so those links are omitted or marked unverified.

Main entry points: [`utils.py`](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/utils.py) (Runtime utilities), [`Trainer.py`](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/Trainer.py) (Training loop), [`train.py`](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/train.py) (Training entry), [`Tester.py`](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/Tester.py) (Evaluation loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Training and evaluation"]
  node_train_entry["Training entry<br/>[train.py]"]
  node_trainer["Training loop<br/>[Trainer.py]"]
  node_tester["Evaluation loop<br/>[Tester.py]"]
  node_data_gen["Instance generation<br/>[generate_data.py]"]
  node_shared_utils["Runtime utilities<br/>[utils.py]"]
  node_benchmark_data["Benchmark datasets"]
end

subgraph group_routing["Routing environments"]
  node_env_core["Core VRP variants<br/>[CVRPEnv.py]"]
  node_env_open["Open-route variants<br/>[OVRPEnv.py]"]
  node_env_backhaul["Backhaul variants<br/>[VRPBEnv.py]"]
  node_env_linehaul["Linehaul variants<br/>[VRPLEnv.py]"]
  node_env_time["Time-window variants<br/>[VRPTWEnv.py]"]
  node_env_open_time["Open time windows<br/>[OVRPTWEnv.py]"]
  node_env_open_backhaul["Open backhaul variants<br/>[OVRPBEnv.py]"]
  node_env_open_linehaul["Open linehaul variants<br/>[OVRPLEnv.py]"]
  node_env_backhaul_linehaul["Backhaul-linehaul variants<br/>[VRPBLEnv.py]"]
  node_env_backhaul_time["Backhaul time windows<br/>[VRPBTWEnv.py]"]
  node_env_linehaul_time["Linehaul time windows<br/>[VRPLTWEnv.py]"]
  node_env_open_backhaul_linehaul["Open combined variants<br/>[OVRPBLEnv.py]"]
  node_env_open_backhaul_time["Open backhaul windows<br/>[OVRPBTWEnv.py]"]
  node_env_open_linehaul_time["Open linehaul windows<br/>[OVRPLTWEnv.py]"]
  node_env_backhaul_linehaul_time["Combined time windows<br/>[VRPBLTWEnv.py]"]
  node_env_open_combined_time["Open combined windows<br/>[OVRPBLTWEnv.py]"]
end

subgraph group_models["Policy models"]
  node_single_policy["Single-task policy<br/>[SINGLEModel.py]"]
  node_mtl_policy["Multi-task policy<br/>[MTLModel.py]"]
  node_moe_policy["MoE policy<br/>[MOEModel.py]"]
  node_mixed_policies["Mixed policies<br/>[MTLModel_Mixed.py]"]
  node_slot_policy["Slot policy<br/>[SlotModel.py]"]
  node_slot_diffusion["Slot diffusion policy<br/>[SlotDiffModel.py]"]
  node_slot_moe_diffusion["Slot diffusion MoE"]
end

subgraph group_baselines["Optimization baselines"]
  node_lkh["LKH baseline<br/>[LKH_baseline.py]"]
end

subgraph group_internals["Model internals"]
  node_moe_layer["Expert routing layer<br/>[MOELayer.py]"]
  node_manifolds["Manifold operations<br/>[manifolds.py]"]
  node_stereo_networks["Stereographic networks<br/>[networks.py]"]
end

node_user(("Researcher"))

node_user -->|"starts training"| node_train_entry
node_user -->|"starts evaluation"| node_tester
node_user -->|"runs baseline"| node_lkh
node_train_entry -->|"invokes"| node_trainer
node_train_entry -->|"uses"| node_shared_utils
node_trainer -->|"uses"| node_shared_utils
node_tester -->|"selects environment"| node_shared_utils
node_tester -->|"loads instances"| node_benchmark_data
node_data_gen -->|"saves datasets"| node_shared_utils
node_shared_utils -->|"maps problem"| node_env_core
node_shared_utils -->|"maps problem"| node_env_open
node_shared_utils -->|"maps problem"| node_env_backhaul
node_shared_utils -->|"maps problem"| node_env_linehaul
node_shared_utils -->|"maps problem"| node_env_time
node_shared_utils -->|"maps problem"| node_env_open_time
node_shared_utils -->|"maps problem"| node_env_open_backhaul
node_shared_utils -->|"maps problem"| node_env_open_linehaul
node_shared_utils -->|"maps problem"| node_env_backhaul_linehaul
node_shared_utils -->|"maps problem"| node_env_backhaul_time
node_shared_utils -->|"maps problem"| node_env_linehaul_time
node_shared_utils -->|"maps problem"| node_env_open_backhaul_linehaul
node_shared_utils -->|"maps problem"| node_env_open_backhaul_time
node_shared_utils -->|"maps problem"| node_env_open_linehaul_time
node_shared_utils -->|"maps problem"| node_env_backhaul_linehaul_time
node_shared_utils -->|"maps problem"| node_env_open_combined_time
node_trainer -.->|"dispatches model"| node_single_policy
node_trainer -.->|"dispatches model"| node_mtl_policy
node_trainer -.->|"dispatches model"| node_moe_policy
node_trainer -.->|"dispatches model"| node_mixed_policies
node_trainer -.->|"dispatches model"| node_slot_policy
node_trainer -.->|"dispatches model"| node_slot_diffusion
node_trainer -.->|"dispatches model"| node_slot_moe_diffusion
node_moe_policy -->|"uses experts"| node_moe_layer
node_slot_moe_diffusion -->|"uses experts"| node_moe_layer
node_mixed_policies -->|"uses geometry"| node_manifolds
node_mixed_policies -->|"uses networks"| node_stereo_networks
node_lkh -->|"reads instances"| node_benchmark_data

click node_train_entry "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/train.py"
click node_trainer "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/Trainer.py"
click node_tester "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/Tester.py"
click node_data_gen "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/generate_data.py"
click node_shared_utils "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/utils.py"
click node_env_core "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/CVRPEnv.py"
click node_env_open "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPEnv.py"
click node_env_backhaul "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBEnv.py"
click node_env_linehaul "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPLEnv.py"
click node_env_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPTWEnv.py"
click node_env_open_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPTWEnv.py"
click node_env_open_backhaul "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBEnv.py"
click node_env_open_linehaul "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPLEnv.py"
click node_env_backhaul_linehaul "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBLEnv.py"
click node_env_backhaul_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBTWEnv.py"
click node_env_linehaul_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPLTWEnv.py"
click node_env_open_backhaul_linehaul "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBLEnv.py"
click node_env_open_backhaul_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBTWEnv.py"
click node_env_open_linehaul_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPLTWEnv.py"
click node_env_backhaul_linehaul_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBLTWEnv.py"
click node_env_open_combined_time "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBLTWEnv.py"
click node_single_policy "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SINGLEModel.py"
click node_mtl_policy "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MTLModel.py"
click node_moe_policy "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MOEModel.py"
click node_mixed_policies "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MTLModel_Mixed.py"
click node_slot_policy "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SlotModel.py"
click node_slot_diffusion "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SlotDiffModel.py"
click node_slot_moe_diffusion "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SlotDiffMOEModel.py"
click node_moe_layer "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MOELayer.py"
click node_manifolds "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/manifolds.py"
click node_stereo_networks "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/networks.py"
click node_lkh "https://github.com/showmaker2021/mtl_diffu_guide/blob/main/baselines/LKH_baseline.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_train_entry,node_trainer,node_tester,node_data_gen,node_shared_utils,node_benchmark_data toneBlue
class node_env_core,node_env_open,node_env_backhaul,node_env_linehaul,node_env_time,node_env_open_time,node_env_open_backhaul,node_env_open_linehaul,node_env_backhaul_linehaul,node_env_backhaul_time,node_env_linehaul_time,node_env_open_backhaul_linehaul,node_env_open_backhaul_time,node_env_open_linehaul_time,node_env_backhaul_linehaul_time,node_env_open_combined_time toneAmber
class node_single_policy,node_mtl_policy,node_moe_policy,node_mixed_policies,node_slot_policy,node_slot_diffusion,node_slot_moe_diffusion toneMint
class node_lkh toneRose
class node_moe_layer,node_manifolds,node_stereo_networks,node_user toneIndigo
```

## Components

### Training and evaluation

- [Training entry](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/train.py): `train.py`
- [Training loop](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/Trainer.py): `Trainer.py`
- [Evaluation loop](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/Tester.py): `Tester.py`
- [Instance generation](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/generate_data.py): `generate_data.py`
- [Runtime utilities](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/utils.py): `utils.py`
- **Benchmark datasets**

### Routing environments

- [Core VRP variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/CVRPEnv.py): `envs/CVRPEnv.py`
- [Open-route variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPEnv.py): `envs/OVRPEnv.py`
- [Backhaul variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBEnv.py): `envs/VRPBEnv.py`
- [Linehaul variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPLEnv.py): `envs/VRPLEnv.py`
- [Time-window variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPTWEnv.py): `envs/VRPTWEnv.py`
- [Open time windows](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPTWEnv.py): `envs/OVRPTWEnv.py`
- [Open backhaul variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBEnv.py): `envs/OVRPBEnv.py`
- [Open linehaul variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPLEnv.py): `envs/OVRPLEnv.py`
- [Backhaul-linehaul variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBLEnv.py): `envs/VRPBLEnv.py`
- [Backhaul time windows](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBTWEnv.py): `envs/VRPBTWEnv.py`
- [Linehaul time windows](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPLTWEnv.py): `envs/VRPLTWEnv.py`
- [Open combined variants](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBLEnv.py): `envs/OVRPBLEnv.py`
- [Open backhaul windows](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBTWEnv.py): `envs/OVRPBTWEnv.py`
- [Open linehaul windows](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPLTWEnv.py): `envs/OVRPLTWEnv.py`
- [Combined time windows](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/VRPBLTWEnv.py): `envs/VRPBLTWEnv.py`
- [Open combined windows](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/envs/OVRPBLTWEnv.py): `envs/OVRPBLTWEnv.py`

### Policy models

- [Single-task policy](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SINGLEModel.py): `models/SINGLEModel.py`
- [Multi-task policy](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MTLModel.py): `models/MTLModel.py`
- [MoE policy](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MOEModel.py): `models/MOEModel.py`
- [Mixed policies](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MTLModel_Mixed.py): `models/MTLModel_Mixed.py`
- [Slot policy](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SlotModel.py): `models/SlotModel.py`
- [Slot diffusion policy](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SlotDiffModel.py): `models/SlotDiffModel.py`
- [Slot diffusion MoE](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/SlotDiffMOEModel.py): `models/SlotDiffMOEModel.py`

### Optimization baselines

- [LKH baseline](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/baselines/LKH_baseline.py): `baselines/LKH_baseline.py`

### Model internals

- [Expert routing layer](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/MOELayer.py): `models/MOELayer.py`
- [Manifold operations](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/manifolds.py): `models/manifolds.py`
- [Stereographic networks](https://github.com/showmaker2021/mtl_diffu_guide/blob/main/models/networks.py): `models/networks.py`

### Other components

- **Researcher**

## Connections

- Researcher → Training entry: starts training
- Researcher → Evaluation loop: starts evaluation
- Researcher → LKH baseline: runs baseline
- Training entry → Training loop: invokes (evidence: `train.py`)
- Training entry → Runtime utilities: uses (evidence: `train.py`)
- Training loop → Runtime utilities: uses (evidence: `Trainer.py`)
- Evaluation loop → Runtime utilities: selects environment (evidence: `Tester.py`)
- Evaluation loop → Benchmark datasets: loads instances (evidence: `Tester.py`)
- Instance generation → Runtime utilities: saves datasets (evidence: `generate_data.py`)
- Runtime utilities → Core VRP variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Open-route variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Backhaul variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Linehaul variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Time-window variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Open time windows: maps problem (evidence: `utils.py`)
- Runtime utilities → Open backhaul variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Open linehaul variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Backhaul-linehaul variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Backhaul time windows: maps problem (evidence: `utils.py`)
- Runtime utilities → Linehaul time windows: maps problem (evidence: `utils.py`)
- Runtime utilities → Open combined variants: maps problem (evidence: `utils.py`)
- Runtime utilities → Open backhaul windows: maps problem (evidence: `utils.py`)
- Runtime utilities → Open linehaul windows: maps problem (evidence: `utils.py`)
- Runtime utilities → Combined time windows: maps problem (evidence: `utils.py`)
- Runtime utilities → Open combined windows: maps problem (evidence: `utils.py`)
- Training loop → Single-task policy: dispatches model
- Training loop → Multi-task policy: dispatches model
- Training loop → MoE policy: dispatches model
- Training loop → Mixed policies: dispatches model
- Training loop → Slot policy: dispatches model
- Training loop → Slot diffusion policy: dispatches model
- Training loop → Slot diffusion MoE: dispatches model
- MoE policy → Expert routing layer: uses experts (evidence: `models/MOEModel.py`)
- Slot diffusion MoE → Expert routing layer: uses experts (evidence: `models/SlotDiffMOEModel.py`)
- Mixed policies → Manifold operations: uses geometry (evidence: `models/MTLModel_Mixed.py`)
- Mixed policies → Stereographic networks: uses networks (evidence: `models/MTLModel_Mixed.py`)
- LKH baseline → Benchmark datasets: reads instances
