COIN-OR Knowledge Base
Semantically annotated documentation for the COIN-OR open-source optimization stack. Find algorithm details, mathematical formulations, complexity analysis, and academic references — all extracted from annotated C++ headers.
For Students: Getting Started
New to optimization solvers? Here's what you need to dive in.
Prerequisites
- Linear Algebra — Matrices, solving $Ax = b$, rank, null space
- Calculus — Derivatives, gradients (for nonlinear optimization)
- Programming — Ability to read C++ (not write it)
Recommended Path
- LP Fundamentals — Sparse matrices → LU → Simplex
- MIP Journey — Branch-and-bound, cuts, heuristics
- Source Browser — Explore real implementations
Browse by Topic
Matrix & Vector Operations
Core sparse data structures used throughout the solver stack.
| Class | Description |
|---|---|
| CoinPackedMatrix | Column-major sparse matrix with efficient column operations |
| CoinIndexedVector | Sparse vector with $O(1)$ index lookup for basis operations |
| CoinDenseVector | Dense vector for small, frequently-accessed data |
| CoinShallowPackedVector | Non-owning view into packed vector data |
LU Factorization
Basis matrix factorization for the simplex method.
| Class | Description |
|---|---|
| CoinFactorization | Sparse LU with Markowitz pivoting, Forrest-Tomlin updates, FTRAN/BTRAN |
| CoinDenseFactorization | Dense factorization for small basis matrices |
| CoinSimpFactorization | Simplified factorization interface |
| CoinOslFactorization | OSL-derived factorization routines |
Presolve & Problem Reduction
Simplify problems before solving to improve performance.
| Class | Description |
|---|---|
| CoinPresolveMatrix | Matrix representation during presolve transformations |
| CoinPostsolveMatrix | Restore original solution after presolve |
| CoinPresolveAction | Base class for all presolve operations |
| doubleton_action | Eliminate doubleton rows |
| dupcol_action | Remove duplicate columns |
File I/O
Read and write optimization problem formats.
| Class | Description |
|---|---|
| CoinMpsIO | MPS file format reader/writer (industry standard) |
| CoinLpIO | LP file format reader/writer (CPLEX-style) |
| CoinFileInput | Compressed file input (gzip support) |
| CoinModel | In-memory problem builder |
Warm Starting
Save and restore solver state for re-optimization.
| Class | Description |
|---|---|
| CoinWarmStart | Base interface for warm start information |
| CoinWarmStartBasis | Simplex basis status (structural + artificial) |
| CoinWarmStartDual | Dual variable values |
| CoinWarmStartPrimalDual | Combined primal and dual values |
Graph Algorithms
Conflict graphs and clique detection for MIP.
| Class | Description |
|---|---|
| CoinConflictGraph | Variable conflict relationships |
| CoinBronKerbosch | Maximal clique enumeration |
| CoinCliqueList | Collection of cliques for cut generation |
| CoinShortestPath | Shortest path algorithms |
Search Trees
Branch-and-bound tree management.
| Class | Description |
|---|---|
| CoinSearchTree | Generic search tree container |
| CoinSearchTreeCompareBest | Best-first node selection |
| CoinSearchTreeCompareDepth | Depth-first node selection |
| CoinSearchTreeCompareBreadth | Breadth-first node selection |
Library Layers
COIN-OR is organized in dependency layers. Higher layers build on lower ones.
Text version of layer diagram
Mathematical Formulations
The knowledge base captures mathematical formulations from the solver documentation. For example, the standard form LP:
$$\min_{x} \quad c^T x \quad \text{subject to} \quad Ax = b, \quad x \geq 0$$
And the Markowitz pivot selection criterion minimizes fill-in during LU factorization:
$$\text{score}(a_{ij}) = (r_i - 1)(c_j - 1)$$
where $r_i$ is the row count and $c_j$ is the column count for element $a_{ij}$.
For AI Agents
This knowledge base is built for machine consumption. Point your agent at it and instantly gain expertise on 28 optimization libraries.
Hosted API (No Setup Required)
Fetch the JSON API directly — works with any agent that can read URLs:
https://monistowl.github.io/coin-or-kb/api/annotations.json
Example prompt for Claude, GPT, or any LLM:
Fetch https://monistowl.github.io/coin-or-kb/api/annotations.json and use it to answer questions about COIN-OR optimization libraries. This contains algorithm descriptions, mathematical formulations, and complexity analysis for 2,079 files across 28 libraries (789 with semantic annotations).
API Endpoints:
| Endpoint | Description |
|---|---|
/api/annotations.json | Full knowledge base with semantic annotations (2.1 MB) |
/api/class-briefs.json | Lightweight class index for browser (1,963 classes) |
/api/knowledge-graph/ | Concept graph with 41 concepts, 1,471 relationships |
/algorithms/ | Human-readable algorithm cross-reference (100 algorithms) |
/dependencies/ | Third-party library documentation |
Local MCP Server (For Claude Desktop)
Add to your Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
"coin-or-kb": {
"command": "python",
"args": ["/path/to/mcp-server/coin_or_kb_server.py"]
}
}
}
Available MCP Tools:
| Tool | Description |
|---|---|
search_algorithms | Find implementations by algorithm name ("LU factorization", "simplex") |
search_math | Find files by mathematical concept ("clique", "Ax=b", "dual") |
get_library | Overview of a library with all annotated files |
get_file | Full annotations for a specific file |
list_algorithms | List all documented algorithms |
query_concepts | Search the knowledge graph (41 concepts, 1,471 relationships) |
get_algorithm_guidance | Detailed guidance for 13 key algorithms |
get_stats | Knowledge base statistics |
CLI Query Tool
For quick lookups without MCP:
# Search by algorithm
./scripts/kb-query.py algo "Markowitz" # LU factorization pivot selection
./scripts/kb-query.py algo "branch and bound" # MIP tree search
# Search by math concept
./scripts/kb-query.py math "clique" # Conflict graph algorithms
./scripts/kb-query.py math "reduced cost" # Simplex pricing
# Get library overview
./scripts/kb-query.py lib CoinUtils # Foundation library
./scripts/kb-query.py lib Ipopt # NLP solver
# Get specific file details
./scripts/kb-query.py file CoinUtils CoinFactorization.hpp
# List all documented algorithms
./scripts/kb-query.py list
JSON API
Load the entire knowledge base directly:
import json
with open('site/static/api/annotations.json') as f:
kb = json.load(f)
# Find all simplex-related algorithms
for layer in kb['layers'].values():
for lib in layer['libraries'].values():
for path, file in lib['files'].items():
algo = file.get('algorithm', '')
if 'simplex' in algo.lower():
print(f"{lib['name']}/{path}")
print(f" {algo[:100]}...")
API Endpoints:
/api/annotations.json— Full knowledge base (2.1 MB)/api/class-briefs.json— Class index for browser/search (1,963 classes)/api/knowledge-graph/— Concept graph and relationships
What's in the Annotations?
Each annotated file can include:
| Tag | Example |
|---|---|
@algorithm | Sparse LU with Markowitz pivot selection |
@math | Chooses pivot minimizing $(r_i - 1)(c_j - 1)$ |
@complexity | $O(m^2)$ worst case, typically $O(m \cdot \text{nnz})$ |
@ref | Forrest & Tomlin, "Updating triangular factors" (1972) |
@brief | One-line summary of the file's purpose |
@see | Cross-references to related code |
Coverage: 2,079 annotated files across 28 libraries. 789 files have deep semantic annotations (@algorithm, @math, @complexity).