Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Principle

Consider the optimization problem

minimize⁡f0(x)subject to⁡x∈Ω \begin{array}{ll} \minimize &\quad f_0(x)\\ \st &\quad x \in \Omega \end{array}

where f0f_0 is the objective and Ω⊂Rn\Omega \subset \mathbb{R}^n is the constraint set.

Key idea : replace (1) with the unconstrained optimization problem

minimize⁡f0(x)+ρp(x)subject to⁡x∈Rn,ρ>0\begin{array}{ll} \minimize&\quad f_0(x) + \rho p(x)\\ \st & \quad x \in \mathbb{R}^n \end{array} ,\quad \rho > 0

where p:Rn→Rp:\mathbb{R}^n \rightarrow \mathbb{R} is the penalty function such that

The penalty parameter ρ\rho controls the cost of violating the constraints.

Choosing penalty functions

Recall Ω\Omega is often parameterized by equality and inequality constraints.

Ω={x∈Rn |fi(x)≤0,i=1,…,mhi(x)=0,i=1,…,p}\Omega = \left\lbrace x \in \mathbb{R}^n \:\middle\vert \begin{array}{rl} f_i(x) \leq 0&, \quad i = 1, \ldots, m\\ h_i(x) = 0&, \quad i = 1, \ldots, p \end{array}\right\rbrace

Typical choices of penalty functions: use \alert{quadratic functions}

Note that besides quadratic functions, one can consider also non-smooth penalties such as ℓ1\ell_1-norm with very interesting properties (outside the scope of this lecture).

Penalty method algorithm

We thus replace solving (1) by solving a succession of unconstrained penalized problems

minimize⁡f0(x)+ρkp(x)subject to⁡x∈Rn,ρk>0 \begin{array}{ll} \minimize&\quad f_0(x) + \rho_k p(x)\\ \st & \quad x \in \mathbb{R}^n \end{array},\quad \rho_k > 0

with increasing penalties ρ1<ρ2<…<ρk→+∞\rho_1 < \rho_2 < \ldots < \rho_k \rightarrow +\infty.

This results suggests the following algorithm.

How-to compute solutions of penalized problems?

Consider a problem with one inequality constraint f1(x)≤0f_1(x) \le 0. The quadratic penalty is

p(x)=12[max⁡(0,f1(x))]2=12[f1+(x)]2.p(x)=\tfrac12\left[\max(0,f_1(x))\right]^2 =\tfrac12 \left[f_1^+(x)\right]^2 .

How to compute the gradient of the penalty function?

A potential concern is that f1+f_1^+ is not differentiable at points where f1(x)=0f_1(x)=0. However, the penalty can be written as a composition

p(x)=γ(f1(x)),γ(y)=12[max⁡(0,y)]2.p(x)=\gamma(f_1(x)), \qquad \gamma(y)=\tfrac12 \left[\max(0,y)\right]^2 .

Although the map y↦max⁡(0,y)y\mapsto \max(0,y) is not differentiable at 0, the quadratic penalty γ\gamma is differentiable everywhere, because

γ′(y)=max⁡(0,y),\gamma'(y)=\max(0,y),

and in particular γ′(0)=0\gamma'(0)=0. Therefore, if f1f_1 is differentiable, the chain rule applies.

Using the chain rule,

∇p(x)=γ′(f1(x)) ∇f1(x)=f1+(x) ∇f1(x)={f1(x) ∇f1(x),f1(x)>0,0,f1(x)≤0.\nabla p(x) = \gamma'(f_1(x))\, \nabla f_1(x) = f_1^+(x)\,\nabla f_1(x) = \begin{cases} f_1(x)\,\nabla f_1(x), & f_1(x)>0, \\[4pt] 0, & f_1(x)\le 0 . \end{cases}

Thus the quadratic penalty is differentiable (but not twice differentiable) even at points where the constraint is active, and its gradient is given by the expression above.

Examples

A simple problem

Consider the (very) simple problem

minimizexsubject tox≥1\begin{split} \text{minimize}&\quad x \\ \text{subject to}&\quad x\geq 1 \end{split}

and solve it using the penalty method.

Minimum-norm solution of linear equations

Using the penalty method, solve the following problem:

minimize12∥x∥22subject toAx=b\begin{split} \text{minimize}&\quad \frac{1}{2} \Vert x\Vert_2^2 \\ \text{subject to}&\quad Ax = b \end{split}

A nonconvex 1D example

We consider the following nonconvex optimization problem

minimize⁡(x1−1)2+(x2+1)2subject to⁡x12+x22−sin⁡(3x1)cos⁡(2x2)−2≤0\begin{array}{ll} \minimize & \quad (x_1-1)^2 + (x_2+1)^2\\ \st&\quad x_1^2+x_2^2 - \sin(3x_1)\cos(2x_2) -2\leq 0 \end{array}

The feasible set of this problem is nonconvex, as shown by the plot below (green area).

Source
<Figure size 1000x800 with 1 Axes>

Let us display how the penalized cost function will look for different values of ρ\rho.

Source
<Figure size 1200x400 with 4 Axes>

We can iteratively minimize penalized problems with increasing penalty parameter ρ\rho. Let’s do this numerically and plot the results.

Source

Solutions for increasing rho:
rho=   1:  x=[ 1.38285633 -0.93313364],  f_1(x)=0.5369100930598791
rho=   2:  x=[ 1.29431356 -0.86992303],  f_1(x)=0.3184002494305595
rho=   5:  x=[ 1.22615353 -0.8057165 ],  f_1(x)=0.13185377660643813
rho=  10:  x=[ 1.20427496 -0.78335207],  f_1(x)=0.06577643106933301
rho= 100:  x=[ 1.18560937 -0.76388718],  f_1(x)=0.006543126703541777
<Figure size 1000x800 with 1 Axes>

In the limit of large ρ\rho, we would get the (unique) solution to the initial problem. Stopping at a given ρ\rho value gives an approximation of that point, characterized by the value of f1(x)f_1(x), which quantifies “how much” we are violating the constraint.