最优化方法


1. Introduction to optimization

1.1. 范数

1.2. 泰勒展开

𝑓(𝑥0+𝑥)=𝑓(𝑥0)+𝑓(𝑥0)𝑥+𝑓(𝑥0)2!𝑥2+

1.3. Hessian 矩阵

2𝑓(𝑥)=(2𝑓(𝑥)𝑥122𝑓(𝑥)𝑥𝑛𝑥12𝑓(𝑥)𝑥1𝑥𝑛2𝑓(𝑥)𝑥𝑛2)

1.4. 矩阵正定的判定

  1. 𝑥,𝑥𝑇𝐴𝑥>0
  2. 各阶顺序主子式都大于0
    (负定的判定是奇数阶为负,偶数阶为正)

1.5. 矩阵逆的计算

(012214210)(100010001) 初等行变换 (111)(1214341121201414)

右侧即为逆矩阵


2. Approximation and fitting

2.1. 范数近似

min𝑥𝐴𝑥𝑏2𝐴𝑚×𝑛𝑥𝑛×1𝑏𝑚×1

求导:

𝑥((𝐴𝑥𝑏)𝑇(𝐴𝑥𝑏))=2𝐴𝑇(𝐴𝑥𝑏)
𝑓(𝑥):𝑛𝑚,𝑔(𝑥):𝑛𝑚(𝑓(𝑥)𝑇𝑔(𝑥))=𝑓(𝑥)𝑇𝑔(𝑥)+𝑔(𝑥)𝑇𝑓(𝑥)
𝑓(𝑥):𝑛,𝑔(𝑥):𝑛𝑚(𝑓(𝑥)𝑔(𝑥))=𝑔(𝑥)(𝑓(𝑥))𝑇+𝑓(𝑥)𝑔(𝑥)

3. Convex sets

3.1. affine set

集合中任意两点的连线也都在集合中 𝑥1,𝑥2𝑆, 𝜃, 𝑥=𝜃𝑥1+(1𝜃)𝑥2 also in 𝑆

3.2. convex set

集合中任意两点的连线段也在集合中 𝑥1,𝑥2𝑆, 𝜃[0,1], 𝑥=𝜃𝑥1+(1𝜃)𝑥2 also in 𝑆

3.3. convex hull

convex combination
𝑥𝑖,𝜃𝑖0 and 𝑖𝜃𝑖=1, 𝑖𝜃𝑖𝑥𝑖

convex hull is:

conv 𝑆= set of all convex combination points of 𝑆

3.4. convex cone

conic combination
𝑥1,𝑥2,𝑥𝑛, 𝜃1,𝜃2,𝜃𝑛0, 𝑖𝜃𝑖𝑥𝑖

convex cone is: set that contains all conic combinations of points in the set

3.5. simplices (单纯型)

{𝑥𝑛|𝑥𝑇𝟏=1,𝑥0}

3.6. 是 norm 函数的要求

  1. 𝑥0;𝑥=0𝑥=0
  2. 𝑡𝑥=|𝑡|𝑥 for 𝑡
  3. 𝑥+𝑦𝑥+𝑦

3.7. Positive semidefinite cone (半正定锥)

𝑆+𝑛={𝑋𝑛×𝑛|𝑋0}

为什么是锥?举个例子

(𝑥𝑦𝑦𝑧)0𝑥𝑧𝑦20

(𝑥,𝑦,𝑧)的空间上是一个锥

3.8. closure, interior and boundary

closure of 𝑆
cl(𝑆)= set of all limit points of 𝑆
interior of 𝑆
int(𝑆)={𝑥| Ball(𝑥,𝑟)𝐶,𝑟>0}
boundary of 𝑆
bd 𝑆=(𝑆)=cl(𝑆)int(𝑆)
𝑆 is convex int(𝑆) is convex and cl(𝑆) is convex

3.9. relative interior

relint(𝑆)={𝑥| Ball(𝑥,𝑟) Aff(𝐶)𝐶,𝑟>0}

and relative boundary is

cl(𝑆)relint(𝑆)

4. Convex functions

4.1. strict convex

𝑓(𝜃𝑥1+(1𝜃)𝑥2)<𝜃𝑓(𝑥1)+(1𝜃)𝑥2

4.2. strongly convex

𝑓(𝜃𝑥1+(1𝜃)𝑥2)𝜃𝑓(𝑥1)+(1𝜃)𝑓(𝑥2)12𝑐𝜃(1𝜃)𝑥2𝑥12

which is equivalent to 𝑓12𝑐2 is convex

4.3. 扩充定义域

对于不在 𝑓 定义域中的函数值定义为 +

dom 𝑓 需要是凸集

4.4. 凸函数的一阶判定条件

𝑓(𝑥)𝑓(𝑥0)+(𝑓(𝑥0))𝑇(𝑥𝑥0)

4.5. 凸函数的二阶判定条件

2𝑓(𝑥)0

矩阵𝐻正定的一个判定方法:对于任意向量𝑣,都有𝑣𝑇𝐻𝑣0

4.6. epigraph and 𝛼-sublevel set

𝛼-sublevel set
𝐶𝛼={𝑥|𝑓(𝑥)𝛼}
epigraph
epi 𝑓={(𝑥,𝑡)|𝑓(𝑥)𝑡,𝑥 dom 𝑓}epi 𝑓 is convex set 𝑓 is convex function

4.7. closed convex function

闭集(closed set)
包含其所有极限点的集合
lower semi-continuous (l.s.c)
lim𝑦𝑥𝑓(𝑦)𝑓(𝑥)
也叫下半连续
closed function
紧集 (compact set)
有界闭集

4.8. Pointwise supremum and Minimization

if 𝑓(𝑥,𝑦) is convex in 𝑥 for each 𝑦𝒜, then 𝑔 is convex

𝑔(𝑥)=sup𝑦𝒜𝑓(𝑥,𝑦)

if 𝑓(𝑥,𝑦) is convex in (𝑥,𝑦) and 𝐶 is convex set, then 𝑔 is convex

𝑔(𝑥)=inf𝑦𝐶𝑓(𝑥,𝑦)

4.9. Conjugate function (共轭函数)

𝑓(𝑦)=sup𝑥 dom 𝑓(𝑦𝑇𝑥𝑓(𝑥))

共轭函数𝑓(𝑦) 总是凸的,因为它是一系列直线的 sup

记几个例子:

𝑓(𝑦)=sup𝑥(𝑦𝑇𝑥max(𝑥))={0 if 𝑦0 and 𝑦𝑇𝟏=1+ otherwise𝑓(𝑦)=sup𝑥(𝑦𝑇𝑥𝑖=1𝑟𝑖-largest(𝑥))={0 if 𝑦0 and 𝑦𝑇𝟏=𝑟+ otherwise𝑓(𝑦)=sup𝑥(𝑦𝑥|𝑥|𝑝𝑝)=|𝑦|𝑞𝑞(where 1𝑝+1𝑞=1 and 𝑥,𝑦)

4.10. 对偶范数

𝑦=sup𝑥1𝑦𝑇𝑥

4.11. conjugate of conjugate

if 𝑓 is convex and closed

𝑓(𝑥)=𝑓(𝑥)

5. Convex optimization problems

5.1. standard form convex optimization problem

min𝑓0(𝑥)s.t. 𝑓𝑖(𝑥)0𝑖=1,,𝑚𝑎𝑖𝑇𝑥=𝑏𝑖𝑖=1,,𝑛

where 𝑓0,𝑓1,,𝑓𝑚 are convex functions

等式约束需要是线性的(要不然定义域就不是凸的了)

5.2. Optimality criterion for differentiable 𝑓0

if 𝑥 is optimal, for all feasible 𝑦

𝑓0(𝑥)𝑇(𝑦𝑥)0

不仅对于无约束问题成立(废话因为𝑓0(𝑥)=0),对于有约束问题也是成立的

5.3. Equivalent convex problems

如果一个问题的解很容易从另一个问题的解中得到,那么两个问题就是(非正式的)等价的,反之亦然 例如

min𝑥𝑓0(𝑥) s.t. 𝑓𝑖(𝑥)0𝐴𝑥=𝑏

可以等价于

min𝑧𝑓0(𝐹𝑧+𝑥0) s.t. 𝑓𝑖(𝐹𝑥+𝑧0)0where 𝐴𝑥=𝑏𝑥=𝐹𝑧+𝑥0

又例如

min𝑥𝑓0(𝐴0𝑥+𝑏0) s.t. 𝑓𝑖(𝐴𝑖𝑥+𝑏𝑖)0

可以等价于

5.4. piecewise-linear minimization

min𝑥(max𝑖(𝑎𝑖𝑇𝑥+𝑏𝑖))

等价于

min𝑥,𝑡𝑡 s.t. 𝑎𝑖𝑇𝑥+𝑏𝑖𝑡

5.5. Chebyshev center of a polyhedron

𝒫={𝑥|𝑎𝑖𝑇𝑥𝑏}={𝑥+𝑢|𝑢2𝑟}

求这个最大半径的问题可以化简成LP

max𝑟 s.t. 𝑎𝑖𝑇𝑥+𝑟𝑎𝑖2𝑏

5.6. Quadratic program (QP)

min𝑥12𝑥𝑇𝑃𝑥+𝑞𝑇𝑥+𝑟 s.t. 𝐺𝑥𝐴𝑥=𝑏

QP的不等式约束也是线性的,不等式约束是二次的叫QCQP
二阶锥规划的不等式约束形式是 𝐴𝑖𝑥+𝑏𝑖2𝑐𝑖𝑇𝑥+𝑑𝑖


6. Unconstrained minimization

6.1. 对于强凸函数

2𝑓(𝑥)𝑚𝐼𝑓(𝑦)=𝑓(𝑥)+𝑓(𝑥)𝑇(𝑦𝑥)+12(𝑦𝑥)𝑇2𝑓(𝜉)(𝑦𝑥)𝑓(𝑥)+𝑓(𝑥)𝑇(𝑦𝑥)+12𝑚𝑦𝑥22

在右侧对𝑦求最小值 𝑓(𝑥)+𝑚(𝑦𝑥)=0, 所以 𝑦=𝑥1𝑚𝑓(𝑥)

带入到右式子是𝑓(𝑥)12𝑚𝑓(𝑥)22

𝑓(𝑦)𝑓(𝑥)12𝑚𝑓(𝑥)22𝑓(𝑥)𝑝12𝑚𝑓(𝑥)22

6.2. general descent method

  1. given starting point 𝑥0
  2. repeat

    1. 计算下降方向 Δ𝑥
    2. 选择更新步长 𝑡>0
    3. 𝑥𝑥+𝑡Δ𝑥
  3. until stopping criterion is satisfied

6.3. exact line search

𝑡=argmin𝑡>0𝑓(𝑥+𝑡Δ𝑥)

6.4. backtracking line search

𝛼(0,12),𝛽(0,1)
初始时𝑡=1
不断令 𝑡=𝛽𝑡直到

𝑓(𝑥+𝑡Δ𝑥)<𝑓(𝑥)+𝑡𝛼𝑓(𝑥)𝑇Δ𝑥

6.5. gradient descent method

Δ𝑥=𝑓(𝑥)

以指数收敛:

𝑓(𝑥(𝑘))𝑝=𝑐𝑘(𝑓(𝑥(0))𝑝)

6.6. steepst descent method

normalized steepst descent direction
Δ𝑥 nsd =argmin𝑣=1𝑓(𝑥)𝑇𝑣
(unnormalized) steepst descent direction
Δ𝑥 sd =𝑓(𝑥)Δ𝑥 nsd

6.7. Newton Step

Δ𝑥 nt =(2𝑓(𝑥))1𝑓(𝑥)

因为取𝑓的二阶近似

𝑓̂(𝑥+𝑣)=𝑓(𝑥)+𝑓(𝑥)𝑣+12𝑣𝑇2𝑓(𝑥)𝑣𝑣𝑓̂(𝑥+𝑣)=𝑓(𝑥)+2𝑓(𝑥)𝑣Δ𝑥 nt =𝑣=(2𝑓(𝑥))1𝑓(𝑥)

可以认为牛顿步是2𝑓(𝑥)下的最速下降

𝑥𝑃=(𝑥𝑇𝑃𝑥)12

𝑃的对偶范数是𝑃1

6.8. Newton decrement

𝑓̂(𝑥+Δ𝑥 nt)=𝑓(𝑥)12𝑓(𝑥)2𝑓(𝑥)1𝑓(𝑥)𝑓(𝑥)𝑓̂(𝑥+Δ𝑥 nt)=12𝑓(𝑥)2𝑓(𝑥)1𝑓(𝑥)𝜆(𝑥)=(𝑓(𝑥)2𝑓(𝑥)1𝑓(𝑥))12𝑓(𝑥)𝑓̂=12𝜆(𝑥)2

Also,

𝜆(𝑥)=(Δ𝑥 nt 2𝑓(𝑥)Δ𝑥 nt)12𝑓(𝑥)𝑇Δ𝑥 nt =𝜆(𝑥)2

6.9. Newton method

  1. given starting point 𝑥0, tolerance 𝜀
  2. repeat

    1. 计算 Δ𝑥 nt𝜆2
    2. 如果 12𝜆2<𝜀 结束
    3. backtracking line search 得到 𝑡
    4. 𝑥𝑥+𝑡Δ𝑥 nt

收敛性要求的假设:

  1. 𝑚强凸
  2. 2𝑓 Lipschitz continuous (𝐿>0)

    2𝑓(𝑥)2𝑓(𝑦)2𝐿𝑥𝑦2

收敛的两个阶段:
存在常数𝜂(0,𝑚2𝐿),𝛾>0

  1. if 𝑓(𝑥)2𝜂 then 𝑓(𝑥(𝑘+1))𝑓(𝑥(𝑘))𝛾
  2. if 𝑓(𝑥)2<𝜂 then

    𝐿2𝑚2𝑓(𝑥(𝑘+1))2(𝐿2𝑚2𝑓(𝑥(𝑘))2)2

达到𝑓(𝑥)𝑝ϵ的算法总步数为

𝑓(𝑥(0))𝜂𝛾+log2log2(ϵ0ϵ)

7. Duality

7.1. Lagrange dual 和 conjugate function 的关系

当不等式约束是线性的时候

min𝑥𝑓0(𝑥)s.t. 𝐴𝑥𝑏𝐶𝑥=𝑑

Lagrange dual function 是

𝑔(𝜆,𝜈)=inf𝑥(𝑓0(𝑥)+𝜆(𝐴𝑥𝑏)+𝜈(𝐶𝑥𝑑))=inf𝑥(𝑓0(𝑥)+(𝜆𝐴+𝜈𝑐)𝑥)𝜆𝑏𝜈𝑑=sup𝑥((𝜆𝐴𝜈𝑐)𝑥𝑓0(𝑥))𝜆𝑏𝜈𝑑=𝑓0(𝜆𝐴𝜈𝑐)𝜆𝑏𝜈𝑑

7.2. Lagrange dual problem

max𝑔(𝜆,𝜈) s.t. 𝜆0

最优解的值是 𝑑=𝑔(𝜆,𝜈)

weak duality
𝑑𝑝 总是成立
strong duality
如果 𝑑=𝑝,则称为强对偶性,一般对凸问题成立 成立的条件叫做 constraint qualification

7.3. Slater's constraint qualification

如果凸优化问题是 strict feasible 的,那么强对偶性成立

𝑥 int 𝒟:𝑓𝑖(𝑥)<0, 𝐶𝑥=𝑑

条件可以被放松:𝑥 relint 𝒟 也就是线性的不等式约束不要求严格小于,可以是小于等于

7.4. Complementary slackness

𝜆𝑖𝑓𝑖(𝑥)=0, 𝑖=1,,𝑚

要么 𝜆𝑖=0 ,要么 𝑓𝑖(𝑥)=0

7.5. KKT conditions

  1. 𝑓𝑖(𝑥)0,𝑖(𝑥)=0
  2. 𝜆𝑖0
  3. 𝜆𝑖𝑓𝑖(𝑥)=0
  4. 𝑥𝐿(𝑥,𝜆,𝜈)=0
KKT condition  always  is convex  is optimal

7.6. 利用对偶问题求解原问题

  1. 求解 max𝜆,𝜈𝑔(𝜆,𝜈) 得到 𝜆,𝜈
  2. 固定 𝜆,𝜈 的情况下求解 min𝑥𝐿(𝑥,𝜆,𝜈) 得到 𝑥

8. Equality constrained minimization

(ps. 也可以如 小节 7.6 用对偶问题求解)

8.1. 等式约束的二阶最小化

已知 𝑃𝕊+𝑛

min𝑥12𝑥𝑇𝑃𝑥+𝑞𝑇𝑥+𝑟 s.t. 𝐴𝑥=𝑏

由KKT条件

𝑃𝑥+𝑞+𝐴𝑇𝜈=0𝐴𝑥=𝑏

整理一下就得到

(𝑃𝐴𝑇𝐴0)(𝑥𝜈)=(𝑞𝑏)

其中 (𝑃𝐴𝑇𝐴0) 叫做KKT矩阵

KKT矩阵是非奇异的 𝐴𝑥=0,𝑥0𝑥𝑇𝑃𝑥>0
非奇异的等价条件 𝑃+𝐴𝑇𝐴0

如果KKT矩阵是奇异的,并且等式不可解,那么问题是unbounded below 或 infeasible 的
如果KKT矩阵是奇异的并且可解,那么问题是多个最优解的

8.2. 等式约束的消元

𝐴𝑥=𝑏 可以写成 𝐹𝑧+𝑥̂ 的形式,其中 𝑥̂ 是任意一个特解,𝐹𝐴的零空间的一组基

8.3. Newton step with equality constraints

将原问题看成二阶展开的近似

𝑓(𝑥+𝑣)=𝑓(𝑥)+𝑓(𝑥)𝑇𝑣+12𝑣𝑇2𝑓(𝑥)𝑣 s.t. 𝐴(𝑥+𝑣)=𝑏

由KKT条件 (加上𝐴𝑥=𝑏)

(2𝑓(𝑥)𝐴𝑇𝐴0)(𝑣𝜈)=(𝑓(𝑥)0)Δ𝑥 nt =𝑣

此时 𝜆(𝑥) 的计算可以是

𝜆(𝑥)=(Δ𝑥 nt 𝑇2𝑓(𝑥)Δ𝑥 nt)12

或者是

𝜆(𝑥)=(𝑓(𝑥)𝑇Δ𝑥 nt)12

但是因为不满足等式约束,不能是

𝜆(𝑥)(𝑓(𝑥)𝑇(2𝑓(𝑥))1𝑓(𝑥))12

因为是线性变换,算法的收敛性质不变


9. Inequality constrained minimization

9.1. Logarithmic barrier

𝑓𝑖(𝑥)01𝑡ϕ(𝑥)=1𝑡log(𝑓𝑖(𝑥)) where 𝑡>0

approximation improves as 𝑡

Logarithmic barrier function ϕ:

9.2. 中心路径 (central path)

min𝑥𝑡𝑓0(𝑥)+ϕ(𝑥) s.t. 𝐴𝑥=𝑏

central path 是 {𝑥(𝑡)|𝑡>0}

对有barrier的最优化目标求KKT条件有

𝑡𝑓0(𝑥)+𝑖=1𝑚1𝑓𝑖(𝑥)𝑓𝑖(𝑥)+𝐴𝑇𝑤

整体除以𝑡

𝑓0(𝑥)+𝑖=1𝑚1𝑡𝑓𝑖(𝑥)𝑓𝑖(𝑥)+𝐴𝑇𝑤𝑡

按照上式格式,定义

𝜆(𝑡)=1𝑡𝑓𝑖(𝑥(𝑡)),𝜈(𝑡)=𝑤𝑡

带入到不带barrier的𝐿中有:

𝑝𝑓0(𝑥(𝑡))+𝑖=1𝑚𝜆(𝑡)𝑓𝑖(𝑥(𝑡))+𝐴𝑇𝜈(𝑡)=𝑓0(𝑥(𝑡))𝑚𝑡

因此有

有barrier的KKT条件变化的只有 complementary slackness

𝜆𝑖𝑓𝑖(𝑥)=1𝑡,𝑖=1,,𝑚

9.3. Barrier method (内点法)

  1. 给定 strictly feasible 𝑥,𝑡>0,𝜇>1 和 tolerance 𝜀>0
  2. repeat

    1. 求解 𝑡𝑓0(𝑥)+ϕ(𝑥) 得到 𝑥(𝑡)
    2. 𝑥𝑥(𝑡)
    3. 如果 𝑚𝑡<𝜀 结束
    4. 𝑡𝜇𝑡
收敛性
  1. 外层循环要做𝑘

    𝑚𝜇𝑘𝑡<𝜀𝑘=log𝜇(𝑚𝑡𝜀)
  2. 内层循环与牛顿法相同

9.4. phase I methods

用来找到一个feasible的初始点,将原本的 feasibliity problem 转化为一个优化问题

min𝑥,𝑠𝑠 s.t 𝑓𝑖(𝑥)𝑠,𝑖=1,,𝑚𝐴𝑥=𝑏

如果解出来的𝑠>0,那么原问题是infeasible的