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

  1. LP Fundamentals — Sparse matrices → LU → Simplex
  2. MIP Journey — Branch-and-bound, cuts, heuristics
  3. Source Browser — Explore real implementations
Try it now: Interactive Simplex Example — Step through a complete solve with visualization

Browse by Topic

Matrix & Vector Operations

Core sparse data structures used throughout the solver stack.

ClassDescription
CoinPackedMatrixColumn-major sparse matrix with efficient column operations
CoinIndexedVectorSparse vector with $O(1)$ index lookup for basis operations
CoinDenseVectorDense vector for small, frequently-accessed data
CoinShallowPackedVectorNon-owning view into packed vector data

LU Factorization

Basis matrix factorization for the simplex method.

ClassDescription
CoinFactorizationSparse LU with Markowitz pivoting, Forrest-Tomlin updates, FTRAN/BTRAN
CoinDenseFactorizationDense factorization for small basis matrices
CoinSimpFactorizationSimplified factorization interface
CoinOslFactorizationOSL-derived factorization routines

Presolve & Problem Reduction

Simplify problems before solving to improve performance.

ClassDescription
CoinPresolveMatrixMatrix representation during presolve transformations
CoinPostsolveMatrixRestore original solution after presolve
CoinPresolveActionBase class for all presolve operations
doubleton_actionEliminate doubleton rows
dupcol_actionRemove duplicate columns

File I/O

Read and write optimization problem formats.

ClassDescription
CoinMpsIOMPS file format reader/writer (industry standard)
CoinLpIOLP file format reader/writer (CPLEX-style)
CoinFileInputCompressed file input (gzip support)
CoinModelIn-memory problem builder

Warm Starting

Save and restore solver state for re-optimization.

ClassDescription
CoinWarmStartBase interface for warm start information
CoinWarmStartBasisSimplex basis status (structural + artificial)
CoinWarmStartDualDual variable values
CoinWarmStartPrimalDualCombined primal and dual values

Graph Algorithms

Conflict graphs and clique detection for MIP.

ClassDescription
CoinConflictGraphVariable conflict relationships
CoinBronKerboschMaximal clique enumeration
CoinCliqueListCollection of cliques for cut generation
CoinShortestPathShortest path algorithms

Search Trees

Branch-and-bound tree management.

ClassDescription
CoinSearchTreeGeneric search tree container
CoinSearchTreeCompareBestBest-first node selection
CoinSearchTreeCompareDepthDepth-first node selection
CoinSearchTreeCompareBreadthBreadth-first node selection

Library Layers

COIN-OR is organized in dependency layers. Higher layers build on lower ones.

COIN-OR library architecture
Text version of layer diagram
Layer 4: Applications SHOT, OS — Global optimization, web services
Layer 3: MINLP Bonmin, Couenne — Mixed-integer nonlinear
Layer 2: MIP & NLP Cbc, Ipopt — Branch-and-cut, interior point
Layer 1: LP & Cuts Clp, Osi, Cgl — Simplex, interface, cut generators
Layer 0: Foundation CoinUtils — Matrices, I/O, presolve (122 classes documented)

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:

EndpointDescription
/api/annotations.jsonFull knowledge base with semantic annotations (2.1 MB)
/api/class-briefs.jsonLightweight 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:

ToolDescription
search_algorithmsFind implementations by algorithm name ("LU factorization", "simplex")
search_mathFind files by mathematical concept ("clique", "Ax=b", "dual")
get_libraryOverview of a library with all annotated files
get_fileFull annotations for a specific file
list_algorithmsList all documented algorithms
query_conceptsSearch the knowledge graph (41 concepts, 1,471 relationships)
get_algorithm_guidanceDetailed guidance for 13 key algorithms
get_statsKnowledge 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:

What's in the Annotations?

Each annotated file can include:

TagExample
@algorithmSparse LU with Markowitz pivot selection
@mathChooses pivot minimizing $(r_i - 1)(c_j - 1)$
@complexity$O(m^2)$ worst case, typically $O(m \cdot \text{nnz})$
@refForrest & Tomlin, "Updating triangular factors" (1972)
@briefOne-line summary of the file's purpose
@seeCross-references to related code

Coverage: 2,079 annotated files across 28 libraries. 789 files have deep semantic annotations (@algorithm, @math, @complexity).