lpviz documentation
lpviz is a free, interactive web app for visualizing how linear programming solvers work. You draw a feasible region, aim an objective, and watch four different algorithms find the optimum — one iteration at a time, entirely in your browser.
The problem lpviz solves
Everything in lpviz is a linear program (LP): maximize a linear objective over a region cut out by linear inequalities,
maximize cᵀx subject to Ax ≤ b,
where x ∈ ℝⁿ is the decision variable (n = 2 in the main app, n = 3 in 3-variable mode), each row aiᵀx ≤ bi of Ax ≤ b is a half-plane, and c is the objective vector you aim with the arrow.
When you draw a polygon, each edge becomes one inequality constraint; the panel at the top of the sidebar shows the resulting system (the H-representation of your region). Because the feasible region is the intersection of half-planes it is always convex, and if an optimum exists, some vertex of the region attains it — the geometric fact underlying the Simplex method.
The four solvers
lpviz implements four algorithms that reach the same answer in very different ways. Each has its own page explaining the math, the exact implementation, and what to watch for on screen.
Walks from vertex to vertex along edges of the region, improving the objective at every pivot. Includes a two-phase setup and a dual simplex mode.
Interior point method (IPM)A Mehrotra-style predictor–corrector method that cuts smoothly through the interior, loosely tracking the central path.
PDHGThe primal-dual hybrid gradient method behind modern GPU solvers like PDLP. First-order steps that characteristically spiral into the optimum, with optional Halpern acceleration and restarts.
Central pathNot a solver but the smooth curve of log-barrier optimizers connecting the analytic center to the optimum — traced directly with Newton's method.
| Solver | Family | Iterates look like | Key controls |
|---|---|---|---|
| Simplex | Active-set / pivoting | Hops between vertices along edges | Dual simplex mode |
| IPM | Primal-dual interior point | A smooth arc through the interior | αmax, corrector threshold, max iterations |
| PDHG | First-order primal-dual | A spiral tightening around the optimum | η, τ, Halpern, inequality mode, color by basis |
| Central path | Log-barrier / Newton | A smooth curve from the analytic center | N (number of steps) |
Quick start
- Draw the region. Click empty space to add vertices. Close the polygon by clicking the first vertex or pressing Enter. Every edge becomes a constraint you can drag; right-click a vertex to delete it, double-click an edge to insert one.
- Aim the objective. Click inside the region to place the objective vector c, then drag the arrow to point it where the objective should increase.
- Pick a solver. Choose IPM, PDHG, Simplex, or Central Path in the sidebar. The iterates appear immediately; tune the solver's sliders and the path re-solves live.
- Inspect. The bottom terminal lists every iterate (hover a row to highlight the point); the top panel lists constraints (hover to highlight the line). Click Animate to replay the iterations, or enable Trace to keep old paths on screen while you experiment.
A gallery of preset regions (Pentagon, Corridor, Needle, Tight Corner, Many Facets, and more) is available at the top of the screen — each is chosen to stress the solvers in a different way.
3D view and 3-variable mode
lpviz has two distinct "3D" features:
- 3D view (the 3D button in the 2-variable app) tilts the camera and lifts every point to a height equal to its objective value, so a solver's path literally climbs the objective plane. Shift+scroll adjusts the height scale.
- 3-variable mode (at
lpviz.net/3d) is a full LP editor in ℝ³: sketch a base polygon, extrude it into a solid, then push/pull faces, cut corners, and bevel edges — every face is one inequality constraint. All four solvers run on the resulting 3-variable LP.
Sharing and reproducibility
The share button encodes your entire setup — region, objective, solver, and settings — into the URL, so a link reproduces the exact visualization. This makes lpviz handy for teaching: build a scenario, share the link, and everyone sees the same iterations. All computation runs client-side; nothing you draw ever leaves your browser.
FAQ
- What is linear programming?
- Optimizing a linear objective subject to linear inequality constraints. It is the workhorse of mathematical optimization, used in logistics, scheduling, finance, energy markets, and as a subroutine inside integer programming and machine learning methods.
- Why do some iterates leave the feasible region?
- That's real solver behavior, not a bug. lpviz's IPM is an infeasible-start method (it starts at the origin and gains feasibility as it converges), PDHG iterates only satisfy the constraints in the limit, and dual simplex hops between constraint intersections outside the region until optimality.
- Which solver is "best"?
- It depends on the problem. Simplex pivots are cheap and finite; interior point methods take few, expensive iterations regardless of geometry; PDHG uses only matrix–vector products, which is why it scales to enormous LPs on GPUs. Watching them on the same region is the point of lpviz.
- Does lpviz need a server?
- No. lpviz is a static site; all four solvers are implemented in TypeScript and run in a Web Worker in your browser. It is open source on GitHub.
- How do I cite lpviz?
-
@article{lpviz, title={{lpviz: Interactive Linear Programming Visualization}}, author={Grand, Evan and Klamkin, Michael}, journal={arXiv preprint arXiv:2604.27518}, year={2026} }