Day 35 · 2026.07.27

Operations Research

Seeking the Optimum in a World of Constraints
"Operations research is the art of giving bad answers to problems to which otherwise worse answers are given." — Thomas L. Saaty

Linear Programming & the Simplex Method

The skeleton of constrained optimization
Optimization
Intuition

Picture a factory: several products competing for the same limited steel, labour hours, and machines. Every resource limit slices the decision space once — "no more than 100 tons of steel" is a half-space — and stacking all the slices leaves a feasible region that is a high-dimensional polytope.

Profit is linear, so the "equal profit" level sets form a family of parallel planes. Push that family in the direction of increasing profit; the last point it touches before leaving the polytope is the optimum. The optimum always sits at a vertex — infinitely many feasible points collapse into finitely many corners. The simplex method exploits exactly this: stand at a vertex, find an edge along which profit rises, walk it, and repeat until no ascending edge remains. Convexity guarantees that this local optimum is the global one.

feasible polytope objective c optimal vertex x₁ x₂
Formal definition
$$\max_{x}\; c^\top x \quad \text{s.t.} \quad Ax \le b,\; x \ge 0$$

$x$ holds the decisions (how much of each product to make), $c$ the unit profits, $A_{ij}$ how much of resource $i$ one unit of product $j$ consumes, and $b$ the available stock. Its dual is:

$$\min_{y}\; b^\top y \quad \text{s.t.} \quad A^\top y \ge c,\; y \ge 0$$

Each component of $y$ corresponds to one constraint of the original problem and means that resource's shadow price: one more ton of steel buys you how much extra profit. Strong duality says that whenever the primal has an optimum, the two optimal values are equal.

Why it is beautiful

Duality is the model case of "one fact stated two ways": the primal asks "how much can I earn at most?", the dual asks "what is this pile of resources worth at least?" — and the answers must coincide, because the ceiling on profit is the value of the resources.

The deeper beauty is verifiability: any feasible $y$ hands you an upper bound, any feasible $x$ a lower bound, and when the two meet, optimality has been proved — no further search required. A footnote worth keeping: the simplex method is exponential in the worst case yet takes near-linear steps in practice. That mismatch between guarantee and behaviour is a classic lesson of the field.

Applications

Airline crew rostering (single models routinely carry hundreds of thousands of variables) and power-grid unit commitment — the electricity price you pay is literally a dual variable. In computing: integer programs solve their LP relaxation first to obtain bounds, which is the engine of branch and bound; the dual form of the SVM is what makes kernel methods possible; reinforcement learning can be written as an LP over occupancy measures, where the dual variables are exactly the value function — the Bellman equation and LP duality are one thing written twice.

Essence & question
The point of linear programming is not that you can solve it, but that optimality can be verified on the spot by a dual certificate.
What is the shadow price of the bottleneck resource on your team — how much extra output does one more person-day buy? And if a resource's shadow price is zero, what does that tell you?

Max-Flow Min-Cut

Duality incarnate in the combinatorial world
Graph · Combinatorics
Intuition

Think of the network as plumbing: water leaves the source $s$, arrives at the sink $t$, and every pipe has a capacity. How much can you push through?

The procedure is naive — keep hunting for a path that can still take a little more water, saturate it, look for the next, stop when none remains. What is remarkable is the moment it stops: slice the network into two halves ($s$ on one side, $t$ on the other) and the total capacity of the severed pipes exactly equals the water you were able to send. The bottleneck is never one pipe; it is a set of pipes — a cut.

min cut 6 + 9 = 15 s a b c d t 10 8 3 6 9 7 9 max flow = 15
Formal definition
$$\max_{f}\; |f| \;=\; \min_{(S,T)}\; \sum_{u\in S,\, v\in T} c(u,v)$$

On the left: the largest value $|f|$ over all flows respecting capacities and conserving flow at every intermediate node (in equals out). On the right: the smallest total capacity of edges pointing from $S$ to $T$, over all partitions $(S,T)$ that separate $s$ from $t$. The theorem says the two are always equal.

Why it is beautiful

This is LP duality reincarnated in combinatorics, and it arrives with a bonus: integrality. When all capacities are integers, some maximum flow is integral — no "2.5 units of flow", an answer perfectly legal in an LP and meaningless on the ground. The reason is the total unimodularity of the incidence matrix, which forces every vertex of the polytope onto a lattice point.

So one theorem collapses a whole family of theorems: maximum bipartite matching is a special case (which yields König's theorem, maximum matching = minimum vertex cover), and Menger's theorem is another projection of it. You thought you were solving different problems; you were solving one.

Applications

Image segmentation: treat pixels as nodes and neighbour similarity as capacity, and the minimum cut is the most natural foreground/background boundary — graph cuts carried segmentation before deep learning and still sit at the core of CRF post-processing. Elsewhere: inter-datacenter traffic engineering, CDN bandwidth allocation, project selection. Asking "how much throughput can this architecture carry?" is, mathematically, a search for the minimum cut.

Essence & question
A system's capacity equals the cheapest single slice that separates it in two.
What is the "minimum cut" of the system you own — which set of components (not which single one) has to fail together before service is actually severed? Is your redundancy sitting on that cut, or somewhere that was never tight?

Queueing Theory & Little's Law

The mathematics of waiting
Applied Probability
Intuition

A motorway running at 90% average utilisation sounds like it still has headroom, yet it crawls. Why? Because cars do not arrive evenly. Enough on average is not enough at every instant; momentary crowding builds a backlog, and a backlog can only be drained during idle time — the higher the utilisation, the less idle time, the less the backlog dissipates.

So the pain of queueing does not grow linearly; it explodes towards infinity as utilisation $\rho$ approaches 1. Going from 50% to 60% is imperceptible; going from 90% to 95% doubles the wait.

ρ=0.5 ρ=0.8 ρ=0.9 ρ→1 0 W ρ wait ∝ 1/(1−ρ)
Formal definition
$$L = \lambda W$$

$L$ is the average number of customers in the system, $\lambda$ the average arrival rate (per second), $W$ the average time each customer spends inside. For the simplest M/M/1 queue (Poisson arrivals, exponential service, one server):

$$W = \frac{1}{\mu-\lambda} = \underbrace{\frac{1}{\mu}}_{\text{service}} \cdot \underbrace{\frac{1}{1-\rho}}_{\text{congestion}},\qquad \rho=\frac{\lambda}{\mu}$$

$\mu$ is the service rate, so $1/\mu$ is what the job should have cost with nobody queueing; the second factor is the amplification queueing adds — 10× at $\rho=0.9$, 100× at $\rho=0.99$.

Why it is beautiful

Little's Law is almost unreasonably general: it needs to know nothing about the arrival or service distributions, whether the discipline is first-come-first-served, or how many servers there are. Long-run stability is the only requirement. The reason is that it is really a conservation law — the area "customers × time" integrated two ways: once by customer, once by instant. Very few assumptions, very strong conclusion is a rare combination in mathematics.

Kingman's formula goes further: waiting time is also proportional to the coefficients of variation, $(c_a^2+c_s^2)/2$. Reducing variance and adding capacity are two knobs on the same quantity — which is why smoothing bursts, standardising request sizes, and isolating long-tail work often beat buying machines.

Applications

This is the foundation of capacity planning in distributed systems: why SREs target 60–70% CPU rather than 95%; why P99 tail latency is governed by $\rho$ rather than by the mean; why "power of two choices" in load balancing cuts queue lengths so sharply. Continuous batching and KV-cache contention in LLM inference serving are a multi-class queueing problem — the throughput-versus-tail-latency trade is a choice of point on this hyperbola.

Essence & question
The last 10% of utilisation is paid for with waiting that tends to infinity.
If your service halved its variance with capacity untouched, how would perceived latency change? And why is smoothing demand usually cheaper than scaling out, yet teams reach for scaling first?

Scheduling & Approximation Guarantees

Changing the question in the face of hardness
Combinatorial Optimization
Intuition

Assign $n$ jobs to $m$ machines so that the last machine finishes as early as possible (the makespan). With just two machines this already amounts to splitting a pile of numbers into two piles of nearly equal sum — NP-hard.

The operations-research response is not to give up but to change the question: stop demanding the optimum, demand a guarantee of being close to it. The crudest rule — hand each arriving job to whichever machine is least busy — already guarantees no worse than $2-1/m$ times optimal; sorting jobs longest-first (LPT) tightens the guarantee to roughly $4/3$. Big rocks first, sand into the gaps — an everyday instinct, now a theorem.

arbitrary order: makespan = 9 M1 M2 M3 9 LPT (longest first): makespan = 8 = optimal M1 M2 M3 8
Formal definition
$$C_{\max}^{\text{LPT}} \;\le\; \left(\frac{4}{3}-\frac{1}{3m}\right) C_{\max}^{*}$$

$C_{\max}$ is the makespan, the star marks the optimal value, $m$ is the number of machines. Inequalities of this shape are approximation ratios: on any input the algorithm stays within a constant factor of optimal — not on average, but as a worst-case promise.

The proof needs only two lower bounds: the optimal makespan is at least "total work ÷ machines" and at least "the longest single job"; and the machine that finishes last cannot have started later than the average load.

Why it is beautiful

This is where complexity theory shakes hands with engineering. NP-hardness says "do not expect the optimum"; approximation answers "then let the imprecision be quantified and guaranteed". The question shifts from "can it be solved?" to "how good a promise can I make?" — a victory at the level of problem definition.

It also throws in a counter-intuitive gift: Graham's anomalies. Adding machines, shortening a job, or relaxing a precedence constraint can each lengthen the makespan. In any system with a scheduler, "local improvement must improve the whole" is simply false.

Applications

Instruction scheduling in compilers, GPU kernel placement and operator fusion, DAG scheduling in Spark and Flink, bin-packing and preemption in Kubernetes and Borg. Minimising pipeline bubbles in LLM training is scheduling with precedence constraints: why slicing micro-batches finer fills the bubbles is answered by the same lower-bound analysis.

Essence & question
When the optimum is out of reach, "provably not much worse" becomes the new optimum.
Do you already run LPT on your own day — biggest rock first? When does that strategy break down? (Hint: when jobs have dependencies, or when the big job's duration estimate is itself unreliable.)

Going Deeper

LP dual variables are shadow prices, and value functions in the Bellman equation are dual variables too — how far does the correspondence go?
In the LP formulation of reinforcement learning, the primal maximises expected return over an occupancy measure, the dual variables are precisely the state values $V(s)$, and the dual constraints are the Bellman inequalities; complementary slackness says an optimal policy places probability only on actions where equality holds — that is, greedily. This explains why policy iteration so closely resembles simplex: each step swaps one action at one state (a change of basis), improving monotonically and terminating in finitely many steps. But with continuous state the LP becomes infinite-dimensional, and once function approximation enters, strong duality fails — that fracture is the source of much of deep RL's instability.
How far does the "integrality miracle" of max-flow min-cut generalise?
The root cause is total unimodularity of the constraint matrix: every square minor has determinant $0,\pm 1$, so the polytope's vertices land on lattice points automatically and the LP relaxation is already the combinatorial optimum, no rounding needed. Flows, bipartite matching, and shortest paths all share this. Add a constraint like "each node used at most once" (general matching, the travelling salesman) and the matrix stops being unimodular, the relaxation returns half-integral solutions, and cutting planes become the only remedy. Hence a rule of thumb: judging whether a combinatorial problem is easy or hard is often equivalent to judging the shape of its polytope.
Why is the optimum computed by operations research so often ignored in practice?
An objective function is a projection of reality, and a projection necessarily discards things: robustness, fairness, human preference, the flexibility you were saving for next quarter. A solution wedged exactly against every constraint boundary can collapse under a small perturbation far worse than a mediocre but sturdy one — which is exactly why robust optimisation and stochastic programming exist. Saaty's line is about this: the value of the discipline is not in the word "optimal" but in forcing you to write implicit trade-offs down as explicit objectives and constraints.
Is there one idea behind all four concepts?
Yes, and it is called the bound. LP duality supplies verifiable upper and lower bounds; max-flow min-cut is that bound achieving equality on a combinatorial structure; approximation algorithms abandon equality but keep the ratio finite; queueing theory delivers bounds in the stochastic sense. The temperament of the field follows: it rarely aims to "solve the world exactly", it keeps asking "what can I prove must hold". For anyone building systems that transfers better than any single algorithm — capacity planning, SLO setting, cost estimation are all acts of drawing a defensible bound around an uncertain reality.