15.05.2015 Views

Introduction to Unconstrained Optimization - Scilab

Introduction to Unconstrained Optimization - Scilab

Introduction to Unconstrained Optimization - Scilab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

spec<br />

Computes the eigenvalue and the eigenvec<strong>to</strong>rs.<br />

D=spec(A) Computes the eigenvalues D of A.<br />

[R,D]=spec(A) Computes the right eigenvec<strong>to</strong>rs R of A.<br />

Figure 21: The spec function.<br />

-->t = 0.5;<br />

-->c = t*a + (1 -t)*b;<br />

-->fa = f(a(1) ,a (2));<br />

-->fb = f(b(1) ,b (2));<br />

-->fc = f(c(1) ,c (2));<br />

-->[ fc t*fa +(1 -t)* fb]<br />

ans =<br />

1. 0.5<br />

Therefore, the function f is nonconvex, although it defines a convex set.<br />

2.6 Quadratic functions<br />

In this section, we consider specific examples of quadratic functions and analyse the<br />

sign of their eigenvalues <strong>to</strong> see if a stationnary point exist and is a local minimum.<br />

Let us consider the following quadratic function<br />

f(x) = b T x + 1 2 xT Hx, (56)<br />

where x ∈ R n , the vec<strong>to</strong>r b ∈ R n is a given vec<strong>to</strong>r and H is a n × n matrix.<br />

In the following examples, we use the spec function which is presented in figure<br />

21. This function allows <strong>to</strong> compute the eigenvalues, i.e. the spectrum, and the<br />

eigenvec<strong>to</strong>rs of a given matrix. This function allows <strong>to</strong> access <strong>to</strong> several Lapack<br />

routines which can take in<strong>to</strong> account for symetric or non-symetric matrices.<br />

In the context of numerical optimization, we often compute the eigenvalues of<br />

the Hessian matrix H of the objective function, which implies that we consider only<br />

real symetric matrices. In this case, the eigenvalues and the eigenvec<strong>to</strong>rs are real<br />

matrices (as opposed <strong>to</strong> complex matrices).<br />

Example 2.2 (A quadratic function for which the Hessian has positive eigenvalues.)<br />

Assume that b = 0 and the Hessian matrix is<br />

( ) 5 3<br />

H =<br />

(57)<br />

3 2<br />

The eigenvalues are approximately equal <strong>to</strong> (λ 1 , λ 2 ) ≈ (0.1458980, 6.854102) and are<br />

both positive. Hence, this quadratic function is strictly convex.<br />

The following script produces the con<strong>to</strong>urs of the corresponding quadratic function.<br />

This produces the plot presented in figure 22.<br />

function f = quadraticdefpos ( x1 , x2 )<br />

x = [x1 x2]’<br />

H = [5 3; 3 2]<br />

f = x.’ * H * x;<br />

28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!