CE 191: Civil and Environmental Engineering Systems Analysis LEC : Optimality Conditions Professor Scott Moura Civil & Environmental Engineering University of California, Berkeley Fall 214 Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 1
Conditions for Optimality Consider an unconstrained QP min f(x) = 1 2 xt Qx + Rx Recall from calculus (e.g. Math 1A) the first order necessary condition (FONC) for optimality: If x is an optimum, then it must satisfy d dx f(x ) = = Qx + R = x = Q 1 R Also recall the second order sufficiency condition (SOSC): If x is a stationary point (i.e. it satisfies the FONC), then it is also a minimum if 2 f(x ) Q positive definite positive definite Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 2
Review: Positive-definite matrices All of the following conditions are equivalent: Consider Q R n n Q is positive definite x T Qx >, x the real parts of all eigenvalues of Q are positive Q is negative definite Q is positive semi-definite x T Qx, x the real parts of all eigenvalues of Q are positive, and at least one eigenvalue is zero Q is negative semi-definite Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 3
Nature of stationary point based on SOSC Hessian matrix Quadratic form Nature of x positive definite x T Qx > local minimum negative definite x T Qx < local maximum positive semi-definite x T Qx valley negative semi-definite x T Qx ridge indefinite x T Qx any sign saddle point Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 4
Local Minimum Local Minimum 2 2 2 1 1 1 1 x 1 x 1 Q = [ 3 2 2 3, eig(q) = {1, } Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide
Local Maximum Local Maximum 2 4 6 8 1 x 1 1 1 12 14 x 1 Q = [ 2 1 1 2, eig(q) = { 3, 1} Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 6
Valley Valley 4 6 3 3 2 2 4 2 x 1 1 1 x 1 Q = [ 8 4 4 2, eig(q) = {, 1} Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 7
Ridge Ridge 2 4 6 1 x 1 8 1 1 12 x 1 Q = [, eig(q) = {, } Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 8
Saddle Point Saddle Point 3 2 2 2 1 1 1 x 1 1 2 x 2 x 1 Q = [ 2 4 4 1., eig(q) = { 2.26, 7.76} Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 9
Example.1 f(x 1, ) = (3 x 1 ) 2 + (4 ) 2 = [ [ [ 1 x1 x 1 1 + [ 6 8 [ x 1 Check the FONC: [ f 6 + x = 2x1 8 + 2 has the solution (x, 1 x 2 ) = (3, 4). = [ Check the SOFC: [ 2 f 2 x = 2 2 positive definite Solution: Unique local minimum Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 1
Example.2 f(x 1, ) = 4x 1 + 2 + 4 1 4x 1 + 2 = [ [ [ 4 2 x1 x 1 + [ [ x 4 2 1 2 1 Check the FONC: [ [ f 4 + x = 8x1 4 = 2 4x 1 + 2 has an infinity of solutions (x 1, x 2 ) on the line 2x 1 = 1. Check the SOFC: 2 f = [ 8 4 4 2 positive semidefinite Solution: Infinite set of minima (valley) Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 11
A Connection to Nonlinear Programming Consider the more general nonlinear programming problem, with nonlinear cost and nonlinear constraints min J = f(x) s. to g(x) Consider a given value for the decision variable, x k. Let s take a Taylor series expansion of the cost and constraints. Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 12
Taylor Series Review: Expand f(x) into infinite power series around x = x k f(x) = f(x k ) + f (x k ) (x x k ) + 1 2 f (x k ) (x x k ) 2 +... = n= f n (x k ) n! (x x k ) n Expand cost function, truncated to be 2nd order f(x) f(x k ) + f (x k ) (x x k ) + 1 2 f (x k ) (x x k ) 2 Expand inequality constraints, truncated to be 1st order g(x) g(x k ) + g (x k ) (x x k ) For ease of notation, define x = x x k Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 13
Sequential Quadratic Programming (SQP) We arrive at the following approximate QP min Q + R x s. to A x b where Q = 1 2 f (x k ), R = f (x k ) A = g (x k ), b = g(x k ) Suppose the optimal solution is x. Then let x k+1 = x k + x. Repeat. Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 14
SQP Remarks Remark 1: Can add equality constraints h(x) = and expand via 1st order Taylor series. Remark 2: If x k+1 does not satisfy g(x k+1 ), then you can project x k+1 onto surface g( ) =. Remark 3: Iterate until a stopping criteria is reached, e.g. x ε. Summary: Can re-formulate nonlinear program into sequence of quadratic programs. Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 1
Example.3 Consider the NLP min e x1 + ( 2) 2 x 1, s. to x 1 1. with the initial guess [x 1,,, T = [1, 1 T. Perform 3 iterations of SQP. We have the functions: f(x) = e x1 + ( 2) 2 and g(x) = x 1 1 We seek to find the approximate QP subproblem min 1 2 xt Q x + R T x s. to A x b Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 16
Example.3 Taking derivatives of f(x) and g(x), Q = [ e x 1 2 [, R = A = [ x 1, b = 1 x1 e x1 2( 2) Now consider the initial guess [x 1,,, T = [1, 1 T. This iterate is feasible., First iteration: Q, R, A, b matrices are [ [ e 1 e 1 Q =, R = 2 2 A = [ 1 1, b =, Solving this QP subproblem results in x = [.6893,.6893. Next iterate: [x 1,1,,1 = [x 1,,, + x = [.317, 1.6893 Iterate is feasible. Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 17
Example.3 Second iteration: Result is [x 1,2,,2 = [.443, 1.9483. Iterate is infeasible. Continuing the process... 4 3. 3 2. 2 1. 1. g(x) = Iterations of SQP 2 1 1 2 x 1 1 9 8 7 6 4 3 2 1 Iter. [x 1, f(x) g(x) [1, 1 1.3679 1 [.317, 1.6893.829 -.471 2 [.443, 1.9483.829.6 3 [.22, 1.9171.62.1 4 [.211, 1.9192.64 -. Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 18
Additional Reading Papalambros & Wilde Section 4.2 - Local Approximations Papalambros & Wilde Section 4.3 - Optimality Conditions Papalambros & Wilde Section 7.7 - Sequential Quadratic Programming Prof. Moura UC Berkeley CE 191 LEC 4 - Optimality Conditions Slide 19