tropical / max-plus algebra

Where addition is a maximum.

A small library and a set of interactive explainers for max-plus algebra: the linear algebra of scheduling, synchronization, and shortest paths.

Max-plus algebra, also called tropical algebra, is ordinary linear algebra with its two operations swapped. "Addition" becomes take the larger (a ⊕ b = max(a, b)), and "multiplication" becomes add (a ⊗ b = a + b). Nothing else changes: you still have matrices, powers, eigenvalues, and eigenvectors; they just mean something new.

addition ⊕
a ⊕ b = max(a, b)
identity is −∞
multiplication ⊗
a ⊗ b = a + b
identity is 0

That single substitution turns matrix multiplication into an optimization. The (i, j) entry of a max-plus matrix power is the heaviest path of a given length between two nodes; the eigenvalue is the steady-state rate, the maximum mean of any cycle in the graph; and the eigenvector fixes the relative timing of everything else. Swap the max for a min and the very same machinery becomes shortest-path dynamic programming.

This makes max-plus the natural language for systems ruled by "wait for the slowest" constraints: manufacturing lines, railway timetables, project critical paths, network performance, and (as one of the demos here explores) the stepping rhythm of molecular motors. Everything on this site is built around one small, dependency-free library, tropmat.py, that runs anywhere Python does, including a NumWorks calculator.

explore