Nonlinear programming

Also known as: nonlinear optimization

On this page 8

Nonlinear programming (NLP), also called nonlinear optimization, is the branch of mathematical optimization that minimizes or maximizes an objective function subject to constraints when the objective or at least one constraint is not a linear function of the decision variables. In artificial intelligence, it is the framework behind training models with smooth losses, fitting constrained estimators, tuning control policies and allocating resources under physical or budget limits.

A nonlinear program is usually written as minimizing f(x) subject to equality constraints h(x) = 0 and inequality constraints g(x) ≤ 0, with x a vector of continuous variables. Unlike linear programming, where the optimum always sits at a vertex of a polyhedron, a nonlinear problem can have curved feasible regions, interior optima and many local optima, which changes both the theory and the algorithms.

How a nonlinear program is structured

Every nonlinear program has three components: decision variables, an objective and a set of constraints that defines the feasible region. The problem is nonlinear as soon as one of these functions involves products, powers, exponentials, logarithms or other curved relationships between variables.

The geometry of the problem determines how hard it is. When the objective is convex and the feasible region is convex, the problem is a convex nonlinear program and every local optimum is global. When either part is non-convex, solvers can converge to a local optimum or a saddle point, and certifying global optimality generally becomes computationally hard.

The table below summarizes the main problem classes inside nonlinear programming and the guarantees each one offers.

Problem classDefining featureOptimality guarantee
Unconstrained NLPSmooth objective, no constraintsLocal optimum from gradient methods
Convex NLPConvex objective and convex feasible setAny local optimum is global
Quadratic programmingQuadratic objective, linear constraintsGlobal if the Hessian is positive semidefinite
Non-convex NLPCurved objective or non-convex constraintsLocal optimum only, in general
Mixed-integer NLPSome variables restricted to integersRequires branch and bound or similar search
Main classes of nonlinear programs

Optimality conditions and the KKT system

The Karush-Kuhn-Tucker conditions are the first-order necessary conditions for a point to be a local optimum of a constrained nonlinear program. They extend the classical method of Lagrange multipliers to inequality constraints by requiring stationarity of the Lagrangian, primal feasibility, nonnegative multipliers on inequalities and complementary slackness.

Complementary slackness states that each inequality constraint is either active at the solution or carries a zero multiplier. The multiplier itself measures how much the optimal objective would improve if that constraint were relaxed slightly, which is why engineers read multipliers as shadow prices of scarce resources.

The KKT conditions hold only under a constraint qualification, such as linear independence of the active constraint gradients or the Slater condition for convex problems. Second-order conditions, based on the Hessian matrix of the Lagrangian restricted to feasible directions, separate true minima from saddle points and maxima.

Algorithms used to solve nonlinear programs

Nonlinear programming solvers are iterative methods that generate a sequence of improving points rather than a closed-form answer. They differ in how much derivative information they use, how they handle constraints and how they control step size through line search or trust regions.

The following table compares the algorithm families that practitioners meet most often in optimization work for AI and engineering.

MethodInformation usedTypical use
Gradient descent and variantsFirst derivativesLarge unconstrained losses such as neural networks
Newton’s methodGradient and HessianSmall to medium smooth problems needing fast convergence
Quasi-Newton (L-BFGS)Gradients plus curvature estimatesMedium to large smooth problems
Sequential quadratic programmingGradients, Hessian approximationConstrained engineering design
Interior-point methodsGradients, Hessian, barrier termsLarge constrained problems with many inequalities
Augmented Lagrangian and ADMMGradients and multiplier updatesDistributed or separable constrained problems
Common algorithm families for nonlinear programming

Sequential quadratic programming solves a quadratic approximation of the problem at each iterate, while interior-point methods replace inequalities with logarithmic barrier terms and follow a central path toward the solution. Mature solvers such as IPOPT, SNOPT and KNITRO implement these ideas with careful scaling, globalization and automatic differentiation for derivatives.

Nonlinear programming sits between linear programming and fully combinatorial optimization. It keeps continuous variables but abandons linearity, so it inherits rich theory from calculus while losing the clean vertex structure that the simplex algorithm exploits.

Problem typeVariablesFunctionsMain difficulty
Linear programmingContinuousAll linearScale, degeneracy
Nonlinear programmingContinuousAt least one nonlinearLocal optima, curvature, scaling
Integer programmingIntegerUsually linearCombinatorial explosion
Stochastic optimizationContinuous or discreteExpected values over randomnessNoisy gradients and estimates
How nonlinear programming differs from neighboring problem types

In machine learning, most training problems are unconstrained or simply constrained non-convex programs solved with stochastic first-order methods. Classical NLP solvers remain essential where constraints are central: support vector machine training, constrained reinforcement learning, fairness-constrained models, optimal control and model predictive control.

Practical modeling and solver choices

The formulation often matters more than the solver. Reformulating a problem into a convex form, removing redundant constraints and scaling variables to similar magnitudes can turn an unstable model into one that converges in a few dozen iterations.

The decision table below links common situations to a reasonable first choice of approach.

SituationRecommended approachReason
Millions of parameters, few constraintsStochastic gradient methodsLow cost per iteration
Smooth problem, thousands of variablesL-BFGS or trust region NewtonFast convergence with modest memory
Many inequality constraintsInterior-point solverHandles inequalities robustly at scale
Expensive black-box objectiveDerivative-free or Bayesian methodsNo reliable gradients available
Global optimum required, small modelSpatial branch and boundProvides certified bounds
Choosing an approach for a nonlinear program

Practitioners should supply exact derivatives whenever possible, since finite-difference approximations add noise and cost. They should also run multiple starting points on non-convex problems and compare the resulting objective values before trusting any single solution.

Limitations and common mistakes

The most serious limitation is that general non-convex problems are NP-hard, so no efficient algorithm guarantees the global optimum. A solver that reports success has usually found a point satisfying local optimality conditions, not proof of the best possible answer.

  • Treating a local optimum as global without testing other starting points or bounds.
  • Ignoring poor variable scaling, which produces ill-conditioned Hessians and stalled progress.
  • Using nonsmooth functions such as absolute values or maximums without reformulation, which breaks gradient-based solvers.
  • Setting tolerances too loose, which returns points that violate constraints in practice.
  • Assuming that a convergence message means the model itself is correct.

Put simply

Nonlinear programming is a way to find the best choice under rules when the relationships involved are curved, not straight. Think of hiking in fog to find the lowest valley. You can feel the slope under your feet. You cannot see the whole landscape.

Some landscapes have one valley. Then any downhill path ends in the right place. Others have many valleys. A hiker may stop in a small one and miss a deeper one nearby. That is why the shape of the problem decides how much the answer can be trusted.

In practice

A data science team at a regional power utility builds a model to schedule battery storage across 40 substations for the next 24 hours. Each hour, the model decides how much energy to charge or discharge. Battery losses grow quadratically with current, and transformer temperatures depend nonlinearly on load, so the scheduling task is a nonlinear program with about 4,000 variables and several thousand constraints.

The team writes the model in an algebraic modeling language and solves it with an interior-point solver using exact derivatives from automatic differentiation. A typical run finishes in under a minute. Because the thermal constraints are non-convex, the team solves from five starting points and keeps the best feasible schedule. Compared with the earlier rule-based schedule, the optimized plan reduces peak transformer loading by roughly 8 percent while keeping every battery within its state-of-charge limits.