Linear programming (LP), also called linear optimization, is the problem of minimizing or maximizing a linear objective function subject to a finite set of linear equality and inequality constraints on continuous decision variables. Optimization of this kind sits at the foundation of artificial intelligence and operations research: it supplies exact solvers for resource allocation, a relaxation tool for integer problems, and a building block inside planning, scheduling and machine learning pipelines.
A linear program is usually written in standard form as minimize c^T x subject to Ax = b and x >= 0, where x is the vector of decision variables, c holds the cost coefficients, A is the constraint matrix and b is the right-hand side. Because both the objective and the constraints are linear, the problem is convex, so any local optimum is also a global optimum, and modern solvers handle models with millions of variables routinely.
How a linear program is structured
Every linear program consists of decision variables, a linear objective and linear constraints. The constraints carve the variable space into a convex polyhedron called the feasible region; each inequality defines a half-space, and their intersection holds every admissible solution.
The central geometric fact is that if a finite optimum exists, at least one optimal solution lies at a vertex of the polyhedron. This property is what makes exact algorithms possible: instead of searching a continuous space, a solver can move between a finite number of basic feasible solutions. The table below summarizes the components and their roles.
| Component | Notation | Role in the model |
|---|---|---|
| Decision variables | x in R^n | Quantities the solver chooses |
| Objective coefficients | c | Cost or profit per unit of each variable |
| Constraint matrix | A | Linear relations among variables |
| Right-hand side | b | Capacities, demands or budgets |
| Bounds | l <= x <= u | Simple limits on single variables |
A linear program has exactly one of three outcomes: it is optimal, infeasible (no point satisfies all constraints) or unbounded (the objective improves without limit). Reliable solvers report which case applies and can return a certificate of infeasibility that explains why.
Duality and sensitivity in linear programming
Every linear program, called the primal, has a paired dual program whose variables are prices attached to the primal constraints. Strong duality guarantees that when either problem has a finite optimum, both optimal values are equal. This result follows from Lagrangian duality and makes the optimality conditions easy to verify.
The dual variables, known as shadow prices, measure how much the optimal objective changes per unit increase in a constraint right-hand side. Complementary slackness states that a constraint with slack has a zero shadow price, while a binding constraint can carry a positive one. Analysts use this sensitivity information to see which resources limit performance.
| Primal element | Dual element | Interpretation |
|---|---|---|
| Minimize objective | Maximize objective | Bounds approach from both sides |
| Constraint i | Dual variable y_i | Price of resource i |
| Variable j >= 0 | Constraint j <= c_j | Reduced cost must be nonnegative |
| Binding constraint | Possibly nonzero price | Resource is a bottleneck |
| Slack constraint | Zero price | Extra resource has no value |
Algorithms that solve linear programs
Three algorithm families dominate practice. The simplex algorithm, introduced by George Dantzig in 1947, pivots from vertex to adjacent vertex while improving the objective. Interior-point methods, made practical after Karmarkar’s work in 1984, follow a central path through the interior of the feasible region. First-order methods such as PDLP use only matrix-vector products and scale to very large, sparse instances on GPUs.
The choice involves real trade-offs. Simplex has exponential worst-case complexity but is fast in practice and supports warm starts after small model changes. Interior-point methods run in polynomial time and excel on large models, but they require a crossover step to obtain an exact vertex solution.
| Algorithm | Complexity | Strength | Weakness |
|---|---|---|---|
| Primal or dual simplex | Exponential worst case | Warm starts, exact vertices | Slow on some huge models |
| Interior-point method | Polynomial | Robust on large sparse models | Dense factorizations, no warm start |
| First-order PDLP | Iteration count grows with accuracy | GPU friendly, low memory | Moderate precision only |
| Ellipsoid method | Polynomial | Theoretical importance | Impractically slow |
Linear programming among related optimization problems
Linear programming is the simplest member of a larger family. Adding integrality requirements turns it into integer programming or mixed-integer linear programming, which are NP-hard and solved by branch and bound, where the LP relaxation provides bounds at each node. Adding a quadratic objective gives quadratic programming, and allowing nonlinear functions leads to nonlinear programming.
| Problem class | Objective | Variables | Typical difficulty |
|---|---|---|---|
| Linear programming | Linear | Continuous | Polynomial time |
| Mixed-integer linear programming | Linear | Some integer | NP-hard |
| Quadratic programming | Quadratic | Continuous | Polynomial if convex |
| Convex optimization | Convex | Continuous | Polynomial in most cases |
| Nonlinear programming | General | Continuous | Local optima only |
Uses of linear programming in AI and data systems
In artificial intelligence, linear programs appear in several roles. Exact MAP inference in some graphical models is cast as an LP relaxation. Optimal transport between discrete distributions, the basis of the Wasserstein distance, is a linear program. Reinforcement learning formulates Markov decision processes as LPs over occupancy measures, and L1-regularized regression can be solved as an LP.
- Resource allocation of compute budgets, GPU clusters or advertising spend
- Supply chain planning that combines demand forecasts with capacity limits
- Fairness constraints imposed on model decisions or rankings
- Verification of neural networks through LP relaxations of ReLU activations
Limitations and common modeling mistakes
The main limitation is strict linearity. Economies of scale, fixed setup costs and yes-or-no decisions cannot be expressed without integer variables or piecewise approximations. Data uncertainty is another issue: an optimal LP solution often sits on a vertex and can be fragile to small coefficient errors, which motivates robust and stochastic formulations.
Practitioners also encounter numerical problems. Coefficients that span many orders of magnitude, such as 0.0001 next to 10,000,000, cause poor conditioning; scaling the model to keep coefficients within a few orders of magnitude is a standard fix. Rounding a fractional LP solution to integers is a frequent error, because the rounded point may be infeasible or far from optimal.
The short version
Linear programming is a method for making the best choice under limits. You state what you want to maximize or minimize, such as profit or cost. You also list your limits, such as hours, money or materials. Each limit must be a simple straight-line rule.
A solver then searches all allowed plans. It finds the corner of the allowed area where the goal is best. Think of a farmer with fixed land and water who wants the most valuable mix of crops. The method gives a provably best answer, not just a good guess.
Where it makes a difference
A cloud provider must assign machine learning training jobs to four data centers every hour. Each site has limited GPU hours, power capacity and network bandwidth, and electricity prices differ by region. The planning team models the task as a linear program with about 40,000 variables and 12,000 constraints, where each variable is the share of a job placed at a given site.
An interior-point solver returns the optimal plan in under two seconds. The dual prices show that power capacity at one site is the binding constraint, worth about four times the cost of extra bandwidth. Based on this shadow price analysis, the team schedules a power upgrade there and cuts hourly energy spending by roughly 8 percent while meeting every deadline.