mcfcg

Weekly CI License: MIT arXiv DOI

Column generation solver for the minimum-cost multicommodity flow (MCF) problem with path-based and tree-based Dantzig-Wolfe decompositions.

The implementation accompanying: S. Spoorendonk and B. Petersen, Tree-based formulation for the multi-commodity flow problem, arXiv:2509.24656, 2026 (v3, 25 Aug 2026).

A planar network of 150 nodes and 425 edges. Thick edges in full colour, the saturated ones, form chains through the middle of the network; paler edges carry some flow, and the thin grey ones carry none.

The CommaLab instance planar150 (150 nodes, 850 arcs, 2239 commodities) with an optimal multicommodity flow. An edge’s width is the flow in its busier direction; the edges saturated in a direction are in full colour, and those without flow in grey. The instance has no coordinates: the positions are recovered from its arc costs, which are the arcs’ squared lengths.

A planar network of 150 nodes and 425 edges. Thick edges in full colour, the saturated ones, form chains through the middle of the network; paler edges carry some flow, and the thin grey ones carry none.

The CommaLab instance planar150 (150 nodes, 850 arcs, 2239 commodities) with an optimal multicommodity flow. An edge’s width is the flow in its busier direction; the edges saturated in a direction are in full colour, and those without flow in grey. The instance has no coordinates: the positions are recovered from its arc costs, which are the arcs’ squared lengths.

Problem and formulations

Given a directed graph \(G=(V,A)\) with arc costs \(c_a\) and capacities \(u_a\), and a set of commodities \(K\) where commodity \(k\) routes \(d_k\) units from source \(o_k\) to sink \(t_k\), find the min-cost feasible multicommodity flow.

Arc-flow (compact) formulation

\[\begin{split}\begin{aligned} \min\;& \sum_{k\in K}\sum_{a\in A} c_a\, x^k_a \\ \text{s.t.}\;& \sum_{a\in\delta^+(v)} x^k_a - \sum_{a\in\delta^-(v)} x^k_a = \begin{cases} d_k & v = o_k\\ -d_k & v = t_k\\ 0 & \text{otherwise}\end{cases} \quad\forall k\in K,\ v\in V\\ & \sum_{k\in K} x^k_a \le u_a \quad\forall a\in A\\ & x^k_a \ge 0 \end{aligned}\end{split}\]

Path formulation (Dantzig-Wolfe)

Let \(P_k\) be the set of \(o_k \!\to\! t_k\) simple paths, with \(\lambda^k_p \ge 0\) the flow on path \(p \in P_k\) and \(c_p = \sum_{a\in p} c_a\). (This is the flow convention the solver uses: the demand row bound is \(d_k\) and the capacity row coefficient is \(1\) per arc used; the pricer’s reduced cost does not carry a \(d_k\) factor.)

\[\begin{split}\begin{aligned} \min\;& \sum_{k\in K}\sum_{p\in P_k} c_p\, \lambda^k_p \\ \text{s.t.}\;& \sum_{p\in P_k} \lambda^k_p \ge d_k \quad\forall k\in K \quad[\pi_k \ge 0]\\ & \sum_{k\in K}\sum_{p\in P_k} \delta_{ap}\, \lambda^k_p \le u_a \quad\forall a\in A \quad[\mu_a \le 0]\\ & \lambda^k_p \ge 0 \end{aligned}\end{split}\]

Reduced cost of a path \(p\) for commodity \(k\): \(\bar c^k_p = \sum_{a\in p} (c_a - \mu_a) - \pi_k\). Pricing reduces to a shortest path in \(G\) with arc weights \(c_a - \mu_a\) (one Dijkstra per source, targeting that source’s sinks).

Tree formulation (Dantzig-Wolfe)

Group commodities by source: \(S_s = \{k \in K : o_k = s\}\). For each source \(s\) let \(T_s\) be the set of trees (subgraphs) serving every sink of \(S_s\) from \(s\), with \(\xi^s_t\) the fraction used, aggregated arc flow \(f^{s,t}_a = \sum_{k\in S_s} d_k [a \in \text{path from } s \text{ to } t_k \text{ in } t]\), and tree cost \(c_t = \sum_{a\in A} c_a\, f^{s,t}_a\).

\[\begin{split}\begin{aligned} \min\;& \sum_{s}\sum_{t\in T_s} c_t\, \xi^s_t \\ \text{s.t.}\;& \sum_{t\in T_s} \xi^s_t = 1 \quad\forall s \quad[\pi_s]\\ & \sum_{s}\sum_{t\in T_s} f^{s,t}_a\, \xi^s_t \le u_a \quad\forall a\in A \quad[\mu_a \le 0]\\ & \xi^s_t \ge 0 \end{aligned}\end{split}\]

Reduced cost of a tree \(t\) for source \(s\): \(\bar c^s_t = \sum_{a\in A} f^{s,t}_a (c_a - \mu_a) - \pi_s\). Pricing is a single Dijkstra from \(s\) with arc weights \(c_a - \mu_a\) that simultaneously finds all shortest paths to the sinks of \(S_s\); the tree column aggregates demand-weighted arc flow over those paths.

Algorithm

Dantzig-Wolfe column generation. The restricted master starts with demand/convexity rows; capacity rows are added lazily on violation. Slacks go on whichever side is smaller, the structural rows or the capacitated arcs: in the first case every demand/convexity row gets one at the start, in the second (EdgeRows) each capacity row brings its own when it is added. Each iteration solves the LP once, separates violated capacity cuts, prices columns against the captured duals, and commits what survived.

\[\begin{split}\begin{array}{l} \textbf{Algorithm 1 } \textsf{SolveCG}(G, K, \text{params}) \\ \hline \textsf{master.init}();\ \textsf{pricer.init}() \\ \textbf{if } \text{warm-start} \textbf{ then seed master: one column per structural row, priced at } \pi = +\infty \\ UB \leftarrow +\infty,\ LB \leftarrow -\infty \\ \textbf{for } it = 1, \ldots, it_{\max} \textbf{ do} \\ \quad (\pi, \mu,\ \mathit{obj}) \leftarrow \textsf{master.solveAndReadDuals}() \qquad \triangleright \text{duals read BEFORE any mutation} \\ \quad A^{\text{new}} \leftarrow \textsf{master.separateCapacityViolations}() \qquad \triangleright \text{new lazy rows; no re-solve} \\ \quad s \leftarrow \textsf{master.numBasicSlacks}() \\ \quad \textbf{if } s = 0 \wedge A^{\text{new}} = \emptyset \textbf{ then } UB \leftarrow \min(UB, \mathit{obj}) \\ \quad \textbf{if } \textsf{PricerHeavy} \wedge A^{\text{new}} \ne \emptyset \textbf{ then continue} \qquad \triangleright \text{defer pricing; next iter's LP uses fresh duals} \\ \quad C \leftarrow \textsf{pricer.price}(\pi, \mu,\ C_{\max}) \\ \quad \textbf{if } C = \emptyset \textbf{ then } C \leftarrow \textsf{pricer.price}(\pi, \mu,\ C_{\max},\ \text{final}=\top) \qquad \triangleright \text{full sweep ignoring postpone flags} \\ \quad \textbf{if } C \ne \emptyset \textbf{ then } \textsf{pricer.clearPostponed}() \qquad \triangleright \text{flags only; keep cursor for partial pricing} \\ \quad \textbf{if } \textsf{pricer.pricedAll} \textbf{ then} \qquad \triangleright \text{no gate on } s \text{ or } A^{\text{new}}\text{: valid for any } \mu \le 0 \\ \qquad LB \leftarrow \max\!\bigl(LB,\ \textstyle\sum_{a} u_a \mu_a + \sum_k d_k\, \mathit{sp}_k(c - \mu) - \varepsilon\bigr) \\ \quad \textbf{if } UB < \infty \wedge 0 \le UB - LB < \tau \cdot \max(1, \lvert UB \rvert) \textbf{ then return optimal}(UB) \\ \quad \textbf{if } C = \emptyset \textbf{ then} \\ \qquad \textbf{if } s = 0 \wedge A^{\text{new}} = \emptyset \textbf{ then return optimal}(UB) \\ \qquad \textbf{if } s > 0 \textbf{ then } \textsf{master.bumpSlacks}() \\ \qquad \textsf{pricer.resetPostponed}();\ \textbf{continue} \qquad \triangleright \text{fresh sweep next iter} \\ \quad \text{trim } C \text{ to the } C_{\max} \text{ columns with lowest reduced cost} \\ \quad \textsf{master.bumpSlacks}();\ \text{purge aged cols};\ \text{purge idle cap rows} \\ \quad \textsf{master.addColumns}(C) \\ \textbf{return stopped}\bigl(UB < \infty\ ?\ UB : LB\bigr) \qquad \triangleright \text{time limit / } it_{\max} \text{ / LP not optimal} \\ \end{array}\end{split}\]

The LB is the Lagrangian relaxation of the capacity (coupling) constraints: \(\mathit{sp}_k(c-\mu)\) is the reduced-cost shortest path the pricer already computed for entity \(k\), accumulated without subtracting the structural dual \(\pi_k\), and \(\varepsilon\) is a rounding-error budget for the scale-integer Dijkstra. By weak duality \(L(\mu) \le \mathrm{OPT}\) for any \(\mu \le 0\), so the bound holds whatever the master’s feasibility state — it is gated only on the pricer having visited every source, not on \(s = 0\) or \(A^{\text{new}} = \emptyset\), and so it advances from the first iteration rather than waiting for the last slack to leave the basis. The \(\pi\)-free form matters numerically as well as logically: a basic slack pins \(\pi_k\) at the bumped slack cost, and reconstructing the bound from \(\pi^\top b\) would then lose it to catastrophic cancellation. Demands weight the path sum for the path formulation; under tree the convexity RHS is \(1\) and the \(d_k\) weighting collapses.

Both optimal exits return \(UB\) — the incumbent — never the terminating iteration’s LP objective. The pricing-exhaustion exit fires under exactly the guard that updates \(UB\), so \(UB \le \mathit{obj}\) holds there by construction; returning \(\mathit{obj}\) instead used to hand back a value worse than one CG already had whenever a barrier landed above an earlier solve on a strictly larger column set.

The non-optimal exit reports \(UB\) when one was ever recorded and falls back to the Lagrangian \(LB\) otherwise: with slacks basic the LP objective is a feasibility penalty rather than a routing cost, so it would be worse than useless as a reported value. That fallback is not a corner case in practice — of the 20 uncertified cells in results/cg_benchmark.csv, 19 produced a number at all, and 17 of those report a lower bound in their objective column for exactly this reason.

pricer.price is the source-level dispatcher; each per-source call (PriceOneSource) is the A* inner body. Postponement is a one-iter-ahead filter: a source that emits no negative-RC column is skipped on the next non-final call. Flags are cleared whenever the main iteration commits columns (clearPostponed, keeps the cursor so partial pricing resumes), when pricing finally exhausts (resetPostponed, rewinds to source 0), and after the warm-start pass. filter_for_new_caps rewrites the flag vector wholesale after a cut round: sources whose best-path arcs were touched by a new cap are flipped in (postponed=0), all others are postponed until a later sweep re-examines them.

\[\begin{split}\begin{array}{l} \textbf{Algorithm 2 } \textsf{pricer.price}(\pi, \mu;\ \text{final}=\bot,\ C_{\max}=\infty) \\ \hline \text{compute } w_a \leftarrow \max(0,\ c_a - \mu_a) \cdot 10^9 \text{ for all } a \in A \qquad \triangleright \text{dense vectorized arc pass} \\ C \leftarrow \emptyset;\ \textit{pricedCount} \leftarrow 0 \\ \textbf{for each source } s \text{ (round-robin from cursor, in batches of } B \text{) } \textbf{do} \\ \quad \textbf{if } \neg\text{final} \wedge s \in \text{Postponed} \textbf{ then continue} \qquad \triangleright \text{skipped sources do not count} \\ \quad C \leftarrow C \cup \textsf{PriceOneSource}(s, \pi, \mu);\ \textit{pricedCount}{+}{+} \qquad \triangleright \text{parallel across batch (thread pool)} \\ \quad \textbf{if } |C| \ge C_{\max} \textbf{ then break} \\ \textit{pricedAll} \leftarrow (\textit{pricedCount} = \lvert \text{sources} \rvert) \qquad \triangleright \text{derived at end; sweep-completing break still counts} \\ \textbf{return } (C,\ \textit{pricedAll}) \\ \end{array}\end{split}\]
\[\begin{split}\begin{array}{l} \textbf{Algorithm 3 } \textsf{PriceOneSource}(s,\ \pi,\ \mu) \\ \hline \text{run A* from } s \text{ with edge weights } w_a \text{ until every reachable sink of } S_s \text{ is settled} \\ \textbf{for each } k \in S_s \textbf{ do} \\ \quad \textbf{if } t_k \text{ unreachable then skip} \\ \quad p_k \leftarrow \text{shortest path};\ \bar c_k \leftarrow \textstyle\sum_{a \in p_k}(c_a - \mu_a) - \pi_k \qquad \triangleright \text{true RC, floating point} \\ \textbf{path: emit } \{p_k : \bar c_k < \tau_{\mathrm{rc}}\};\ \text{postpone } s \text{ if none emitted} \\ \textbf{tree: aggregate } f_a = \textstyle\sum_k d_k [a \in p_k];\ \text{emit tree column if RC} < \tau_{\mathrm{rc}},\ \text{else postpone } s \\ \end{array}\end{split}\]

Iteration log

Verbosity::Iteration prints one row per CG iteration:

column

meaning

It

iteration number

UB

running min LP obj over MCF-feasible iters

LB

best \(\pi\)-free capacity-relaxation Lagrangian bound so far

LP_obj

current LP objective (carries slack penalty while #slk > 0)

#col, #row

columns / rows in the LP right now

#slk

basic slack columns; non-zero means LP_obj is a penalty, not a bound

+col, -col

columns added / purged this iteration (*N = produced but not committed on gap exit)

+cut, -cut

capacity rows added / purged this iteration

t_LP, t_PR, t_SP, t_Tot

per-iter seconds (LP, pricing, separation, total)

t_acc

seconds accumulated over the iterations so far

A CG optimal or CG stopped line ends the log with the iteration count, the final UB, LB and gap, and the time totals; stopped means not certified (iteration cap, time limit, or an LP the backend could not solve). The CLI then prints [bounded-pricing] enabled=… fired=… priced=… rate=…: how many of the source pricings --bounded-pricing cut short (fired is 0 when it is off).

Build

Requires a C++23 compiler (it is built with GCC 15, with Apple clang 21, and weekly with the default compiler of Ubuntu 24.04), CMake 3.21+, zlib and a BLAS, which HiGHS’ interior-point solver needs: zlib1g-dev and libopenblas-dev on Debian/Ubuntu. Configuring downloads HiGHS and GoogleTest from GitHub (FetchContent); nothing else needs installing. It also sets this checkout’s core.hooksPath to .githooks (Git hooks) unless -DMCFCG_INSTALL_GIT_HOOKS=OFF is given.

To push, also run uv sync once per checkout: it installs clang-format and clang-tidy 22.1.8 (pinned in pyproject.toml) and the documentation site’s Sphinx build into .venv. The pre-push gate configures with -DMCFCG_REQUIRE_LINT=ON and fails on any other clang version, including a system clang-tidy on PATH, and on a .venv without the docs build.

cmake -B build
cmake --build build -j$(nproc)

There is no install step: run the binaries from build/. mcfcg is a C++ library and two command-line tools. There is no Python package: uv sync installs development tools only, and scripts/ are plain Python scripts.

Use it from C++

The library is consumed as source, by add_subdirectory or FetchContent, as the CMake target mcfcg; there is no install() and no exported package. The target carries C++23 and HiGHS with it:

cmake_minimum_required(VERSION 3.21)
project(app LANGUAGES C CXX)   # C is needed by HiGHS

include(FetchContent)
set(MCFCG_INSTALL_GIT_HOOKS OFF)
FetchContent_Declare(mcfcg
    GIT_REPOSITORY https://github.com/spoorendonk/mcfcg.git
    GIT_TAG main)              # or, to pin one tree, a release tag after v0.1.0
FetchContent_MakeAvailable(mcfcg)

add_executable(app main.cpp)
target_link_libraries(app PRIVATE mcfcg)
#include <cstdio>
#include <exception>

#include "mcfcg/cg/path_cg.h"   // solve_path_cg
#include "mcfcg/cg/tree_cg.h"   // solve_tree_cg
#include "mcfcg/instance.h"     // read_commalab, read_tntp

int main(int argc, char** argv) {
    if (argc != 2) {
        return 2;
    }
    try {
        const mcfcg::Instance inst = mcfcg::read_commalab(argv[1]);
        const mcfcg::CGResult result = mcfcg::solve_tree_cg(inst, {.time_limit_seconds = 60.0});
        std::printf("%s objective %.6f, lower bound %.6f\n",
                    result.optimal ? "optimal," : "not certified,", result.objective,
                    result.lower_bound);
    } catch (const std::exception& e) {   // unreadable or infeasible instance
        std::fprintf(stderr, "error: %s\n", e.what());
        return 1;
    }
}

solve_path_cg takes the same arguments. As a subproject mcfcg also builds its own command-line tools and tests, so build your target by name (cmake --build build --target app) to skip them.

macOS

The Mac build works with HiGHS alone. From a fresh clone, the ## Build & Test blocks in CLAUDE.md pass on it, Python and CLI tests included (Apple clang 21, arm64). You need:

xcode-select --install                    # Apple clang, the SDK (zlib), python3
brew install cmake ninja uv coreutils     # coreutils provides `nproc`
uv sync                                   # pinned clang-format/clang-tidy wheels

Stock macOS has no nproc, and the build and test commands call it. Any nproc on PATH works. The Mac mini gate ran with a two-line shim that prints sysctl -n hw.ncpu, not with coreutils.

zlib comes from the SDK. HiGHS’ interior-point solver uses Apple’s Accelerate framework as its BLAS, so you do not install OpenBLAS. To check that the solver really is HiPO, run mcfcg_cli … --verbose-solver: every solve should log Running HiPO. ccache (brew install ccache) is optional. pre-push builds in a fresh worktree, so ccache only speeds that build up when a user-level ccache base_dir is set. Behaviour that differs from Linux:

  • No GPU. cuOpt needs CUDA, so leave MCFCG_USE_CUOPT off; it is off by default. --solver cuopt then exits with cuOpt not available.

  • Python.Scripts skips two more test classes. Two in timeout_memory_test (the harness-timeout RSS test and PgidMembersTest) need Linux /proc, which the benchmark harness scans for process groups. On any platform the cli_test classes skip there too (they run as CLI.EndToEnd), and in a fresh clone the two committed-round checks in analyze_bounded_pricing_ablation_test, because the raw ablation logs are gitignored.

  • The benchmark scripts are Linux-only. They run every solve under /usr/bin/time -f %M. That needs GNU time, but on macOS the file is BSD time, which rejects -f, so every benchmark cell fails.

  • hooks.localCiCpus has no effect. It pins CPUs with taskset, which macOS lacks. pre-push says so and runs the local CI on every CPU.

Optional

Flag

Default

Effect

-DMCFCG_USE_CUOPT=ON

OFF

Enable the NVIDIA cuOpt GPU LP backend. Defaults to cuOpt’s incremental delta C API (MCFCG_CUOPT_DELTA_API, below), which requires the fork.

-DMCFCG_CUOPT_DELTA_API=OFF

ON

Opt out of the delta C API for stock (non-fork) cuOpt: falls back to the rebuild-from-scratch path, which recreates the whole LP every CG iteration — a serious performance degradation. Default ON requires the fork’s cuopt_c_delta.h (configure errors if absent). Only meaningful with -DMCFCG_USE_CUOPT=ON.

-DMCFCG_USE_COPT=ON

OFF

Enable the COPT LP backend (requires COPT installed, COPT_HOME set)

-DMCFCG_USE_MOSEK=ON

OFF

Enable the MOSEK CPU barrier LP backend (requires MOSEK, MOSEK_HOME set)

-DMCFCG_NATIVE_ARCH=OFF

ON

Disable -march=native. Keep ON for SIMD auto-vectorization of the hot cost[a] - mu[a] pricing loop; only turn OFF for portable binaries.

-DMCFCG_INSTALL_GIT_HOOKS=OFF

ON

Stop configure from pointing this checkout’s core.hooksPath at the tracked .githooks/ (see below).

Git hooks

Development hooks are tracked in .githooks/: commit-msg (Conventional Commits), pre-commit (checks, without reformatting, that every tracked C++ file is clang-formatted) and pre-push (no merge commits on main, a review receipt for the pushed commit, then a clean build and the tests, including the clang_format and clang_tidy:<path> lint tests for what the push changed, in a fresh worktree of that commit). They come from wcp; see CLAUDE.md for the details. Git only runs hooks from core.hooksPath, which is per-checkout config and therefore cannot itself be tracked, so cmake -B build sets it for you. It leaves an existing .githooks value alone and warns rather than overwriting a hooksPath you set deliberately. To do it by hand, or after configuring with -DMCFCG_INSTALL_GIT_HOOKS=OFF:

git config core.hooksPath .githooks

cuOpt and the delta-API fork

The cuOpt backend mutates the restricted master incrementally (add/delete columns and rows, re-solve), so by default it uses cuOpt’s incremental delta C API (MCFCG_CUOPT_DELTA_API=ON). Stock cuOpt has no such API; the default path needs a cuOpt build that ships cuopt_c_delta.h — the spoorendonk/cuopt fork (delta-api-26.10 branch, the delta API on the v26.10.00 release). Build that fork first (configure errors out if the header is missing), or reconfigure with -DMCFCG_CUOPT_DELTA_API=OFF to fall back to the rebuild-from-scratch path on a stock cuOpt with its headers under cuopt/mathematical_optimization/ (the v26.08.00 release on; a cuOpt that keeps them under cuopt/linear_programming/, such as the fork’s old delta-api branch, fails the configure) — a serious performance degradation (the whole LP is recreated every CG iteration), supported only as a compatibility fallback. To use the fork, point the configure at it (an install prefix or a source checkout both work):

# one combined build with both COPT and the cuOpt delta fork
cmake -B build -DCMAKE_INSTALL_MESSAGE=LAZY \
  -DMCFCG_USE_COPT=ON \
  -DMCFCG_USE_CUOPT=ON \
  -DCUOPT_INCLUDE_DIR=/path/to/cuopt/cpp/include \
  -DCUOPT_LIBRARY=/path/to/cuopt/cpp/build/libcuopt.so
cmake --build build -j$(nproc)

From v26.10 libcuopt.so is a GNU ld script naming the component libraries libcuopt_client.so and libcuopt_mathopt.so in the same directory, so the link line above still works and the binaries end up depending on those two. They (and their librmm / rapids_logger deps) must be reachable by the dynamic loader at run time. The build embeds the cuOpt library directory as an RPATH — derived from CUOPT_LIBRARY — so build/mcfcg_cli, the tests, and the tools run without exporting LD_LIBRARY_PATH. If you later move the fork’s build directory, either reconfigure (so the RPATH updates) or put the new location on LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/path/to/cuopt/cpp/build:$LD_LIBRARY_PATH

LP backends

Four LP backends implement a common interface: HiGHS (default, FetchContent, no license/GPU), cuOpt (GPU barrier), COPT (CPU/GPU barrier), and MOSEK (CPU barrier). Select at run time with --solver.

Pinned barrier configuration. For fair cross-solver comparison every backend runs the same regime: presolve off, crossover off, convergence tolerance 1e-4 (the MCF feasibility design target; see include/mcfcg/util/tolerances.h BARRIER_TOL). Each solver prints a one-line provenance banner to stderr at construction (captured in the CG / benchmark logs), e.g.:

[lp-config] backend=mosek version=11.0.30 method=barrier exec=CPU presolve=off crossover=off tol=0.0001 threads=auto(32)

version= is queried from the library actually loaded at run time, never from the vendor header’s compile-time macros, so a stale LD_LIBRARY_PATH pointing at a second install shows up here instead of being silently misreported. PROVENANCE.txt records what it cannot see: whether cuOpt is the delta-API fork, and, for the v0.1.0 results built on HiGHS 1.15.1, the local HiPO patch (gone since v1.16.0, which carries the upstream fix).

The tolerance is each vendor’s primal and dual feasibility tolerance. MOSEK and cuOpt get it as their relative gap tolerance too; HiGHS and COPT keep their own default there. exec=GPU for COPT is what --copt-gpu-mode asked for, also on a machine without a GPU, and a backend on the GPU prints threads=n/a(GPU). The environment variable MCFCG_HIGHS_SOLVER (simplex, ipm, hipo or pdlp; default hipo) selects another HiGHS method.

threads=auto(N) reports the backend’s effective thread count (N = hardware concurrency when the backend auto-selects); exec is CPU or GPU. The banner reports the steady-state pins — a stall-recovery certify solve transiently runs crossover on the crossover-capable backends (HiGHS/COPT/MOSEK; see below).

HiPO errors are redone with simplex. On a few LPs HiGHS’s HiPO ends in an error: a NaN met close to the optimum of a feasible LP (which the same LP repeats every time), or a verdict it cannot settle. The HiGHS backend then solves that one LP again with simplex, outside the regime above, and says so on stderr: one [lp-fallback] backend=highs solve=K: … line per such solve and a [lp-fallback] backend=highs total=N of M solves line at the end, with nothing printed when N is 0. The banner still reads method=hipo. scripts/benchmark_solvers.py marks such a run LP-FALLBACK in the CSV’s detail column: its time is not HiPO’s alone. One case is not marked: on a certify solve (below) HiGHS itself finishes with simplex when HiPO stalls short of its tolerances.

HiGHS crossover-on-certify (stall recovery). HiGHS uses the HiPO interior-point method with crossover off per iteration, so the bulk of CG is fast. But a pure interior-point solution is not a vertex: on the path formulation of large instances its central duals can fail to price an improving column, and demand-row slacks settle at O(tol) > 0 rather than exactly 0, so the CG loop cannot certify a slack-free upper bound. When the loop detects this stall (pricing exhausted but not optimal, or an interior solve spuriously reporting infeasible after cuts), it re-requests that one solve as a certify solve via LPSolver::solve(certify=true) — HiGHS then runs crossover to round the interior point to a vertex (discriminating duals, slacks exactly 0). COPT and MOSEK likewise run crossover (basis identification) only on a certify solve; the cuOpt GPU barrier has no crossover and treats certify as a no-op (the loop skips its stall recovery there, via certify_runs_crossover()). This keeps “crossover off” honest for the common case (every backend runs crossover-off steady-state, and in practice only HiGHS ever stalls) while letting any crossover-capable backend certify the cases that need a vertex — crossover fires only on the stalled solves, not every iteration.

Test

GTEST_BRIEF=1 ctest --test-dir build --output-on-failure --progress -j$(nproc)

A single test:

./build/mcfcg_tests --gtest_filter='PathCGSingleSource.OptimalObjective'
./build/mcfcg_integration_tests --gtest_filter='GridCorrectness.Grid1'

The documentation site is this README and the other READMEs in the repository, built by Sphinx from docs/. The test docs_build (ctest --test-dir build -L docs) builds it warning-free; to build it by hand:

uv run --only-group docs sphinx-build -W -b html docs build/docs/html

CLI usage

./build/mcfcg_cli <instance_path> [options]

Option

Default

Meaning

--formulation path|tree

path

Decomposition to use

--max-iters N

10000

CG iteration cap

--trips PATH

auto

TNTP trips file; by default the net path with _net replaced by _trips

--coef N

auto

TNTP demand coefficient: every demand is divided by it. By default the one of the city the file is named after, known for nine cities only (0 = this default)

--threads N

0

Pricing threads (0 = hardware concurrency, 1 = serial)

--batch-size N

0

Sources priced per batch. 0 = all, except under --strategy pricer-heavy: max(threads, sources/4) there when there are more sources than pricing threads

--solver NAME

highs

LP backend: highs, cuopt, copt, mosek

--copt-gpu-mode N

2

COPT barrier execution: 0 = CPU, 1/2 = GPU (default 2). Only affects --solver copt.

--write-mps PATH

—

Write the compact source-based LP as MPS (gzipped if PATH ends in .gz) and exit without solving

--verbose-solver

off

Enable the LP backend’s own log output, on stderr

--stats-only

off

Print the instance’s cost scale and slack-cost ceiling for the chosen --solver as CSV and exit without solving (columns below)

--col-age-limit N

5

Purge columns after N idle iters (0 disables). Ignored under --strategy pricer-heavy, which never purges columns

--row-inactivity N

5

Purge cap rows after N idle iters (0 disables)

--neg-rc-tol X

-1e-3

Reduced-cost acceptance threshold

--time-limit S

0

Wall-clock budget in seconds (0 = off); stops at the next iteration and prints the result row with optimal = 0

--strategy S

pricer-light

pricer-light or pricer-heavy preset

--bounded-pricing

off

Stop each source’s A* once the duals prove no improving column remains

-h, --help

Print the options and exit

A solve prints one CSV header and one row on stdout; everything else (iteration log, banners, the LP backend’s log) goes to stderr. The columns:

Column

Meaning

instance, formulation

as given on the command line

iterations, columns

CG iterations run, columns in the master at the end

objective

with optimal = 1 the optimal value (to the solver’s tolerances: a relative gap below 1e-4, or pricing exhausted). With optimal = 0 the best feasible value found, or, when none was found, the Lagrangian lower bound, which is -inf if there is none of those either

lower_bound

best Lagrangian lower bound; empty when no iteration priced every source

optimal

1 if the objective is certified, else 0 (time limit, iteration cap, or an LP the backend could not solve)

time, time_lp, time_pricing, time_separation

seconds, total and per part

There is no upper-bound column: with optimal = 0 an objective equal to lower_bound is a bound, not a solution.

Exit codes. 0 after any completed run, optimal = 0 included, so a script must test the optimal column. 1 for a usage error, an unreadable or invalid instance (also a commodity with no path, below), an unknown solver or TNTP city, a backend that was not compiled in, or an error the backend raised; stdout then has no result row.

--stats-only prints the instance sizes and cost scale, the slack-cost ceiling with the bound it is clamped from (slack_cost_upper_bound), where the slacks go (slack_mode), and the dimensions of the LP that --write-mps writes (source_lp_cols, source_lp_rows, source_lp_nnz).

# CommaLab format
./build/mcfcg_cli data/commalab/grid/grid1

# TNTP transportation format (auto-detects trips file and demand coefficient)
./build/mcfcg_cli data/transportation/Winnipeg_net.tntp.gz

# Tree formulation
./build/mcfcg_cli data/commalab/grid/grid1 --formulation tree

Input files

CommaLab, the default format: whitespace-separated numbers, vertices numbered from 1. Three counts, then one line per arc, then one per commodity:

<vertices>
<arcs>
<commodities>
<from> <to> <cost> <capacity>        one per arc; capacity < 0: uncapacitated
<source> <sink> <demand>             one per commodity

TNTP, recognised by a file name ending in _net.tntp or _net.tntp.gz; the matching _trips file holds the demands. The arc cost is the free_flow_time column. Demands are divided by a coefficient that is built in for the nine cities in scripts/README.md, looked up by the file name up to its first _; any other name exits with use --coef.

A file of either format is decompressed when its name ends in .gz.

A demand is finite and at least 0. Any other is refused with exit code 1, in every mode, and so is a --coef that is not. A line of a TNTP net file or a pair of a trips file that cannot be read is skipped, with a warning on stderr that counts them; a trips pair of demand 0 is dropped without one.

Every sink must be reachable from its source. A commodity with demand and no path makes the instance infeasible, and a solve refuses it with exit code 1 (--stats-only and --write-mps do not look for paths). mcfcg_clean writes a copy of a CommaLab instance (it does not read TNTP) without the unreachable commodities:

./build/mcfcg_clean instance.txt                  # writes instance_cleaned.txt
./build/mcfcg_clean instance.txt --output out.txt

It writes plain text. Name the output yourself for a .gz input: only the last extension is replaced, so x.txt.gz becomes x.txt_cleaned.txt.

Instance data

Four instance families from public sources:

Family

Format

Source

Grid

CommaLab

UniPi MCF benchmark

Planar

CommaLab

UniPi MCF benchmark

Transportation

TNTP (gz)

TransportationNetworks

Intermodal

CommaLab (gz)

Lienkamp & Schiffer 2024

Every instance of all four families is committed to this repository, so reproducing any published row needs no download step. Three of the four can also be re-derived from their original sources rather than taken on trust: scripts/download_commalab.sh fetches grid and planar, and scripts/prepare_intermodal.sh generates the intermodal instances (it needs git lfs). Both skip what is already there, so in a clone, where the data is committed, move the committed copies out of the way first (how). The transportation instances have no fetch script — the committed .tntp.gz files came from the linked TransportationNetworks repository unmodified, and the CLI applies the per-city demand coefficient at read time (the coefficients are tabulated in scripts/README.md).

Reproducing the published results

The committed result tables are in results/; PROVENANCE.txt pins the exact solver versions, host and patches behind them, and scripts/README.md documents how each table is produced and consolidated.

The standard build is HiGHS-only. That is deliberate — it needs no licence, no GPU and no external install — but it means the default cmake -B build produces a binary that can reproduce one of the five benchmark configurations. The other four are opt-in at configure time, and a --solver label whose backend was not compiled in reports as an error row rather than silently disappearing. To build the full matrix:

export MOSEK_HOME=/opt/mosek/<ver>/tools/platform/linux64x86 \
       COPT_HOME=/opt/copt80
cmake -B build -DCMAKE_INSTALL_MESSAGE=LAZY \
      -DMCFCG_USE_MOSEK=ON -DMCFCG_USE_COPT=ON -DMCFCG_USE_CUOPT=ON \
      -DCUOPT_INCLUDE_DIR=/path/to/cuopt/cpp/include \
      -DCUOPT_LIBRARY=/path/to/cuopt/cpp/build/libcuopt.so
cmake --build build -j$(nproc)

What each configuration costs you

Config

Licence

Hardware

Reproducible with open-source components?

highs

none (MIT)

CPU

Yes. Fetched and built by CMake; nothing to install.

cuopt

none (Apache-2.0)

NVIDIA GPU

Yes, given a GPU. Build the spoorendonk/cuopt fork first — the delta C API the default build needs is not in stock cuOpt. To reproduce the published v0.1.0 numbers, build mcfcg’s v0.1.0 tag against fork commit 8ea7a033a; main builds against delta-api-26.10 (commit c474dd160).

mosek

commercial (academic licences available)

CPU

No.

copt-cpu

commercial (academic licences available)

CPU

No.

copt-gpu

commercial (academic licences available)

NVIDIA GPU

No.

Cite the cuOpt fork by commit, not by branch: delta-api-26.10 is a moving ref. The results tagged v0.1.0 were run on the older delta-api branch (commit 8ea7a033a, as PROVENANCE.txt at that tag records). That fork keeps its headers under cuopt/linear_programming/, so build it with mcfcg’s v0.1.0 tag, not main; delta-api-26.10 is the delta-API commits rebased onto upstream v26.10.00, not a descendant of 8ea7a033a, so it is a different cuOpt from the one the results record (its objectives agree, see gh #47).

Verifying a reproduction

Objective values are the reproducible quantity — specifically, the objectives of runs that proved optimality. Wall-clock time and peak RSS are properties of the host, the GPU and the solver build and will not match on different hardware, and a run stopped by the time limit reports a bound that likewise depends on how fast the machine is. scripts/check_reproduction.py compares objectives only, gates on the certified ones, and reports cells your sweep did not run as not run rather than folding them into a pass:

python3 scripts/benchmark_solvers.py --families grid --solvers highs \
    --formulations path,tree --out /tmp/grid_highs.csv
python3 scripts/check_reproduction.py /tmp/grid_highs.csv

That is the smoke test: 30 cells, roughly 15 minutes, no licence and no GPU. It exits non-zero on any mismatch.

Citing

Cite the paper for the result and the archived release for the code. CITATION.cff carries both in machine-readable form — GitHub’s “Cite this repository” button reads it.

The paper is arXiv:2509.24656, https://arxiv.org/abs/2509.24656. Its current version is v3 (25 Aug 2026), a substantial revision of the 2025 v1/v2: every number it reports was produced by release v0.1.0 of this repository, and the 44 instances × 2 formulations × 5 backends it studies are the 440 cells of results/cg_benchmark.csv. Cite the year of that version:

@misc{spoorendonk2026treemcf,
  title        = {Tree-based formulation for the multi-commodity flow problem},
  author       = {Spoorendonk, Simon and Petersen, Bj{\o}rn},
  year         = {2026},
  eprint       = {2509.24656},
  archivePrefix= {arXiv},
  primaryClass = {math.OC},
  url          = {https://arxiv.org/abs/2509.24656}
}

The archived code is on Zenodo. v0.1.0 is 10.5281/zenodo.22058614; the concept DOI 10.5281/zenodo.22058613 always resolves to the latest version. Cite the version DOI when reproducibility matters — it pins one tree, one PROVENANCE.txt, one set of result tables:

@software{spoorendonk2026mcfcg,
  title     = {mcfcg: column generation for minimum-cost multicommodity flow},
  author    = {Spoorendonk, Simon and Petersen, Bj{\o}rn},
  year      = {2026},
  version   = {0.1.0},
  doi       = {10.5281/zenodo.22058614},
  url       = {https://doi.org/10.5281/zenodo.22058614}
}

Cite a tag or a DOI, never main: the result tables under results/ move with the code, and PROVENANCE.txt pins the solver stack only as of the tag that carries it.

License

MIT, except for parts of the graph layer (include/mcfcg/graph/, plus one reverse-Dijkstra loop in include/mcfcg/cg/pricer_base.h) derived from melon, which stay under the Boost Software License 1.0. THIRD_PARTY_NOTICES.md lists them, and LICENSES/BSL-1.0.txt holds the licence text.