# google/or-tools architecture

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

- Interactive diagram: https://gitdiagram.com/google/or-tools
- Repository: https://github.com/google/or-tools

## Overview

OR-Tools is a C++ optimization suite with Python, C# and Java wrappers. Users formulate combinatorial, constraint, routing, or mathematical-programming problems and invoke an appropriate solver to obtain solutions; the README documents these capabilities but not one universal execution path. The graph separates modeling, solver families, and shared algorithms/data. Some internal links are dashed because the sampled evidence does not establish their runtime call paths.

Main entry points: [`ortools/linear_solver/linear_solver.cc`](https://github.com/google/or-tools/blob/stable/ortools/linear_solver/linear_solver.cc) (Linear Solver API), [`ortools/java/com/google/ortools`](https://github.com/google/or-tools/tree/stable/ortools/java/com/google/ortools) (Language wrappers), [`ortools/constraint_solver/constraint_solver.cc`](https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/constraint_solver.cc) (CP Solver API), [`ortools/constraint_solver/routing_search.cc`](https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/routing_search.cc) (Routing search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_modeling["Modeling and APIs"]
  node_wrappers["Language wrappers"]
  node_mathopt_api["MathOpt API"]
  node_linear_api["Linear Solver API<br/>[linear_solver.cc]"]
  node_cp_api["CP Solver API"]
  node_mathopt_storage[("MathOpt model storage<br/>[model_storage.h]")]
  node_flatzinc["FlatZinc frontend<br/>[parser.cc]"]
end

subgraph group_constraint["Constraint solvers"]
  node_cp["Constraint programming"]
  node_cpsat["CP-SAT"]
  node_routing["Routing search<br/>[routing_search.cc]"]
  node_bop["Boolean optimization"]
end

subgraph group_mathprog["Mathematical programming"]
  node_mathopt_solver["MathOpt solver<br/>[solver.cc]"]
  node_linear_solver["Solver interfaces<br/>[linear_solver.cc]"]
  node_glop["Glop simplex<br/>[lp_solver.cc]"]
  node_pdlp["PDLP solver"]
  node_lp_data["LP model data<br/>[lp_data.cc]"]
end

subgraph group_algorithms["Algorithms and data"]
  node_graph["Graph algorithms"]
  node_algorithms["Combinatorial algorithms"]
end

subgraph group_shared["Shared foundations"]
  node_base["Base utilities"]
end

node_user(("Problem author"))

node_user -.->|"uses"| node_wrappers
node_user -.->|"models with"| node_mathopt_api
node_user -.->|"models with"| node_linear_api
node_user -.->|"models with"| node_cp_api
node_wrappers -.->|"exposes"| node_mathopt_api
node_wrappers -.->|"exposes"| node_linear_api
node_wrappers -.->|"exposes"| node_cp_api
node_mathopt_api -.->|"stores model"| node_mathopt_storage
node_mathopt_solver -.->|"solves model"| node_mathopt_storage
node_linear_api -.->|"uses model data"| node_lp_data
node_linear_api -.->|"dispatches to"| node_glop
node_linear_api -.->|"dispatches to"| node_pdlp
node_linear_api -.->|"dispatches to"| node_bop
node_linear_api -.->|"dispatches to"| node_cpsat
node_cp_api -.->|"uses"| node_cp
node_cp_api -.->|"uses"| node_routing
node_routing -->|"uses solver"| node_cp
node_routing -->|"uses Christofides"| node_graph
node_flatzinc -.->|"supports solving"| node_cpsat
node_bop -.->|"based on"| node_cpsat

click node_wrappers "https://github.com/google/or-tools/tree/stable/ortools/java/com/google/ortools"
click node_mathopt_api "https://github.com/google/or-tools/tree/stable/ortools/math_opt/cpp"
click node_linear_api "https://github.com/google/or-tools/blob/stable/ortools/linear_solver/linear_solver.cc"
click node_cp_api "https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/constraint_solver.cc"
click node_mathopt_storage "https://github.com/google/or-tools/blob/stable/ortools/math_opt/storage/model_storage.h"
click node_cp "https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/constraint_solver.cc"
click node_cpsat "https://github.com/google/or-tools/tree/stable/ortools/sat"
click node_routing "https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/routing_search.cc"
click node_bop "https://github.com/google/or-tools/tree/stable/ortools/bop"
click node_mathopt_solver "https://github.com/google/or-tools/blob/stable/ortools/math_opt/core/solver.cc"
click node_linear_solver "https://github.com/google/or-tools/blob/stable/ortools/linear_solver/linear_solver.cc"
click node_glop "https://github.com/google/or-tools/blob/stable/ortools/glop/lp_solver.cc"
click node_pdlp "https://github.com/google/or-tools/blob/stable/ortools/pdlp/primal_dual_hybrid_gradient.cc"
click node_lp_data "https://github.com/google/or-tools/blob/stable/ortools/lp_data/lp_data.cc"
click node_graph "https://github.com/google/or-tools/tree/stable/ortools/graph"
click node_algorithms "https://github.com/google/or-tools/tree/stable/ortools/algorithms"
click node_flatzinc "https://github.com/google/or-tools/blob/stable/ortools/flatzinc/parser.cc"
click node_base "https://github.com/google/or-tools/tree/stable/ortools/base"

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_wrappers,node_mathopt_api,node_linear_api,node_cp_api,node_mathopt_storage,node_flatzinc toneBlue
class node_cp,node_cpsat,node_routing,node_bop toneAmber
class node_mathopt_solver,node_linear_solver,node_glop,node_pdlp,node_lp_data toneMint
class node_graph,node_algorithms toneRose
class node_base,node_user toneIndigo
```

## Components

### Modeling and APIs

- [Language wrappers](https://github.com/google/or-tools/tree/stable/ortools/java/com/google/ortools): `ortools/java/com/google/ortools`
- [MathOpt API](https://github.com/google/or-tools/tree/stable/ortools/math_opt/cpp): `ortools/math_opt/cpp`
- [Linear Solver API](https://github.com/google/or-tools/blob/stable/ortools/linear_solver/linear_solver.cc): `ortools/linear_solver/linear_solver.cc`
- [CP Solver API](https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/constraint_solver.cc): `ortools/constraint_solver/constraint_solver.cc`
- [MathOpt model storage](https://github.com/google/or-tools/blob/stable/ortools/math_opt/storage/model_storage.h): `ortools/math_opt/storage/model_storage.h`
- [FlatZinc frontend](https://github.com/google/or-tools/blob/stable/ortools/flatzinc/parser.cc): `ortools/flatzinc/parser.cc`

### Constraint solvers

- [Constraint programming](https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/constraint_solver.cc): `ortools/constraint_solver/constraint_solver.cc`
- [CP-SAT](https://github.com/google/or-tools/tree/stable/ortools/sat): `ortools/sat`
- [Routing search](https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/routing_search.cc): `ortools/constraint_solver/routing_search.cc`
- [Boolean optimization](https://github.com/google/or-tools/tree/stable/ortools/bop): `ortools/bop`

### Mathematical programming

- [MathOpt solver](https://github.com/google/or-tools/blob/stable/ortools/math_opt/core/solver.cc): `ortools/math_opt/core/solver.cc`
- [Solver interfaces](https://github.com/google/or-tools/blob/stable/ortools/linear_solver/linear_solver.cc): `ortools/linear_solver/linear_solver.cc`
- [Glop simplex](https://github.com/google/or-tools/blob/stable/ortools/glop/lp_solver.cc): `ortools/glop/lp_solver.cc`
- [PDLP solver](https://github.com/google/or-tools/blob/stable/ortools/pdlp/primal_dual_hybrid_gradient.cc): `ortools/pdlp/primal_dual_hybrid_gradient.cc`
- [LP model data](https://github.com/google/or-tools/blob/stable/ortools/lp_data/lp_data.cc): `ortools/lp_data/lp_data.cc`

### Algorithms and data

- [Graph algorithms](https://github.com/google/or-tools/tree/stable/ortools/graph): `ortools/graph`
- [Combinatorial algorithms](https://github.com/google/or-tools/tree/stable/ortools/algorithms): `ortools/algorithms`

### Shared foundations

- [Base utilities](https://github.com/google/or-tools/tree/stable/ortools/base): `ortools/base`

### Other components

- **Problem author**

## Connections

- Problem author → Language wrappers: uses (evidence: `README.md`)
- Problem author → MathOpt API: models with
- Problem author → Linear Solver API: models with (evidence: `README.md`)
- Problem author → CP Solver API: models with (evidence: `README.md`)
- Language wrappers → MathOpt API: exposes (evidence: `README.md`)
- Language wrappers → Linear Solver API: exposes (evidence: `README.md`)
- Language wrappers → CP Solver API: exposes (evidence: `README.md`)
- MathOpt API → MathOpt model storage: stores model
- MathOpt solver → MathOpt model storage: solves model
- Linear Solver API → LP model data: uses model data
- Linear Solver API → Glop simplex: dispatches to (evidence: `README.md`)
- Linear Solver API → PDLP solver: dispatches to (evidence: `README.md`)
- Linear Solver API → Boolean optimization: dispatches to (evidence: `README.md`)
- Linear Solver API → CP-SAT: dispatches to (evidence: `README.md`)
- CP Solver API → Constraint programming: uses (evidence: `README.md`)
- CP Solver API → Routing search: uses (evidence: `README.md`)
- Routing search → Constraint programming: uses solver (evidence: `ortools/constraint_solver/routing_search.cc`)
- Routing search → Graph algorithms: uses Christofides (evidence: `ortools/constraint_solver/routing_search.cc`)
- FlatZinc frontend → CP-SAT: supports solving
- Boolean optimization → CP-SAT: based on (evidence: `README.md`)
