Algorithm Design

Linear Programming: Geometry, Duality, Production Planning & Robust Regression

16:09

Plays from YouTube. Watch on YouTube

How can one optimization method allocate shipments, balance production, and fit a line to data?

Meet Linear Programming: a mathematical language for finding the best decision subject to linear constraints.

We start with network flow and minimum-cost routing, then identify what makes a problem linear: a weighted-sum objective and linear equality or inequality constraints. We convert minimization, equalities, and unrestricted variables into a standard form suitable for LP solvers.

From there, we enter the geometry. Intersecting halfspaces produces a feasible polyhedron, and a small two-variable example shows how an objective line reaches an optimal corner. We contrast simplex pivots with interior-point methods and distinguish practical speed from worst-case guarantees.

Then we derive primal–dual pairs, prove weak duality, and construct matching lower and upper bounds. Complementary slackness explains why some constraints bind while others have zero dual prices.

Next, we plan production for an illustrative ice-cream factory. Demand changes month to month, so the model balances changes in production against inventory storage. We show how to replace absolute production changes with two nonnegative variables.

Finally, we compare least squares with least-absolute-deviation regression on a synthetic dataset with one outlier. Auxiliary error variables turn the absolute-loss objective into a linear program, revealing how the choice of loss changes the fitted line.

The big idea: define variables precisely, translate feasibility into constraints, optimize the right quantity, and use certificates to understand why an answer is optimal.

Algorithms explained visually, one concept at a time.