Hyoungseo Son
Convex Optimization
Contents · Convex Optimization

Part 0 · Convexity

Part 1 · Quadratic Programs

Part 4 · Descent

  • Descent: Gradient, Newton, Interior-Point

Part 4 · Descent

Descent: Gradient, Newton, Interior-Point

Every physics solver and every control step is an optimizer wearing a costume. A contact solve, a QP for a torque, an MPC horizon: each reduces to move the current guess downhill until the residual is small. How fast that happens is set by two choices, how much curvature you use and how you respect constraints.

Gradient descent: first order

Gradient descent follows the steepest slope with a scalar step α\alpha,

xk+1=xkαf(xk).x_{k+1} = x_k - \alpha\,\nabla f(x_k).

On a strongly convex quadratic f(x)=12xQxf(x) = \tfrac{1}{2}x^{\top}Qx with eigenvalues μ=λmin\mu = \lambda_{\min} and L=λmaxL = \lambda_{\max}, the optimal fixed step α=2/(L+μ)\alpha = 2/(L+\mu) contracts the error by a fixed factor each step,

xk(κ1κ+1)kx0,κ=Lμ.\lVert x_{k} \rVert \le \left(\frac{\kappa - 1}{\kappa + 1}\right)^{k}\lVert x_0 \rVert, \qquad \kappa = \frac{L}{\mu}.

A single scalar α\alpha cannot match two different curvatures at once. As κ\kappa \to \infty the rate 1\to 1 and the iterates zigzag across the narrow valley, taking many steps to crawl along its floor.1

Newton: second order

Newton's method rescales the gradient by the local curvature,

xk+1=xk(2f(xk))1f(xk).x_{k+1} = x_k - \big(\nabla^2 f(x_k)\big)^{-1}\nabla f(x_k).

Multiplying by (2f)1(\nabla^2 f)^{-1} makes the step affine invariant: it is unchanged if you rescale the coordinates, so the condition number stops mattering. On a quadratic the model is exact and Newton reaches the minimum in one step from any start, independent of κ\kappa.2

A quadratic, by hand

Take Q=[10001]Q = \begin{bmatrix} 10 & 0 \\ 0 & 1 \end{bmatrix}, so κ=10\kappa = 10, with f(x)=Qx\nabla f(x) = Qx and 2f=Q\nabla^2 f = Q. Start at x0=[11]x_0 = \begin{bmatrix} 1 \\ 1 \end{bmatrix}, where f(x0)=[101]\nabla f(x_0) = \begin{bmatrix} 10 \\ 1 \end{bmatrix}.

One gradient step with α=1/L=0.1\alpha = 1/L = 0.1 gives

x1=[11]0.1[101]=[00.9].x_1 = \begin{bmatrix} 1 \\ 1 \end{bmatrix} - 0.1\begin{bmatrix} 10 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ 0.9 \end{bmatrix}.

The stiff coordinate (λ=10\lambda = 10) is solved, but the soft coordinate (λ=1\lambda = 1) barely moved. Pushing α\alpha up to fix x2x_2 faster overshoots x1x_1: stability caps α<2/L=0.2\alpha < 2/L = 0.2, yet the soft axis wants α1\alpha \approx 1. That gap is κ\kappa.

Newton uses Q1=[0.1001]Q^{-1} = \begin{bmatrix} 0.1 & 0 \\ 0 & 1 \end{bmatrix} and each coordinate gets its own curvature,

x1=x0Q1Qx0=[11][0.1001][101]=[11][11]=[00].x_1 = x_0 - Q^{-1}Qx_0 = \begin{bmatrix} 1 \\ 1 \end{bmatrix} - \begin{bmatrix} 0.1 & 0 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 10 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \end{bmatrix} - \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}.

One step, exactly on the minimum, for any κ\kappa.

Interior-point: descend from strictly inside

Contacts, friction cones, and actuator limits are inequality constraints gi(x)0g_i(x) \le 0. An interior-point method replaces them with a smooth log barrier that blows up at the boundary,

minx  tf(x)ilog ⁣(gi(x)).\min_x\; t\,f(x) - \sum_i \log\!\big(-g_i(x)\big).

For finite tt the barrier keeps every iterate strictly feasible; the minimizer x(t)x^{\star}(t) traces the central path. Raising tt shrinks the barrier's pull, and x(t)xx^{\star}(t) \to x^{\star} approaches the true optimum from inside the feasible set. Each recentering is a Newton solve, so a QP needs only a handful of outer iterations.2

Descent on an ill-conditioned quadraticinteractive
gradient descent
25 steps
Newton
1 step
interior-point
8 steps
iter 0/25 · f = 5.500
Level sets of f(x) = ½ xᵀQx with Q = diag(κ, 1); the κ slider stretches the valley. Gradient descent (red) takes the optimal step 2/(L+μ) and zigzags, and its step count climbs with κ. Newton (green) lands on the minimum in one step at any κ. Interior-point (blue) adds the barrier for x₁ + x₂ ≥ 1 and walks the central path to the boundary optimum (amber), staying strictly inside the shaded infeasible half-plane.

What runs inside a solver

This is the machinery behind a contact or control step, not an analogy for it. Projected Gauss-Seidel, the sequential-impulse method from the constraint-solvers article, updates one impulse at a time using the diagonal AiiA_{ii} of the Delassus operator: it is coordinate-wise descent on the contact LCP. Its rate is governed by the conditioning of AA, and a tall stack or a large mass ratio makes κ(A)\kappa(A) huge, which is exactly why PGS crawls: like gradient descent on the stretched quadratic, it needs about one sweep per unit of coupling. Newton and convex solvers instead use the full curvature to take affine-invariant steps that do not degrade with κ\kappa, and interior-point is what a QP contact model or an MPC step runs to keep non-penetration and cone constraints satisfied while descending from strictly inside. The engine's choice of solver is a bet on how badly conditioned its constraints are.

Footnotes

  1. Nocedal & Wright, Numerical Optimization (2006).

  2. Boyd & Vandenberghe, Convex Optimization (2004). 2