# coin-or/cylp architecture

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

- Interactive diagram: https://gitdiagram.com/coin-or/cylp
- Repository: https://github.com/coin-or/cylp

## Overview

CyLP is a Python interface to CLP, CBC, and CGL, letting users build or read optimization problems and control solver behavior from Python. The main workflow is model or MPS input, then simplex solving and a solution; customization includes Python pivot rules and, for MIP, cuts and branch-and-bound strategies. QP support and sparse-matrix utilities are separate capabilities. The graph uses README statements and the supplied source index/excerpts for relationships; unsampled implementation details are shown only where the repository tree supports a component, without asserting unverified calls.

Main entry points: [`cylp/py/QP/QP.py`](https://github.com/coin-or/cylp/blob/master/cylp/py/QP/QP.py) (Quadratic programs), [`cylp/cy/__init__.py`](https://github.com/coin-or/cylp/blob/master/cylp/cy/__init__.py) (Python solver API), [`cylp/cpp/IClpSimplex.cpp`](https://github.com/coin-or/cylp/blob/master/cylp/cpp/IClpSimplex.cpp) (CLP binding), [`cylp/py/PySolve.py`](https://github.com/coin-or/cylp/blob/master/cylp/py/PySolve.py) (MPS solve entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_modeling["Modeling and input"]
  node_model["LP modeling<br/>[CyLPModel.py]"]
  node_mps_reader["MPS reader<br/>[ICoinMpsIO.cpp]"]
  node_sparse["Sparse utilities<br/>[sparseUtil.py]"]
end

subgraph group_solver["Solver core"]
  node_python_api["Python solver API<br/>[__init__.py]"]
  node_clp_binding["CLP binding<br/>[IClpSimplex.cpp]"]
  node_simplex["Simplex engine"]
  node_wolfe_simplex["Wolfe simplex"]
  node_solve_example["MPS solve entry<br/>[PySolve.py]"]
end

subgraph group_custom["Solver customization"]
  node_pivot_base["Pivot interface<br/>[PivotPythonBase.py]"]
  node_pivot_rules["Pivot strategies<br/>[DantzigPivot.py]"]
  node_pe_pivot["Wolfe positive edge<br/>[WolfePivotPE.py]"]
end

subgraph group_extensions["Optimization extensions"]
  node_cbc["CBC MIP model<br/>[ICbcModel.cpp]"]
  node_cut_generators["MIP cut generators"]
  node_node_strategy["Node comparison<br/>[NodeCompareBase.py]"]
  node_qp["Quadratic programs<br/>[QP.py]"]
  node_qps_reader["QPS reader<br/>[QPSReader.py]"]
end

node_user(("Python user"))
node_mps["MPS file"]

node_user -->|"defines model"| node_model
node_user -->|"provides input"| node_mps
node_mps -->|"loads MPS"| node_solve_example
node_model -->|"models for"| node_python_api
node_solve_example -->|"creates solver"| node_python_api
node_python_api -.->|"wraps solver"| node_clp_binding
node_mps_reader -.->|"loads problem"| node_clp_binding
node_clp_binding -->|"runs primal"| node_simplex
node_simplex -.->|"supports variant"| node_wolfe_simplex
node_solve_example -->|"selects strategy"| node_pivot_rules
node_pivot_rules -->|"implements interface"| node_pivot_base
node_pivot_base -.->|"accesses model"| node_clp_binding
node_pe_pivot -->|"implements interface"| node_pivot_base
node_user -.->|"defines QP"| node_qp
node_qp -->|"reads QPS"| node_qps_reader
node_qp -->|"uses matrices"| node_sparse
node_qp -.->|"solves through"| node_python_api
node_cbc -.->|"accepts cuts"| node_cut_generators
node_cbc -.->|"uses strategy"| node_node_strategy

click node_model "https://github.com/coin-or/cylp/blob/master/cylp/py/modeling/CyLPModel.py"
click node_mps_reader "https://github.com/coin-or/cylp/blob/master/cylp/cpp/ICoinMpsIO.cpp"
click node_python_api "https://github.com/coin-or/cylp/blob/master/cylp/cy/__init__.py"
click node_clp_binding "https://github.com/coin-or/cylp/blob/master/cylp/cpp/IClpSimplex.cpp"
click node_simplex "https://github.com/coin-or/cylp/blob/master/cylp/cpp/IClpSimplexPrimal.cpp"
click node_wolfe_simplex "https://github.com/coin-or/cylp/blob/master/cylp/cpp/IClpSimplexPrimal_Wolfe.cpp"
click node_solve_example "https://github.com/coin-or/cylp/blob/master/cylp/py/PySolve.py"
click node_pivot_base "https://github.com/coin-or/cylp/blob/master/cylp/py/pivots/PivotPythonBase.py"
click node_pivot_rules "https://github.com/coin-or/cylp/blob/master/cylp/py/pivots/DantzigPivot.py"
click node_pe_pivot "https://github.com/coin-or/cylp/blob/master/cylp/py/pivots/WolfePivotPE.py"
click node_cbc "https://github.com/coin-or/cylp/blob/master/cylp/cpp/ICbcModel.cpp"
click node_cut_generators "https://github.com/coin-or/cylp/blob/master/cylp/py/mip/GomoryCutGenerator.py"
click node_node_strategy "https://github.com/coin-or/cylp/blob/master/cylp/py/mip/NodeCompareBase.py"
click node_qp "https://github.com/coin-or/cylp/blob/master/cylp/py/QP/QP.py"
click node_qps_reader "https://github.com/coin-or/cylp/blob/master/cylp/py/QP/QPSReader.py"
click node_sparse "https://github.com/coin-or/cylp/blob/master/cylp/py/utils/sparseUtil.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_model,node_mps_reader,node_sparse,node_user toneBlue
class node_python_api,node_clp_binding,node_simplex,node_wolfe_simplex,node_solve_example toneAmber
class node_pivot_base,node_pivot_rules,node_pe_pivot toneMint
class node_cbc,node_cut_generators,node_node_strategy,node_qp,node_qps_reader toneRose
class node_mps toneIndigo
```

## Components

### Modeling and input

- [LP modeling](https://github.com/coin-or/cylp/blob/master/cylp/py/modeling/CyLPModel.py): `cylp/py/modeling/CyLPModel.py`
- [MPS reader](https://github.com/coin-or/cylp/blob/master/cylp/cpp/ICoinMpsIO.cpp): `cylp/cpp/ICoinMpsIO.cpp`
- [Sparse utilities](https://github.com/coin-or/cylp/blob/master/cylp/py/utils/sparseUtil.py): `cylp/py/utils/sparseUtil.py`

### Solver core

- [Python solver API](https://github.com/coin-or/cylp/blob/master/cylp/cy/__init__.py): `cylp/cy/__init__.py`
- [CLP binding](https://github.com/coin-or/cylp/blob/master/cylp/cpp/IClpSimplex.cpp): `cylp/cpp/IClpSimplex.cpp`
- [Simplex engine](https://github.com/coin-or/cylp/blob/master/cylp/cpp/IClpSimplexPrimal.cpp): `cylp/cpp/IClpSimplexPrimal.cpp`
- [Wolfe simplex](https://github.com/coin-or/cylp/blob/master/cylp/cpp/IClpSimplexPrimal_Wolfe.cpp): `cylp/cpp/IClpSimplexPrimal_Wolfe.cpp`
- [MPS solve entry](https://github.com/coin-or/cylp/blob/master/cylp/py/PySolve.py): `cylp/py/PySolve.py`

### Solver customization

- [Pivot interface](https://github.com/coin-or/cylp/blob/master/cylp/py/pivots/PivotPythonBase.py): `cylp/py/pivots/PivotPythonBase.py`
- [Pivot strategies](https://github.com/coin-or/cylp/blob/master/cylp/py/pivots/DantzigPivot.py): `cylp/py/pivots/DantzigPivot.py`
- [Wolfe positive edge](https://github.com/coin-or/cylp/blob/master/cylp/py/pivots/WolfePivotPE.py): `cylp/py/pivots/WolfePivotPE.py`

### Optimization extensions

- [CBC MIP model](https://github.com/coin-or/cylp/blob/master/cylp/cpp/ICbcModel.cpp): `cylp/cpp/ICbcModel.cpp`
- [MIP cut generators](https://github.com/coin-or/cylp/blob/master/cylp/py/mip/GomoryCutGenerator.py): `cylp/py/mip/GomoryCutGenerator.py`
- [Node comparison](https://github.com/coin-or/cylp/blob/master/cylp/py/mip/NodeCompareBase.py): `cylp/py/mip/NodeCompareBase.py`
- [Quadratic programs](https://github.com/coin-or/cylp/blob/master/cylp/py/QP/QP.py): `cylp/py/QP/QP.py`
- [QPS reader](https://github.com/coin-or/cylp/blob/master/cylp/py/QP/QPSReader.py): `cylp/py/QP/QPSReader.py`

### Other components

- **Python user**
- **MPS file**

## Connections

- Python user → LP modeling: defines model (evidence: `README.rst`)
- Python user → MPS file: provides input (evidence: `README.rst`)
- MPS file → MPS solve entry: loads MPS (evidence: `cylp/py/PySolve.py`)
- LP modeling → Python solver API: models for (evidence: `README.rst`)
- MPS solve entry → Python solver API: creates solver (evidence: `cylp/py/PySolve.py`)
- Python solver API → CLP binding: wraps solver
- MPS reader → CLP binding: loads problem
- CLP binding → Simplex engine: runs primal (evidence: `cylp/cpp/IClpSimplex.cpp`)
- Simplex engine → Wolfe simplex: supports variant
- MPS solve entry → Pivot strategies: selects strategy (evidence: `cylp/py/PySolve.py`)
- Pivot strategies → Pivot interface: implements interface (evidence: `cylp/py/pivots/DantzigPivot.py`)
- Pivot interface → CLP binding: accesses model
- Wolfe positive edge → Pivot interface: implements interface (evidence: `cylp/py/pivots/WolfePivotPE.py`)
- Python user → Quadratic programs: defines QP
- Quadratic programs → QPS reader: reads QPS (evidence: `cylp/py/QP/QP.py`)
- Quadratic programs → Sparse utilities: uses matrices (evidence: `cylp/py/QP/QP.py`)
- Quadratic programs → Python solver API: solves through (evidence: `cylp/py/QP/QP.py`)
- CBC MIP model → MIP cut generators: accepts cuts
- CBC MIP model → Node comparison: uses strategy
