Linear Programming Simulator: Visualize Feasible Regions & Optimal Solutions

simulator intermediate ~10 min
Loading simulation...
Z* = 500 at (100, 0)

With default constraints b₁=100, b₂=80 and objective 5x+4y, the maximum value Z*=500 is achieved at vertex (100,0).

Formula

Maximize Z = cₓ·x + cᵧ·y
Subject to: a₁x + a₂y ≤ b₁; a₃x + a₄y ≤ b₂; x,y ≥ 0
Shadow price: λᵢ = ∂Z*/∂bᵢ

The Geometry of Optimization

Linear programming transforms real-world decision problems into geometric ones. Each constraint defines a half-space, and their intersection forms a convex polytope — the feasible region. The objective function defines a family of parallel hyperplanes; the optimal solution lies where the last hyperplane touches the polytope. This simulation lets you see this geometry unfold in two dimensions as you adjust constraints and objective coefficients.

Corner Points and the Simplex Method

Dantzig's fundamental insight was that optimality always occurs at a vertex. The simplex method exploits this by walking along edges of the polytope, improving the objective at each step. In this 2D visualization, you can see which corner point achieves the maximum and how the optimal vertex shifts as you change the objective direction or constraint boundaries.

Sensitivity and Shadow Prices

Real optimization is rarely a one-shot calculation. Decision-makers need to know: how much does the optimum change if I relax a constraint? The shadow price answers this — it is the marginal value of one additional unit of resource. Tight constraints with high shadow prices are bottlenecks worth investing in. Watch how the optimal value responds as you adjust each constraint limit.

From Textbook to Industry

LP solves problems of staggering scale: airlines schedule crews over millions of variables, oil refineries blend feeds to minimize cost, and logistics networks route shipments across continents. Modern interior-point methods solve problems with millions of variables in seconds. This 2D simulator captures the core geometric intuition behind all of it — the interplay of constraints, objectives, and vertices that defines optimal decisions.

FAQ

What is linear programming?

Linear programming (LP) is an optimization technique that finds the best outcome in a mathematical model whose requirements are represented by linear relationships. Developed by George Dantzig in 1947, it is used in logistics, manufacturing, finance, and resource allocation to maximize profit or minimize cost subject to constraints.

Why does the optimal solution occur at a vertex?

The Fundamental Theorem of Linear Programming states that if a linear program has an optimal solution, it occurs at a vertex (corner point) of the feasible polytope. This is because the objective function is linear — it cannot have an interior maximum over a convex set.

What is the simplex method?

The simplex method, invented by Dantzig, traverses vertices of the feasible polytope along edges that improve the objective function. Despite worst-case exponential time, it is extremely efficient in practice and remains the most widely used LP algorithm.

What are shadow prices in LP?

Shadow prices (dual variables) measure the rate of change of the optimal objective value per unit increase in a constraint's right-hand side. They tell you how much it is worth to relax a binding constraint — critical for resource valuation and sensitivity analysis.

Sources

Embed

<iframe src="https://homo-deus.com/lab/operations-research/linear-programming/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub