Mehmet Emre Tiryaki
Back to Notes

Optimization

Throughout, f:Rn→Rf : \mathbb{R}^n \to \mathbb{R}.

First-Order Condition

For an extremum point x∈Rnx \in \mathbb{R}^n of a differentiable ff,

∇xf(x)=0⃗,0⃗∈Rn\nabla_x f(x) = \vec{0}, \quad \vec{0} \in \mathbb{R}^n

Second-Order Condition

For a point xx with ∇xf(x)=0⃗\nabla_x f(x) = \vec{0},

  • if ∇x2f(x)\nabla_x^2 f(x) is positive definite, the function is locally convex at xx →\to local minimum,
  • if ∇x2f(x)\nabla_x^2 f(x) is negative definite, the function is locally concave at xx →\to local maximum.

Note if f:R→Rf : \mathbb{R} \to \mathbb{R}, then ∇f=f′\nabla f = f' and ∇2f=f′′\nabla^2 f = f''. Also only for f:R→Rf : \mathbb{R} \to \mathbb{R}, ∇x2f\nabla_x^2 f being positive definite means f′′(x)>0f''(x) > 0, and negative definite means f′′(x)<0f''(x) < 0.

Global Extrema

Not so simple, but

  • convex function   ⟹  \implies any local minimum is a global minimum,
  • concave function   ⟹  \implies any local maximum is a global maximum.

See convexity.

Lagrange Multipliers

Let

  • x∈Rnx \in \mathbb{R}^n (point),
  • f:Rn→Rf : \mathbb{R}^n \to \mathbb{R} (objective function),
  • g:Rn→Rmg : \mathbb{R}^n \to \mathbb{R}^m (mm many equality constraints),
  • λ∈Rm\lambda \in \mathbb{R}^m (one Lagrange multiplier per constraint).

We want to solve

min⁡ (or max) f(x)s.t.g(x)=0\min \text{ (or max) } f(x) \quad \text{s.t.} \quad g(x) = 0

or the same thing with scalar valued functions, g1(x)=0,…,gm(x)=0g_1(x) = 0, \ldots, g_m(x) = 0. Define the Lagrangian

L(x,λ)=f(x)+λTg(x)=f(x)+∑i=1mλigi(x)\mathcal{L}(x, \lambda) = f(x) + \lambda^T g(x) = f(x) + \sum_{i=1}^{m} \lambda_i g_i(x)

Then if xx is an extremum (and the constraint gradients ∇gi(x)\nabla g_i(x) are linearly independent), there is a multiplier λ\lambda such that

  1. ∇xL(x,λ)=∇xf(x)+∇xg(x)Tλ=∇xf(x)+∑i=1mλi∇xgi(x)=0\nabla_x \mathcal{L}(x, \lambda) = \nabla_x f(x) + \nabla_x g(x)^T \lambda = \nabla_x f(x) + \sum_{i=1}^{m} \lambda_i \nabla_x g_i(x) = 0 (stationarity),
  2. g(x)=0⃗g(x) = \vec{0}, i.e. gi(x)=0g_i(x) = 0 for all ii (feasibility).

KKT Conditions

Let

  • x∈Rnx \in \mathbb{R}^n (point),
  • f:Rn→Rf : \mathbb{R}^n \to \mathbb{R} (objective function),
  • g:Rn→Rmg : \mathbb{R}^n \to \mathbb{R}^m (mm many equality constraints),
  • h:Rn→Rph : \mathbb{R}^n \to \mathbb{R}^p (pp many inequality constraints),
  • λ∈Rm\lambda \in \mathbb{R}^m (one Lagrange multiplier per equality constraint),
  • μ∈Rp\mu \in \mathbb{R}^p (one Lagrange multiplier per inequality constraint).

We want to solve

min⁡f(x)s.t.g(x)=0,h(x)≤0\min f(x) \quad \text{s.t.} \quad g(x) = 0, \quad h(x) \le 0

(to maximize, minimize −f-f).

L(x,λ,μ)=f(x)+λTg(x)+μTh(x)=f(x)+∑i=1mλigi(x)+∑i=1pμihi(x)\mathcal{L}(x, \lambda, \mu) = f(x) + \lambda^T g(x) + \mu^T h(x) = f(x) + \sum_{i=1}^{m} \lambda_i g_i(x) + \sum_{i=1}^{p} \mu_i h_i(x)

The following are the KKT conditions for a point xx and multipliers λ,μ\lambda, \mu:

  1. ∇xL(x,λ,μ)=∇xf(x)+∇xg(x)Tλ+∇xh(x)Tμ=0\nabla_x \mathcal{L}(x, \lambda, \mu) = \nabla_x f(x) + \nabla_x g(x)^T \lambda + \nabla_x h(x)^T \mu = 0 (stationarity), equivalently ∇xf(x)+∑i=1mλi∇xgi(x)+∑i=1pμi∇xhi(x)=0\nabla_x f(x) + \sum_{i=1}^{m} \lambda_i \nabla_x g_i(x) + \sum_{i=1}^{p} \mu_i \nabla_x h_i(x) = 0,
  2. g(x)=0g(x) = 0, h(x)≤0h(x) \le 0 (primal feasibility),
  3. μ≥0\mu \ge 0 (dual feasibility),
  4. μTh(x)=0\mu^T h(x) = 0 (complementary slackness).

Complementary slackness means for each ii, either μi=0\mu_i = 0, meaning the constraint is not active, or hi(x)=0h_i(x) = 0, meaning the constraint is active.

For a minimum xx (under a constraint qualification, e.g. linearly independent gradients of the active constraints), there are λ,μ\lambda, \mu such that the KKT conditions hold, i.e. xx is an extremum only if the KKT conditions hold. If ff and hh are convex and gg is affine, the KKT conditions are also sufficient.