Quadratic and Geometric Programming
General nonlinear programs must be attacked iteratively, but two families are special: their structure is rich enough to be interesting and rigid enough to be solved almost exactly. A quadratic program has a quadratic objective and linear constraints, so its KKT conditions collapse into a linear system plus a complementarity rule — a problem the simplex machinery can be bent to solve in finitely many pivots. A geometric program minimises a posynomial, and a remarkable duality turns the search for the optimal design into a small linear system for the cost fractions — often giving the optimal value before any variable is known. This chapter develops both.
- The quadratic program — a quadratic objective \(\tfrac12\mathbf{x}^{\top}\mathbf{Q}\mathbf{x} + \mathbf{c}^{\top}\mathbf{x}\) over linear constraints — and when it is convex.
- How the KKT conditions of a QP reduce to a linear complementarity problem: linear equations plus the rule \(\lambda_i s_i = 0\).
- The KKT matrix that solves an equality-constrained QP in one shot.
- Wolfe's method — phase-one simplex with restricted basis entry to enforce complementarity.
- Posynomials, the geometric programming problem, and the AM–GM inequality behind its duality.
- The degree of difficulty, the dual weights \(\delta_k\) as cost fractions, and how to recover \(\mathbf{x}^\star\) from them.
The Quadratic Programming Problem
A quadratic program (QP) is the simplest nonlinear program that is still genuinely nonlinear: the objective is quadratic, every constraint is linear. It sits exactly one step beyond the linear programs of Part 2, and it is the local model that Chapter 21's sequential methods solve at every iteration — which is why it deserves a treatment of its own.
Here \(\mathbf{Q}\) is symmetric and \(n \times n\) — any non-symmetric matrix may be replaced by \(\tfrac12(\mathbf{Q} + \mathbf{Q}^{\top})\) without changing the value of the quadratic form, so symmetry costs nothing. The feasible region is a polyhedron, exactly as in linear programming; only the objective has curvature. Setting \(\mathbf{Q} = \mathbf{0}\) recovers an LP.
Everything hinges on the definiteness of \(\mathbf{Q}\), read exactly as in Section 19-5. Since \(\nabla^2 f = \mathbf{Q}\) everywhere, \(f\) is convex iff \(\mathbf{Q}\) is positive semidefinite. A convex QP over a polyhedron is the best-behaved nonlinear program there is: any KKT point is a global minimiser, and it can be found in finitely many pivots. An indefinite \(\mathbf{Q}\) makes the problem NP-hard in general — local minima proliferate, and the methods below only certify a KKT point.
With \(\mathbf{Q} \succ 0\) the minimiser is unique. With \(\mathbf{Q}\) indefinite the feasible polyhedron may hide many local minima, and finite algorithms lose their global guarantee. Check the definiteness of \(\mathbf{Q}\) before anything else.
Unlike an LP, a QP's optimum need not sit at a vertex. If the unconstrained minimiser \(-\mathbf{Q}^{-1}\mathbf{c}\) happens to be feasible, it is the answer and no constraint matters. Otherwise the solution is pushed onto the boundary — onto a face, an edge, or a vertex — wherever the elliptical contours first touch the polyhedron.
KKT Conditions for a QP
Apply the KKT conditions of Chapter 21 to the standard QP. Attach multipliers \(\boldsymbol{\lambda} \ge \mathbf{0}\) to \(\mathbf{A}\mathbf{x} \le \mathbf{b}\) and \(\boldsymbol{\mu} \ge \mathbf{0}\) to \(\mathbf{x} \ge \mathbf{0}\), and add slacks \(\mathbf{s} \ge \mathbf{0}\) to the inequalities. The stationarity condition \(\nabla f + \mathbf{A}^{\top}\boldsymbol{\lambda} - \boldsymbol{\mu} = \mathbf{0}\) is where the magic happens: because \(f\) is quadratic, \(\nabla f = \mathbf{Q}\mathbf{x} + \mathbf{c}\) is linear in \(\mathbf{x}\).
Read what has happened. Every condition is a linear equation or a sign restriction, except the two complementarity products. Strip those away and you are left with a system of \(n + m\) linear equations in \(2(n+m)\) non-negative unknowns — precisely the shape of a linear-programming constraint set. All the nonlinearity of the original problem has been squeezed into the combinatorial statement
Each pair \((\lambda_i, s_i)\) has at most one nonzero member — a constraint is either tight (\(s_i = 0\), so it may push back with \(\lambda_i > 0\)) or slack (\(s_i > 0\), so it exerts no force and \(\lambda_i = 0\)). Solving a convex QP is solving this LCP.
The pairs are the complementary pairs; a solution in which at most one member of each pair is basic is a complementary basic feasible solution. Since the number of ways to choose one from each pair is finite, so is the search — and for convex QPs, any such solution found is globally optimal. Section 22-4 turns this observation into an algorithm.
| Complementary pair | Meaning if first is positive | Meaning if second is positive |
|---|---|---|
| \((\lambda_i,\ s_i)\) | Constraint \(i\) is active and binding | Constraint \(i\) is inactive; it carries no multiplier |
| \((\mu_j,\ x_j)\) | Variable \(x_j\) is pinned at its bound \(0\) | Variable \(x_j\) is interior to its bound; \(\mu_j = 0\) |
Equality-Constrained QP
Drop the inequalities and the combinatorics vanish. With only equalities, \(\min \tfrac12\mathbf{x}^{\top}\mathbf{Q}\mathbf{x} + \mathbf{c}^{\top}\mathbf{x}\) subject to \(\mathbf{A}\mathbf{x} = \mathbf{b}\), the Lagrangian is \(L = \tfrac12\mathbf{x}^{\top}\mathbf{Q}\mathbf{x} + \mathbf{c}^{\top}\mathbf{x} + \boldsymbol{\lambda}^{\top}(\mathbf{A}\mathbf{x} - \mathbf{b})\), and setting both blocks of partials to zero gives one symmetric linear system.
There is no iteration here at all: one factorisation and the equality-constrained QP is solved exactly, complete with its multipliers. The system is nonsingular whenever \(\mathbf{A}\) has full row rank and \(\mathbf{Q}\) is positive definite on the null space of \(\mathbf{A}\) — that is, the objective curves upward in every direction that stays feasible. Note the matrix is symmetric but indefinite (the zero block guarantees it), so a plain Cholesky factorisation will not do.
This is the engine inside almost every practical QP solver. An active-set method guesses which inequalities are tight, treats that guess (the working set) as equalities, solves the KKT system above, then repairs the guess — dropping a constraint whose multiplier came out negative (it was pushing the wrong way) or adding one that the step would have violated. Each repair is a single pivot, and the process is finite.
Wolfe's Method
Wolfe's method is the classic way to exploit the LCP structure of Section 22-2 with nothing but a simplex code. The KKT equations are linear, so introduce artificial variables \(\mathbf{a} \ge \mathbf{0}\) and run a phase-one LP that drives them to zero. If the artificials reach zero, the remaining variables satisfy the KKT equations — and if we also never let a complementary pair go basic together, they satisfy complementarity too.
This single side-rule on the entering-variable choice enforces \(\lambda_i s_i = 0\) and \(\mu_j x_j = 0\) at every iteration. The simplex method then does what it always does; the rule simply forbids some columns.
The procedure, then, is short:
- Verify \(\mathbf{Q} \succeq 0\); otherwise the method's guarantee is void.
- Write the KKT system with slacks \(\mathbf{s}\) and surpluses/multipliers \(\boldsymbol{\lambda}, \boldsymbol{\mu}\). If \(-c_j < 0\) in a stationarity row, multiply that row by \(-1\) so the artificial starts feasible.
- Add artificials \(\mathbf{a}\) to the stationarity rows and minimise \(\mathbf{1}^{\top}\mathbf{a}\) by the simplex method.
- At each pivot, apply the restricted basis entry rule; if the best candidate column is forbidden, take the next best.
- When \(\mathbf{1}^{\top}\mathbf{a} = 0\), read \(\mathbf{x}^\star\) off the basis. For a convex QP it is the global optimum; the \(\boldsymbol{\lambda}\) values are the shadow prices.
Two cousins are worth naming. Beale's method partitions variables into basic and non-basic and expresses the objective in the non-basics, choosing the entering variable by the sign of the resulting free derivative — it handles the case where the optimum is interior to a face more naturally. Lemke's complementary pivoting algorithm attacks the LCP directly with an artificial variable \(z_0\) and a clever "almost-complementary path", and it remains the standard textbook LCP solver. Modern codes have largely replaced all three with active-set and interior-point methods, but the logic — find the active set, then solve a linear system — is unchanged.
Posynomials & the GP Problem
Geometric programming (GP), developed by Duffin, Peterson and Zener in the 1960s, addresses a completely different structure: objectives built from sums of positive terms with arbitrary real exponents. Such functions describe engineering design almost perfectly — costs of material scale with area, of pumping with velocity cubed, of inventory inversely with order size.
Each \(u_k\) is a monomial (in the GP sense): a positive coefficient times a product of powers, where the exponents \(a_{ik}\) may be any real numbers — negative, fractional, whatever the physics demands. A sum of monomials is a posynomial ("positive polynomial"). Note the two standing restrictions: coefficients must be positive and variables must be strictly positive. Both are natural for a design problem in which \(x_i\) is a length, a flow rate, or a thickness.
with every \(g_m\) a posynomial. The form looks restrictive but is not: any constraint \(h(\mathbf{x}) \le d\) with posynomial \(h\) and \(d > 0\) becomes \(h(\mathbf{x})/d \le 1\), and equality constraints are allowed when both sides are monomials. A posynomial is not convex in \(\mathbf{x}\) — but under the substitution \(x_i = e^{y_i}\) each term becomes \(e^{\mathbf{a}_k^{\top}\mathbf{y} + \ln c_k}\), and a sum of exponentials of affine functions is convex. This is why GP is a convex problem in disguise, and why its local optimum is always global.
The AM–GM Inequality & the GP Dual
The whole of geometric programming rests on one classical inequality: a weighted arithmetic mean is never smaller than the corresponding weighted geometric mean.
Now play the trick. Given a posynomial \(g(\mathbf{x}) = \sum_k u_k(\mathbf{x})\) and any weights \(\delta_k\) summing to one, substitute \(U_k = u_k(\mathbf{x})/\delta_k\). The left side becomes \(\sum_k u_k = g(\mathbf{x})\) exactly, and the inequality reads
Look at the last product: the variables have collected into a single power of \(x_i\) with exponent \(\sum_k a_{ik}\delta_k\). If we insist that every one of those exponents be zero, the bound stops depending on \(\mathbf{x}\) altogether — it becomes a number, valid for every feasible design. Those two demands on the weights are the dual constraints, and maximising the resulting number is the dual problem.
subject to the normality condition \(\sum_{k} \delta_k = 1\), the orthogonality conditions \(\sum_{k} a_{ik}\,\delta_k = 0\) for each \(i = 1,\dots,n\), and \(\delta_k \ge 0\). For posynomials there is no duality gap: \(\max v(\boldsymbol{\delta}) = \min g(\mathbf{x}) = f^\star\).
Stare at what has been achieved. The primal is a nonlinear minimisation over \(n\) design variables; the dual constraints are \(n + 1\) linear equations in \(N\) weights. The nastiness has migrated from the objective into a linear system — and the dual objective involves the design variables not at all.
| Dual condition | Equation | Where it comes from |
|---|---|---|
| Normality | \(\sum_k \delta_k = 1\) | The AM–GM inequality requires weights summing to one |
| Orthogonality | \(\sum_k a_{ik}\delta_k = 0,\ \forall i\) | Kills the \(x_i\)-dependence so the bound is a constant |
| Non-negativity | \(\delta_k \ge 0\) | Weights are proportions of the total cost |
Degree of Difficulty & Recovery
The dual has \(N\) unknowns tied down by \(n + 1\) linear equations. The gap between them measures how much work is left after the linear algebra is done, and it earns its own name.
If \(D = 0\), the dual constraints determine \(\boldsymbol{\delta}^\star\) uniquely by solving a square linear system — no optimization at all, and \(f^\star = v(\boldsymbol{\delta}^\star)\) follows by substitution. If \(D > 0\) there are \(D\) free directions and the dual must genuinely be maximised (a well-behaved concave problem after taking logs).
The zero-degree-of-difficulty case is the showpiece of the subject: the optimal cost is obtained from a linear system, before a single design variable is known. And when the constraints are consistent but \(D < 0\), the dual system is over-determined and the formulation should be re-examined.
Recovering the design is the last step, and it follows from the condition under which AM–GM holds with equality — namely when all the \(U_k\) are equal. Tracing that back gives the interpretation that makes GP so useful to engineers:
Each \(\delta_k^\star\) is the fraction of the total optimal cost contributed by term \(k\). That is a design insight in its own right — it says where the money goes in an optimal design, and it is often invariant to the coefficients. Setting each monomial equal to its share \(\delta_k^\star f^\star\) yields \(N\) equations in the \(n\) unknowns \(x_i\); taking logarithms makes them linear, and any \(n\) independent ones give \(\mathbf{x}^\star\).
Constrained GPs extend the same idea. Each constraint \(g_m(\mathbf{x}) \le 1\) contributes its own block of weights \(\delta_{mk}\), the normality condition applies only to the objective's block, orthogonality runs over all blocks, and each constraint acquires a multiplier \(\lambda_m = \sum_k \delta_{mk}\) appearing in the dual objective as \(\prod_m \prod_k (c_{mk}\lambda_m/\delta_{mk})^{\delta_{mk}}\). A constraint with \(\lambda_m^\star = 0\) is inactive at the optimum — the same complementary-slackness message as Section 22-2, arriving by a different road.
Worked Examples
Problem. Classify \(f(\mathbf{x}) = 2x_1^2 + 2x_2^2 - 2x_1x_2 - 4x_1 - 6x_2\) as a standard QP and decide whether it is convex.
Solution. Match \(f = \tfrac12\mathbf{x}^{\top}\mathbf{Q}\mathbf{x} + \mathbf{c}^{\top}\mathbf{x}\). The quadratic part gives \(\mathbf{Q} = \begin{bmatrix} 4 & -2 \\ -2 & 4 \end{bmatrix}\) (the off-diagonal is \(-2\) because \(\tfrac12(q_{12} + q_{21}) = -2\) must reproduce the \(-2x_1x_2\) term), and \(\mathbf{c} = (-4, -6)^{\top}\). Leading minors: \(4 > 0\) and \(\det \mathbf{Q} = 16 - 4 = 12 > 0\), so \(\mathbf{Q} \succ 0\) by Sylvester's criterion. The QP is strictly convex — any KKT point is the global minimum.
Problem. Minimise the \(f\) of Example 1 subject to \(x_1 + x_2 \le 2\), \(x_1, x_2 \ge 0\).
Solution. First test whether the constraint bites. The unconstrained stationary point solves \(4x_1 - 2x_2 = 4\), \(-2x_1 + 4x_2 = 6\), giving \((7/3,\ 8/3)\) — whose sum is \(5 > 2\), so the constraint is violated and must be active: \(x_1 + x_2 = 2\), with \(s = 0\) and \(\lambda \ge 0\). Guessing \(x_1, x_2 > 0\) sets \(\boldsymbol{\mu} = \mathbf{0}\), and stationarity reads \(4x_1 - 2x_2 - 4 + \lambda = 0\), \(4x_2 - 2x_1 - 6 + \lambda = 0\). Subtracting eliminates \(\lambda\): \(6x_1 - 6x_2 + 2 = 0\), i.e. \(x_1 = x_2 - \tfrac13\). With \(x_1 + x_2 = 2\) this gives \(\mathbf{x}^\star = (5/6,\ 7/6)\) and \(\lambda^\star = 4 - 4(5/6) + 2(7/6) = 3\). All signs check — \(\lambda^\star = 3 > 0\), \(\mathbf{x}^\star > \mathbf{0}\) — so the guessed active set was right, and \(f^\star = -49/6 \approx -8.17\). The multiplier says each unit of extra budget in \(x_1 + x_2 \le 2\) would buy about \(3\) units of objective.
Problem. Minimise \(f = x_1^2 + x_2^2\) subject to \(x_1 + x_2 = 4\).
Solution. Here \(\mathbf{Q} = 2\mathbf{I}\), \(\mathbf{c} = \mathbf{0}\), \(\mathbf{A} = [1\ \ 1]\), \(b = 4\). The KKT matrix gives \(\begin{bmatrix} 2 & 0 & 1 \\ 0 & 2 & 1 \\ 1 & 1 & 0 \end{bmatrix}\begin{bmatrix} x_1 \\ x_2 \\ \lambda \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 4 \end{bmatrix}\). The first two rows force \(x_1 = x_2 = -\lambda/2\); the third then gives \(-\lambda = 4\), so \(\lambda^\star = -4\) and \(\mathbf{x}^\star = (2, 2)\), \(f^\star = 8\). No iteration, no line search — a single \(3\times 3\) solve. (An equality multiplier is free in sign, so \(\lambda^\star < 0\) is no cause for alarm.)
Problem. Minimise \(f(x) = \dfrac{5}{x} + 2x\) for \(x > 0\) by the GP dual.
Solution. Two terms, one variable: \(N = 2\), \(n = 1\), so \(D = 2 - 2 = 0\). Coefficients \(c_1 = 5\) (exponent \(-1\)) and \(c_2 = 2\) (exponent \(+1\)). Orthogonality: \(-\delta_1 + \delta_2 = 0\). Normality: \(\delta_1 + \delta_2 = 1\). Hence \(\delta_1^\star = \delta_2^\star = \tfrac12\) — the two terms split the optimal cost evenly. Then \(f^\star = v = \left(\tfrac{5}{1/2}\right)^{1/2}\left(\tfrac{2}{1/2}\right)^{1/2} = \sqrt{10}\cdot\sqrt{4} = \sqrt{40} \approx 6.325\). Recovery: \(u_1(x^\star) = \delta_1^\star f^\star\) means \(5/x^\star = 3.162\), so \(x^\star = 1.581\). Calculus confirms it: \(f' = -5/x^2 + 2 = 0\) gives \(x^\star = \sqrt{5/2} = 1.581\). Note the optimal cost appeared before the optimal design.
Problem. Minimise \(f(x_1, x_2) = \dfrac{8}{x_1 x_2} + 2x_1 + 4x_2\), \(x_1, x_2 > 0\).
Solution. \(N = 3\), \(n = 2\), so \(D = 3 - 3 = 0\) again. Exponent vectors: \(u_1 \sim (-1,-1)\), \(u_2 \sim (1, 0)\), \(u_3 \sim (0, 1)\). Orthogonality on \(x_1\): \(-\delta_1 + \delta_2 = 0\); on \(x_2\): \(-\delta_1 + \delta_3 = 0\); normality: \(\delta_1 + \delta_2 + \delta_3 = 1\). So \(3\delta_1 = 1\) and \(\delta_1^\star = \delta_2^\star = \delta_3^\star = \tfrac13\) — each term pays a third of the bill. Then \(f^\star = (24)^{1/3}(6)^{1/3}(12)^{1/3} = (24 \cdot 6 \cdot 12)^{1/3} = 1728^{1/3} = 12\). Recovery: \(2x_1^\star = \tfrac13(12) = 4 \Rightarrow x_1^\star = 2\); \(4x_2^\star = 4 \Rightarrow x_2^\star = 1\). Check: \(8/(2\cdot1) + 2(2) + 4(1) = 4 + 4 + 4 = 12\) ✓.
Problem. An open-top rectangular tank must hold \(100\ \text{m}^3\). Minimise its total sheet area \(S = x_1x_2 + 2x_1x_3 + 2x_2x_3\) subject to \(x_1x_2x_3 = 100\).
Solution. Eliminate the height with \(x_3 = 100/(x_1x_2)\): \(S = x_1x_2 + \dfrac{200}{x_2} + \dfrac{200}{x_1}\), a posynomial with \(N = 3\), \(n = 2\), \(D = 0\). Exponents: \((1,1)\), \((0,-1)\), \((-1,0)\). Orthogonality on \(x_1\): \(\delta_1 - \delta_3 = 0\); on \(x_2\): \(\delta_1 - \delta_2 = 0\); with normality, \(\delta_1^\star = \delta_2^\star = \delta_3^\star = \tfrac13\). Then \(S^\star = (3)^{1/3}(600)^{1/3}(600)^{1/3} = (1{,}080{,}000)^{1/3} \approx 102.6\ \text{m}^2\). Recovery: \(200/x_1^\star = \tfrac13(102.6) = 34.2\) gives \(x_1^\star = 5.85\ \text{m}\), likewise \(x_2^\star = 5.85\ \text{m}\), and \(x_3^\star = 100/34.2 = 2.92\ \text{m}\). The design rule falls out of the weights: base and sides each absorb a third of the material, and the optimal tank is square in plan and half as deep as it is wide — a conclusion independent of the required volume.
Chapter Summary
Quadratic objective, linear constraints; \(\mathbf{Q} \succeq 0\) makes it convex, and then any KKT point is global.
All the QP's conditions are linear except \(\lambda_is_i = 0\) and \(\mu_jx_j = 0\) — the nonlinearity is purely combinatorial.
Guess the active set, solve the KKT matrix \(\begin{bmatrix}\mathbf{Q} & \mathbf{A}^{\top}\\ \mathbf{A} & \mathbf{0}\end{bmatrix}\), repair the guess; Wolfe does it by restricted-entry simplex.
Sums of positive terms with real exponents; non-convex in \(\mathbf{x}\) but convex under \(x_i = e^{y_i}\), so local = global.
AM–GM plus normality and orthogonality gives \(v(\boldsymbol{\delta}) = \prod_k (c_k/\delta_k)^{\delta_k}\) with no duality gap.
\(D = N - n - 1\); when \(D = 0\) the weights — and hence \(f^\star\) — come from a linear system, and \(u_k(\mathbf{x}^\star) = \delta_k^\star f^\star\) recovers the design.
Problems
For the QPs, form \(\mathbf{Q}\), test definiteness, and write the KKT conditions before solving. For the GPs, always count \(D\) first. Difficulty rises down the list.
- Write \(f(x_1,x_2) = 3x_1^2 + 4x_1x_2 + 2x_2^2 - x_1 + 5x_2\) in the standard form \(\tfrac12\mathbf{x}^{\top}\mathbf{Q}\mathbf{x} + \mathbf{c}^{\top}\mathbf{x}\), and decide whether the QP is convex.
- Explain why a QP's optimum, unlike an LP's, need not occur at a vertex of the feasible region. Sketch a case where it lies strictly inside.
- State the full KKT system for \(\min \tfrac12\mathbf{x}^{\top}\mathbf{Q}\mathbf{x} + \mathbf{c}^{\top}\mathbf{x}\) s.t. \(\mathbf{A}\mathbf{x} \le \mathbf{b},\ \mathbf{x} \ge \mathbf{0}\), and identify the complementary pairs.
- Minimise \(f = x_1^2 + x_2^2 - 6x_1 - 8x_2\) subject to \(x_1 + x_2 \le 5\), \(x_1, x_2 \ge 0\), by testing whether the unconstrained minimiser is feasible first.
- Solve \(\min\ x_1^2 + 2x_2^2\) s.t. \(x_1 + x_2 = 3\) using the KKT matrix, and interpret the multiplier.
- State the restricted-basis-entry rule of Wolfe's method and explain precisely which KKT condition it enforces.
- Set up (do not solve) Wolfe's phase-one LP for \(\min\ 2x_1^2 + x_2^2 - 2x_1x_2 - 4x_1\) s.t. \(x_1 + x_2 \le 3\), \(x_1, x_2 \ge 0\).
- Show that a posynomial need not be convex in \(\mathbf{x}\), but that \(g(e^{y_1},\dots,e^{y_n})\) is convex in \(\mathbf{y}\).
- Find the degree of difficulty of \(f = 4x_1x_2^{-1} + 3x_1^{-2}x_2 + 2x_1x_2\), and of \(f = x_1^{-1}x_2^{-1} + x_1 + x_2 + x_1x_2\).
- Minimise \(f(x) = 3x^{-2} + 12x\) for \(x > 0\) using the GP dual, then verify with calculus.
- Minimise \(f(x_1,x_2) = \dfrac{16}{x_1x_2} + x_1 + 4x_2\) by the dual; give \(\boldsymbol{\delta}^\star\), \(f^\star\), and \(\mathbf{x}^\star\).
- A closed cylindrical can of volume \(V\) is to use minimum sheet metal. Formulate the area as a posynomial in radius and height, solve by GP, and show that the optimal height equals the diameter — for every \(V\).
- Prove that \(\delta_k^\star = u_k(\mathbf{x}^\star)/f^\star\) by identifying when the AM–GM inequality holds with equality, and explain why this makes the dual weights a design insight rather than an algebraic artefact.