EE364 Review Session 2
Total Page:16
File Type:pdf, Size:1020Kb
EE364 Review EE364 Review Session 2 Convex sets and convex functions • Examples from chapter 3 • Installing and using CVX • 1 Operations that preserve convexity Convex sets Convex functions Intersection Nonnegative weighted sum Affine transformation Composition with an affine function Perspective transformation Perspective transformation Pointwise maximum and supremum Minimization Convex sets and convex functions are related via the epigraph. • Composition rules are extremely important. • EE364 Review Session 2 2 Simple composition rules Let h : R R and g : Rn R. Let f(x) = h(g(x)). Then: ! ! f is convex if h is convex and nondecreasing, and g is convex • f is convex if h is convex and nonincreasing, and g is concave • f is concave if h is concave and nondecreasing, and g is concave • f is concave if h is concave and nonincreasing, and g is convex • EE364 Review Session 2 3 Ex. 3.6 Functions and epigraphs. When is the epigraph of a function a halfspace? When is the epigraph of a function a convex cone? When is the epigraph of a function a polyhedron? Solution: If the function is affine, positively homogeneous (f(αx) = αf(x) for α 0), and piecewise-affine, respectively. ≥ Ex. 3.19 Nonnegative weighted sums and integrals. r 1. Show that f(x) = i=1 αix[i] is a convex function of x, where α1 α2 αPr 0, and x[i] denotes the ith largest component of ≥ ≥ · · · ≥ ≥ k n x. (You can use the fact that f(x) = i=1 x[i] is convex on R .) P 2. Let T (x; !) denote the trigonometric polynomial T (x; !) = x + x cos ! + x cos 2! + + x cos(n 1)!: 1 2 3 · · · n − EE364 Review Session 2 4 Show that the function 2π f(x) = log T (x; !) d! − Z0 is convex on x Rn T (x; !) > 0; 0 ! 2π . f 2 j ≤ ≤ g Solution: 1. We can express f as f(x) = α (x + x + + x ) + (α − α )(x + x + + x − ) r [1] [2] · · · [r] r 1 − r [1] [2] · · · [r 1] +(α − α − )(x + x + + x − ) + + (α α )x ; r 2 − r 1 [1] [2] · · · [r 2] · · · 1 − 2 [1] which is a nonnegative sum of the convex functions x ; x +x ; x +x +x ; : : : ; x +x + +x : [1] [1] [2] [1] [2] [3] [1] [2] · · · [r] EE364 Review Session 2 5 2. The function g(x; !) = log(x + x cos ! + x cos 2! + + +x cos(n 1)!) − 1 2 3 · · · n − is convex in x for fixed !. Therefore 2π f(x) = g(x; !)d! Z0 is convex in x. EE364 Review Session 2 6 Ex. 3.22 Composition rules. Show that the following functions are convex. m T ai x+bi 1. f(x) = log( log( i=1 e )) on − − m T dom Pai x+bi f = x i=1 e < 1 . You can use the fact that n fyi j g log( i=1 e ) isPconvex. P 2. f(x; u; v) = puv xT x on dom f = (x;− u; v)−uv > xT x; u; v > 0 . Use the fact that xT x=u is f j g 2 convex in (x; u) for u > 0, and that px x is convex on R . − 1 2 ++ 3. f(x; u; v) = log(uv xT x) on dom f = (x;− u; v) uv− > xT x; u; v > 0 . f j g EE364 Review Session 2 7 Solution: m T ai x+bi 1. g(x) = log( i=1 e ) is convex (composition of the log-sum-exp function andPan affine mapping), so g is concave. The function h(y) = log y is convex and decreasing.− Therefore f(x) = h( g(x)) is convex.− − 2. We can express f as f(x; u; v) = u(v xT x=u). The function − 2 − h(x1; x2) = px1x2 is convex on Rp++, and decreasing in each − T argument. The functions g1(u; v; x) = u and g2(u; v; x) = v x x=u are concave. Therefore f(u; v; x) = h(g(u; v; x)) is convex. − 3. We can express f as f(x; u; v) = log u log(v xT x=u): − − − The first term is convex. The function v xT x=u is concave because v is linear and xT x=u is convex on (x; u) −u > 0 . Therefore the second term in f is convex: it is the compf ositionj of a convexg decreasing function log t and a concave function. − EE364 Review Session 2 8 tr −1 dom n Ex. 3.18a Show that f(X) = X is convex on f = S++. Solution: Define g(t) = f(Z + tV ), where Z 0 and V Sn. 2 − g(t) = tr((Z + tV ) 1) − − − − = tr Z 1(I + tZ 1=2V Z 1=2) 1 − − = tr Z 1Q(I + tΛ) 1QT − − = tr QT Z 1Q(I + tΛ) 1 n T −1 −1 = (Q Z Q)ii(1 + tλi) ; Xi=1 where we used the eigenvalue decomposition Z−1=2V Z−1=2 = QΛQT . In the last equality we express g as a positive weighted sum of convex functions 1=(1 + tλi), hence it is convex. EE364 Review Session 2 9 CVX and disciplined convex programming CVX is a Matlab-based modeling system for convex optimization • Can solve any problem that obeys the disciplined convex programming • ruleset Converts a problem to standard form and solves it using the solver • SeDuMi You can download CVX from: http://www.stanford.edu/~boyd/cvx/ EE364 Review Session 2 10 Using CVX Typical CVX script: cvx_begin variable [name]([size1],[size2]) (optional)[type] (optional)minimize(convex scalar function of the variables) constraints cvx_end EE364 Review Session 2 11 Example: minimize Ax b ; k − k2 where x Rn, b Rm. 2 2 CVX source code: cvx_begin variable x(n) minimize(norm(A*x-b)) cvx_end Note: This is for demonstration purposes only. It is perhaps easier to solve this least-squares problem using x=A\b. EE364 Review Session 2 12 Example: minimize 1T x subject to Ax = b x 0; ≥ where x Rn, b Rm. 2 2 CVX source code: cvx_begin variable x(n) minimize(ones(1,n)*x) subject to A*x == b x >= 0 cvx_end EE364 Review Session 2 13 Example: T T minimize maxk=1;:::;m max(ak x; 1=ak x) subject to 0 x 1; ≤ ≤ where x Rn. 2 CVX source code: cvx_begin variable x(n) minimize(max(max([A*x inv_pos(A*x)]'))) subject to x >= 0 x <= 1 cvx_end EE364 Review Session 2 14.