# chaohongwu719/mtsp-practice architecture

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

- Interactive diagram: https://gitdiagram.com/chaohongwu719/mtsp-practice
- Repository: https://github.com/chaohongwu719/mtsp-practice

## Overview

This repository is a multi-vehicle routing/TSP comparison for temple locations. Its main workflow loads a symmetric distance matrix, runs exact Gurobi formulations and heuristic solvers, reports routes and costs, and can render routes on a map. The graph preserves the separate solver approaches and the cluster-then-route stages. Relationships are limited to calls shown in excerpts; the README is empty, and spreadsheet/CSV contents were not inspected.

Main entry points: [`TSP_main.py`](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_main.py) (Run comparison), [`TSP_data.py`](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_data.py) (Matrix loader), [`TSP_SA.py`](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_SA.py) (Simulated annealing), [`clusterThenRouting_v3.py`](https://github.com/chaohongwu719/mtsp-practice/blob/main/clusterThenRouting_v3.py) (Cluster routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Routing inputs"]
  node_matrix["Distance matrix"]
  node_templedata["Temple coordinates<br/>[期末分組報告_宮廟經緯度.xlsx]"]
  node_loader["Matrix loader<br/>[TSP_data.py]"]
end

subgraph group_exact["Exact solvers"]
  node_mtz["MTZ optimizer<br/>[TSP_MTZ.py]"]
  node_dfj["DFJ optimizer<br/>[TSP_DFJ.py]"]
end

subgraph group_heuristics["Heuristic solvers"]
  node_sa["Simulated annealing<br/>[TSP_SA.py]"]
  node_cluster["Cluster routes"]
end

subgraph group_results["Results and display"]
  node_main["Run comparison<br/>[TSP_main.py]"]
  node_map["Route map<br/>[draw.py]"]
  node_reports["Costs and schedules<br/>[TSP_main.py]"]
end

node_engineer(("Engineer"))

node_engineer -->|"runs"| node_main
node_main -->|"loads"| node_loader
node_loader -->|"reads"| node_matrix
node_main -->|"solves with"| node_mtz
node_main -->|"solves with"| node_dfj
node_main -->|"solves with"| node_sa
node_main -->|"solves with"| node_cluster
node_sa -->|"loads"| node_loader
node_cluster -->|"loads"| node_loader
node_main -->|"renders routes"| node_map
node_map -->|"reads coordinates"| node_templedata
node_main -->|"prints results"| node_reports

click node_matrix "https://github.com/chaohongwu719/mtsp-practice/blob/main/distance_matrix.csv"
click node_templedata "https://github.com/chaohongwu719/mtsp-practice/blob/main/%E6%9C%9F%E6%9C%AB%E5%88%86%E7%B5%84%E5%A0%B1%E5%91%8A_%E5%AE%AE%E5%BB%9F%E7%B6%93%E7%B7%AF%E5%BA%A6.xlsx"
click node_loader "https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_data.py"
click node_main "https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_main.py"
click node_mtz "https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_MTZ.py"
click node_dfj "https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_DFJ.py"
click node_sa "https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_SA.py"
click node_cluster "https://github.com/chaohongwu719/mtsp-practice/blob/main/clusterThenRouting_v3.py"
click node_map "https://github.com/chaohongwu719/mtsp-practice/blob/main/draw.py"
click node_reports "https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_main.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_matrix,node_templedata,node_loader toneBlue
class node_mtz,node_dfj toneAmber
class node_sa,node_cluster toneMint
class node_main,node_map,node_reports toneRose
class node_engineer toneIndigo
```

## Components

### Routing inputs

- [Distance matrix](https://github.com/chaohongwu719/mtsp-practice/blob/main/distance_matrix.csv): `distance_matrix.csv`
- [Temple coordinates](https://github.com/chaohongwu719/mtsp-practice/blob/main/%E6%9C%9F%E6%9C%AB%E5%88%86%E7%B5%84%E5%A0%B1%E5%91%8A_%E5%AE%AE%E5%BB%9F%E7%B6%93%E7%B7%AF%E5%BA%A6.xlsx): `期末分組報告_宮廟經緯度.xlsx`
- [Matrix loader](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_data.py): `TSP_data.py`

### Exact solvers

- [MTZ optimizer](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_MTZ.py): `TSP_MTZ.py`
- [DFJ optimizer](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_DFJ.py): `TSP_DFJ.py`

### Heuristic solvers

- [Simulated annealing](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_SA.py): `TSP_SA.py`
- [Cluster routes](https://github.com/chaohongwu719/mtsp-practice/blob/main/clusterThenRouting_v3.py): `clusterThenRouting_v3.py`

### Results and display

- [Run comparison](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_main.py): `TSP_main.py`
- [Route map](https://github.com/chaohongwu719/mtsp-practice/blob/main/draw.py): `draw.py`
- [Costs and schedules](https://github.com/chaohongwu719/mtsp-practice/blob/main/TSP_main.py): `TSP_main.py`

### Other components

- **Engineer**

## Connections

- Engineer → Run comparison: runs (evidence: `TSP_main.py`)
- Run comparison → Matrix loader: loads (evidence: `TSP_main.py`)
- Matrix loader → Distance matrix: reads
- Run comparison → MTZ optimizer: solves with (evidence: `TSP_main.py`)
- Run comparison → DFJ optimizer: solves with (evidence: `TSP_main.py`)
- Run comparison → Simulated annealing: solves with (evidence: `TSP_main.py`)
- Run comparison → Cluster routes: solves with (evidence: `TSP_main.py`)
- Simulated annealing → Matrix loader: loads (evidence: `TSP_SA.py`)
- Cluster routes → Matrix loader: loads (evidence: `clusterThenRouting_v3.py`)
- Run comparison → Route map: renders routes (evidence: `TSP_main.py`)
- Route map → Temple coordinates: reads coordinates (evidence: `draw.py`)
- Run comparison → Costs and schedules: prints results (evidence: `TSP_main.py`)
