# sumitjotrao/travelling_salesman_problem architecture

> Architecture diagram of the GitHub repository sumitjotrao/travelling_salesman_problem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sumitjotrao/travelling_salesman_problem
- Repository: https://github.com/sumitjotrao/travelling_salesman_problem

## Overview

##### Project type and purpose
- This is a standalone Python-based Travelling Salesman Problem (TSP) solver library/application.
- Purpose: load benchmark TSP instances, pre-process them, then solve via exact (integer programming) and approximate (heuristic) algorithms.

##### File structure
- Root scripts
– TSP.py       → main entrypoint/CLI wrapper
– data_processing.py → routines to parse/clean raw instance files
- algorithms/
– Integer_programming_model.py → exact solver using MIP
– (you would likely add other modules here for heuristics)
- data/
– dozens of “tsp_<n>_<id>” files → raw instance datasets from Coursera discrete optimization course
- .gitignore, README.md

##### README for additional insights
- Confirms two solver categories: exact and approximate.
- Problem instances sourced externally (data directory).

##### Detailed capture of essential elements
- Don’t omit the Data Processing step—raw files must be parsed.
- Explicitly show external solver dependency separate from your code.
- Your main script (TSP.py) as orchestrator, not just a passive wrapper.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main CLI
    CLI["User Interface / CLI\n(TSP.py)"]:::processing

    %% Data Layer
    subgraph "Data Layer"
        DS["Raw Instance Store\n(data/*.tsp)"]:::data
        DP["Data Processing Module\n(data_processing.py)"]:::processing
    end

    %% Solver Layer
    subgraph "Solver Layer"
        ES["Exact Solver Module\n(algorithms/Integer_programming_model.py)"]:::processing
        subgraph "Approximate Solvers" 
            AS1["Heuristic Solver Placeholder\n(algorithms/)"]:::processing
        end
    end

    %% External Services
    MIP["MIP Solver Engine\n(Gurobi/CBC/CPLEX)"]:::external

    %% Data Flow
    CLI -->|"invokes"| DP
    DP -->|"raw instance file"| DS
    DS -->|"reads instance"| DP
    DP -->|"parsed graph"| ES
    DP -->|"parsed graph"| AS1
    ES -->|"MIP model"| MIP
    MIP -->|"tour & cost"| ES
    AS1 -->|"tour & cost"| CLI
    ES -->|"tour & cost"| CLI
    CLI -->|"format & output"| CLI

    %% Click Events
    click CLI "https://github.com/sumitjotrao/travelling_salesman_problem/blob/main/TSP.py"
    click DP "https://github.com/sumitjotrao/travelling_salesman_problem/blob/main/data_processing.py"
    click DS "https://github.com/sumitjotrao/travelling_salesman_problem/tree/main/data/"
    click ES "https://github.com/sumitjotrao/travelling_salesman_problem/blob/main/algorithms/Integer_programming_model.py"
    click AS1 "https://github.com/sumitjotrao/travelling_salesman_problem/tree/main/algorithms/"

    %% Styles
    classDef data fill:#cce5ff,stroke:#009,stroke-width:1px
    classDef processing fill:#d4edda,stroke:#080,stroke-width:1px
    classDef external fill:#ffe5b4,stroke:#f60,stroke-width:1px
    class CLI,ES,DP,AS1 processing
    class DS data
    class MIP external
```
