# adzen/vrptw architecture

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

- Interactive diagram: https://gitdiagram.com/adzen/vrptw
- Repository: https://github.com/adzen/vrptw

## Overview

##### Project type and purpose
- This is a single‐process C++ command‐line application (“VRPTW”) for solving Vehicle Routing Problems with Time Windows, using benchmark data sets (Solomon’s and Gehring & Homberger’s).
- It reads text files, builds in‐memory problem representations, runs an evolutionary (or heuristic) algorithm, and writes/validates solutions.

##### File structure
- Top‐level: VRPTW.sln / .vcxproj files (Visual Studio solution).
- Core source files:
- main.cpp – entry point, CLI orchestration
- customer.{cpp,h}, problem.{cpp,h} – domain model for customers & problem instance
- route.{cpp,h}, solution.{cpp,h} – representation of a candidate solution (routes)
- evolution.{cpp,h} – algorithm engine (e.g., genetic operators, fitness evaluation)
- utility modules under problems/ (import.cpp, runner.cpp, checkInput.cpp, checkSol.cpp, transform.cpp, sumOfTimeWindow.cpp) – data import, input validation, output checking, and transformations.
- Data folder: problems/ – contains all benchmark text files used as input, plus support tools.

##### README for additional insights
- Confirms the input format, lists the benchmark sources, and clarifies that the goal is to minimize fleet size and travel distance under capacity/time constraints.

##### Elements
- Rectangles for modules (parsers, domain, algorithm)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Persistence Layer
    subgraph "Persistence Layer"
        InputDataStore[(Input Data Store\nproblems/)] 
    end

    %% Application/Orchestration Layer
    subgraph "Application Layer"
        Parser[Input Parser & Validator\nimport.cpp, checkInput.cpp]:::application
        Orchestrator((Execution Orchestrator\nmain.cpp, runner.cpp)):::orchestrator
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Domain[Domain Model Layer\ncustomer.cpp/h, problem.cpp/h]:::domain
    end

    %% Algorithm Layer
    subgraph "Algorithm Layer"
        Algorithm[Algorithm Engine\nevolution.cpp/h]:::algorithm
    end

    %% Solution Layer
    subgraph "Solution Model Layer"
        SolutionModel[Solution Model Layer\nroute.cpp/h, solution.cpp/h]:::solution
    end

    %% Output Layer
    subgraph "Output & Validation"
        Output[Output & Validation\ncheckSol.cpp]:::output
    end

    %% Data Flows
    InputDataStore -->|reads text| Parser
    Parser -->|populates| Domain
    Domain -->|provides data| Algorithm
    Algorithm -->|generates & evaluates| SolutionModel
    Algorithm -->|returns best| Orchestrator
    Orchestrator -->|writes result| Output
    Orchestrator -->|invokes check| Output

    %% Click Events
    click InputDataStore "https://github.com/adzen/vrptw/tree/master/problems/"
    click Parser "https://github.com/adzen/vrptw/blob/master/problems/import.cpp"
    click Parser "https://github.com/adzen/vrptw/blob/master/problems/checkInput.cpp"
    click Domain "https://github.com/adzen/vrptw/blob/master/customer.cpp"
    click Domain "https://github.com/adzen/vrptw/blob/master/customer.h"
    click Domain "https://github.com/adzen/vrptw/blob/master/problem.cpp"
    click Domain "https://github.com/adzen/vrptw/blob/master/problem.h"
    click Algorithm "https://github.com/adzen/vrptw/blob/master/evolution.cpp"
    click Algorithm "https://github.com/adzen/vrptw/blob/master/evolution.h"
    click SolutionModel "https://github.com/adzen/vrptw/blob/master/route.cpp"
    click SolutionModel "https://github.com/adzen/vrptw/blob/master/route.h"
    click SolutionModel "https://github.com/adzen/vrptw/blob/master/solution.cpp"
    click SolutionModel "https://github.com/adzen/vrptw/blob/master/solution.h"
    click Orchestrator "https://github.com/adzen/vrptw/blob/master/main.cpp"
    click Orchestrator "https://github.com/adzen/vrptw/blob/master/problems/runner.cpp"
    click Output "https://github.com/adzen/vrptw/blob/master/problems/checkSol.cpp"

    %% Styles
    classDef persistence fill:#f9f,stroke:#333,stroke-width:2px
    classDef application fill:#bbf,stroke:#333,stroke-width:2px
    classDef domain fill:#bfb,stroke:#333,stroke-width:2px
    classDef algorithm fill:#fbf,stroke:#333,stroke-width:2px
    classDef solution fill:#ffb,stroke:#333,stroke-width:2px
    classDef orchestrator fill:#fbb,stroke:#333,stroke-width:2px
    classDef output fill:#ff9,stroke:#333,stroke-width:2px
    class InputDataStore persistence
```
