# 0nyr/tdvrptw-solver architecture

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

- Interactive diagram: https://gitdiagram.com/0nyr/tdvrptw-solver
- Repository: https://github.com/0nyr/tdvrptw-solver

## Overview

TDVRPTW-solver is a research vehicle-routing optimizer, with a Python experiment runner around its C++ solver. The principal workflow is to select experiment instances, load a time-dependent routing instance, preprocess it, and solve it using branch-price-and-cut with labeling-based pricing; heuristic solutions are also supported. The runner records experiment results, and the repository includes a route-validity checker. The graph preserves documented capabilities and source-index-supported relationships; unsampled implementation details are not treated as inspected evidence.

Main entry points: [`code/main/src/main_bp_duration.cpp`](https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/main_bp_duration.cpp) (Solver entry), [`runner/src/main.py`](https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/main.py) (Runner entry), [`runner/src/running/experiment.py`](https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/running/experiment.py) (Experiment execution), [`code/main/src/bcp/bcp.cpp`](https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/bcp/bcp.cpp) (Branch-price-and-cut)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiment["Experiment workflow"]
  node_runner_main["Runner entry<br/>[main.py]"]
  node_instance_selection["Instance selection<br/>[experiment.py]"]
  node_instance_loading["Instance loading<br/>[load.py]"]
  node_execution["Experiment execution<br/>[experiment.py]"]
  node_result_output["Result output<br/>[json_output.py]"]
  node_checker["Route checker<br/>[checker.py]"]
end

subgraph group_solver["Routing solver"]
  node_solver_entry["Solver entry"]
  node_preprocessing["Instance preprocessing"]
  node_branch_price_cut["Branch-price-and-cut<br/>[bcp.cpp]"]
  node_pricing["Pricing problem"]
  node_labeling["Labeling algorithms"]
  node_heuristics["Route heuristics"]
end

subgraph group_domain["Routing domain"]
  node_vrp_instance["VRP instance<br/>[instance.cpp]"]
  node_routes["Routes and solutions<br/>[route.cpp]"]
  node_objectives["Solution objectives<br/>[objectives.cpp]"]
  node_time_model["Time-dependent costs<br/>[ndcpwlf.cpp]"]
end

subgraph group_foundation["Optimization foundation"]
  node_pwl_functions["Piecewise-linear functions<br/>[pwl_function.cpp]"]
  node_lp_solver["LP solver interface<br/>[cplex_solver.cpp]"]
  node_enum_reflection["Enum reflection<br/>[magic_enum.hpp]"]
end

node_researcher(("Experiment user"))

node_researcher -->|"runs experiments"| node_runner_main
node_runner_main -->|"loads runs"| node_instance_selection
node_instance_selection -->|"selects instances"| node_instance_loading
node_instance_loading -->|"loads instance"| node_vrp_instance
node_runner_main -->|"runs experiment"| node_execution
node_execution -.->|"invokes solver"| node_solver_entry
node_execution -.->|"records results"| node_result_output
node_researcher -->|"validates routes"| node_checker
node_solver_entry -->|"preprocesses instance"| node_preprocessing
node_solver_entry -->|"runs labeling"| node_labeling
node_solver_entry -->|"initializes solutions"| node_heuristics
node_solver_entry -.->|"solves problem"| node_branch_price_cut
node_branch_price_cut -.->|"solves pricing"| node_pricing
node_pricing -->|"generates routes"| node_labeling
node_labeling -->|"uses instance"| node_vrp_instance
node_vrp_instance -.->|"uses travel costs"| node_time_model
node_routes -.->|"evaluates solutions"| node_objectives
node_time_model -.->|"uses functions"| node_pwl_functions
node_branch_price_cut -.->|"solves relaxations"| node_lp_solver

click node_runner_main "https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/main.py"
click node_instance_selection "https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/running/experiment.py"
click node_instance_loading "https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/loading/load.py"
click node_execution "https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/running/experiment.py"
click node_result_output "https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/output/json_output.py"
click node_checker "https://github.com/0nyr/tdvrptw-solver/blob/master/checker/checker.py"
click node_solver_entry "https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/main_bp_duration.cpp"
click node_preprocessing "https://github.com/0nyr/tdvrptw-solver/tree/master/code/main/src/preprocess"
click node_branch_price_cut "https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/bcp/bcp.cpp"
click node_pricing "https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/bcp/pricing_problem.cpp"
click node_labeling "https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/labeling/monodirectional_labeling.cpp"
click node_heuristics "https://github.com/0nyr/tdvrptw-solver/tree/master/code/main/src/heuristics"
click node_vrp_instance "https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/vrp/instance.cpp"
click node_routes "https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/solutions/route.cpp"
click node_objectives "https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/solutions/objectives.cpp"
click node_time_model "https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/math/ndcpwlf.cpp"
click node_pwl_functions "https://github.com/0nyr/tdvrptw-solver/blob/master/code/goc/src/math/pwl_function.cpp"
click node_lp_solver "https://github.com/0nyr/tdvrptw-solver/blob/master/code/goc/src/linear_programming/cplex/cplex_solver.cpp"
click node_enum_reflection "https://github.com/0nyr/tdvrptw-solver/blob/master/code/magic_enum/include/magic_enum/magic_enum.hpp"

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_runner_main,node_instance_selection,node_instance_loading,node_execution,node_result_output,node_checker,node_researcher toneBlue
class node_solver_entry,node_preprocessing,node_branch_price_cut,node_pricing,node_labeling,node_heuristics toneAmber
class node_vrp_instance,node_routes,node_objectives,node_time_model toneMint
class node_pwl_functions,node_lp_solver,node_enum_reflection toneRose
```

## Components

### Experiment workflow

- [Runner entry](https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/main.py): `runner/src/main.py`
- [Instance selection](https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/running/experiment.py): `runner/src/running/experiment.py`
- [Instance loading](https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/loading/load.py): `runner/src/loading/load.py`
- [Experiment execution](https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/running/experiment.py): `runner/src/running/experiment.py`
- [Result output](https://github.com/0nyr/tdvrptw-solver/blob/master/runner/src/output/json_output.py): `runner/src/output/json_output.py`
- [Route checker](https://github.com/0nyr/tdvrptw-solver/blob/master/checker/checker.py): `checker/checker.py`

### Routing solver

- [Solver entry](https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/main_bp_duration.cpp): `code/main/src/main_bp_duration.cpp`
- [Instance preprocessing](https://github.com/0nyr/tdvrptw-solver/tree/master/code/main/src/preprocess): `code/main/src/preprocess`
- [Branch-price-and-cut](https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/bcp/bcp.cpp): `code/main/src/bcp/bcp.cpp`
- [Pricing problem](https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/bcp/pricing_problem.cpp): `code/main/src/bcp/pricing_problem.cpp`
- [Labeling algorithms](https://github.com/0nyr/tdvrptw-solver/blob/master/code/main/src/labeling/monodirectional_labeling.cpp): `code/main/src/labeling/monodirectional_labeling.cpp`
- [Route heuristics](https://github.com/0nyr/tdvrptw-solver/tree/master/code/main/src/heuristics): `code/main/src/heuristics`

### Routing domain

- [VRP instance](https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/vrp/instance.cpp): `code/nyr/src/vrp/instance.cpp`
- [Routes and solutions](https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/solutions/route.cpp): `code/nyr/src/solutions/route.cpp`
- [Solution objectives](https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/solutions/objectives.cpp): `code/nyr/src/solutions/objectives.cpp`
- [Time-dependent costs](https://github.com/0nyr/tdvrptw-solver/blob/master/code/nyr/src/math/ndcpwlf.cpp): `code/nyr/src/math/ndcpwlf.cpp`

### Optimization foundation

- [Piecewise-linear functions](https://github.com/0nyr/tdvrptw-solver/blob/master/code/goc/src/math/pwl_function.cpp): `code/goc/src/math/pwl_function.cpp`
- [LP solver interface](https://github.com/0nyr/tdvrptw-solver/blob/master/code/goc/src/linear_programming/cplex/cplex_solver.cpp): `code/goc/src/linear_programming/cplex/cplex_solver.cpp`
- [Enum reflection](https://github.com/0nyr/tdvrptw-solver/blob/master/code/magic_enum/include/magic_enum/magic_enum.hpp): `code/magic_enum/include/magic_enum/magic_enum.hpp`

### Other components

- **Experiment user**

## Connections

- Experiment user → Runner entry: runs experiments (evidence: `README.md`)
- Runner entry → Instance selection: loads runs (evidence: `runner/src/main.py`)
- Instance selection → Instance loading: selects instances (evidence: `runner/src/loading/load.py`)
- Instance loading → VRP instance: loads instance (evidence: `runner/src/loading/load.py`)
- Runner entry → Experiment execution: runs experiment (evidence: `README.md`)
- Experiment execution → Solver entry: invokes solver
- Experiment execution → Result output: records results
- Experiment user → Route checker: validates routes (evidence: `README.md`)
- Solver entry → Instance preprocessing: preprocesses instance (evidence: `code/main/src/main_bp_duration.cpp`)
- Solver entry → Labeling algorithms: runs labeling (evidence: `code/main/src/main_bp_duration.cpp`)
- Solver entry → Route heuristics: initializes solutions (evidence: `code/main/src/main_bp_duration.cpp`)
- Solver entry → Branch-price-and-cut: solves problem
- Branch-price-and-cut → Pricing problem: solves pricing
- Pricing problem → Labeling algorithms: generates routes
- Labeling algorithms → VRP instance: uses instance
- VRP instance → Time-dependent costs: uses travel costs
- Routes and solutions → Solution objectives: evaluates solutions
- Time-dependent costs → Piecewise-linear functions: uses functions
- Branch-price-and-cut → LP solver interface: solves relaxations
