unconstrained multivariate optimization - university of …aksikas/nlpm.pdf · 2008-11-05 ·...

41
Unconstrained Multivariate Optimization Multivariate optimization means optimization of a scalar function of a several variables: y = P(x) and has the general form: where P(x) is a nonlinear scalar-valued function of the vector variable x. Background Before we discuss optimization methods, we need to talk about how to characterize nonlinear, multivariable functions such as P(x). Consider the 2 nd order Taylor series expansion about the point x 0 : If we let: min () x x P ( ) ( ) ( ) P P P P () ( ) x x x x x x x x x x x x T ! + " # + # " # 0 0 1 2 0 2 0 0 0 ( ) ( ) a P P P P P P = = T T T = !" + " " ! " " ( ) x x x x b x H x x x x x x x x x x 0 0 1 2 0 2 0 0 2 2 0 0 0 0 0

Upload: ngonhan

Post on 06-Jul-2018

257 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

Multivariate optimization means optimization of a scalarfunction of a several variables:

y = P(x)and has the general form:

where P(x) is a nonlinear scalar-valued function of the vectorvariable x.

Background

Before we discuss optimization methods, we need to talkabout how to characterize nonlinear, multivariable functionssuch as P(x). Consider the 2nd order Taylor series expansionabout the point x0:

If we let:

min ( )x

x P

( ) ( ) ( )P P P P( ) ( )x x x x x x x xx x x

x

T

! +" # + # " #0 012 0

2

00 0

( )

( )

a P P P

P P

P

=

=

T

T T

= ! " + "

" ! "

"

( )x x x x

b x

H

x x xx

x x xx

xx

0 012 0

2

0

0

2

2

00

00

0

Page 2: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

Then we can re-write the Taylor series expansion as aquadratic approximation for P(x):

and the derivatives are:

We can describe some of the local geometric properties ofP(x) using its gradient and Hessian. If fact there are only a fewpossibilities for the local geometry, which can easily bedifferentiated by the eigenvalues of the Hessian (H).

Recall that the eigenvalues of a square matrix (H) arecomputed by finding all of the roots (λi) of its characteristicequation:

P a( )x b x x Hx T T! + + 1

2

! " +

! "

x

x

x b x H

x H

P

P

( )

( )

T T

2

gradient

Hessian

!I H" = 0

Page 3: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

The possible geometries are:1) if λi < 0 (∀ i =1,…,n), the Hessian is said to be negative

definite. This object has a unique maximum and is what we commonly refer to as a hill (in three dimensions).

2) if λi > 0 (∀ i =1,…,n), the Hessian is said to be positive definite. This object has a unique minimum and is what we commonly refer to as a valley (in three dimensions).

P(x)

x1 x2

P(x)

x1 x2

Page 4: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

3) if λi < 0 (∀ i =1,…,m) and λi > 0 (∀ i =m+1,…,n) , the Hessian is said to be indefinite. This object has neither a

unique maximum or minimum, and is what we commonly refer to as a saddle (in three dimensions).

4) if λi < 0 (∀ i =1,…,m) and λi = 0 (∀ i =m+1,…,n) , the Hessian is said to be negative semi-definite. This object

does not have a unique maximum and is what we commonly refer to as a ridge (in three dimensions).

P(x)

x1 x2

P(x)

x1 x2

Page 5: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

5) if λi > 0 (∀ i =1,…,m) and λi = 0 (∀ i =m+1,…,n) , the Hessian is said to be positive semi-definite. This object

does not have a unique minimum and is what we commonly refer to as a trough (in three dimensions).

A well posed problem has a unique optimum, so will will limitour discussions to either problems with positive definiteHessians (for minimization) or negative definite Hessians (formaximization).

Further, we would prefer to choose units for our decisionvariables (x) so that the eigenvalues of the Hessian all haveapproximately the same magnitude. This will scale theproblem so that the profit contours are concentric circles andwill condition our optimization calculations.

P(x)

x1 x2

Page 6: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

Necessary and Sufficient Conditions

For a twice continuously differentiable scalar function P(x), apoint x* is an optimum if:

and:

We can use these conditions directly, but it usually involvessolving a set of simultaneous nonlinear equations (which isusually just as tough as the original optimization problem).Consider:

Then:

and stationarity of the gradient requires that:

This is a set of very nonlinear equations in the variables x.

!x x

0P * =

!

!

xx

xx

2

2

P

P

*

*

is positive definite (a minimum)

is negative definite (a maximum)

P e( )x x Axx Ax T T

=

! = +

=

P e e

e

2(

2( (1+ )

T T T

T T

T T

T

x A x Ax x A

x A x Ax

x Ax x Ax

x Ax

) ( )

)

! =P e 2( (1+ ) = T TT

x A x Ax 0x Ax)

Page 7: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

ExampleConsider the scalar function:

or:

where x = [x1 x2]T.

Stationarity of the gradient requires:

Check the Hessian to classify the type of stationary point:

The eigenvalues of the Hessian are:

Thus the Hessian is indefinite and the stationary point is asaddle point. This is a trivial example, but it highlights thegeneral procedure for direct use of the optimality conditions.

P x x x x x x( )x = + + + + +3 2 41 2 1 2 1

2

2

2

[ ]P( )x x x x T= + +!

"#

$

%&3 1 2

1 2

2 1

[ ]! +"

#$

%

&'

("

#$

%

&'"

#$%

&'

"

#$

%

&'

)

xx 0

x

P = 1 2 =

= -1

2 =

-

0

T

1

2

21 2

2 1

1 2

2 1

1

2

1

!"

#$

%

&'

"

#$

%

&'x

22

2 1P = 2

1 =

2 4

4 2

( ) = - 2 - 4

- 4 - 2 = - 2 = 0

= 6, - 2

!!

!!

!

I "#

$%

&

'(

#

$%

&

'( "

)

2 4

4 216

2

i

Page 8: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

Like the univariate search methods we studied earlier,multivariate optimization methods can be separated into twogroups:

those which depend solely on function evaluations, those which use derivative information (either analytical

derivatives or numerical approximations).

Regardless of which method you choose to solve amultivariate optimization problem, the general procedurewill be:

1) select a starting point(s),2) choose a search direction,3) minimize in chosen search direction,4) repeat steps 2 & 3 until converged.

Also, successful solution of an optimization problem willrequire specification of a convergence criterion. Somepossibilities include:

univariatesearch

multivariatemethod

)

x x

x x

x x

k k

k kP P

Pk

+

+

! "

! "

# "

1

1

$

%

&

( ) (

Page 9: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Sequential Univariate Searches

Perhaps the simplest multivariable search technique toimplement would be a system of sequential univariatesearches along some fixed set of directions. Consider the twodimensional case, where the chosen search directions areparallel to the coordinate axes:

In this algorithm, you:1. select a starting point x0,2. select a coordinate direction (e.g. s = [0 1]T, or [1 0] T),3. perform a univariate search ,4. repeat steps 2 and 3 alternating between search

directions, until converged.

x0

x1

x2

x*

x2

x1

x3

x4 x5

x6 x7

min ( )!

! Pkx s+

Page 10: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Sequential Univariate Searches

The problem with this method is that a very large number of iterationsmay be required to attain a reasonable level of accuracy. If we newsomething about the “orientation” of the objective function the rate ofconvergence could be greatly enhanced. Consider the previous twodimensional problem, but using the independent search directions ([11]T, [1 -1] T).

Of course, finding the optimum in n steps only works for quadraticobjective functions where the Hessian is known and each line searchis exact. There are a large number of these optimization techniqueswhich vary only in the way that the search directions are chosen.

x0

x1

x2

x*

x1

Page 11: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Nelder-Meade Simplex

This approach has nothing to do with the SIMPLEX methodof linear programming. The method derives its name from ann-dimensional polytope (and as a result is often referred to asthe “polytope” method).

A polytope is an n-dimensional object that has n+1 vertices:

It is an easily implemented direct search method, that onlyrelies on objective function evaluations. As a result, it can berobust to some types of discontinuities and so forth. However,it is often slow to converge and is not useful for largerproblems (>10 variables).

n polytope number of

vertices

1 line segment 2

2 triangle 3

3 tetrahedron 4

M M M

Page 12: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Nelder-Meade Simplex

To illustrate the basic idea of the method, consider the two-dimensional minimization problem:

Step 1: P1 = max (P1, P2, P3), define P4 as the reflection of P1 through

the centroid of the line joining P2 and P3. P4 ≤ max (P1, P2, P3), form a new polytope from the points P2,

P3, P4.

Steps 2 through 4: repeat the procedure in Step 1 to form new polytopes.

x1

x2

x*

1 2

34

5 6

Page 13: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

We can repeat the procedure until the polytope defined by P4,P5, P6. Further iterations will cause us to flip between twopolytopes. We can eliminate these problems by introducingtwo further operations into the method:

contraction when the reflection step does not offer anyimprovement,

expansion to accelerate convergence when thereflection step is an improvement.

Nelder-Meade Simplex

x1

x2

x*11

1 2

34

5 67

8

9

1012

13

14

Page 14: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Nelder-Meade Simplex

For minimization, the algorithm is:

xh is given by P(xh) = max{P(x1), … ,P(xn+1)}, xl is given by P(xl) = min{P(x1), … ,P(xn+1)},

calculate the centroid of the vertices other than xh as:

calculate reflection step: xr = 2 xc- xh

if P(xr) < P(xl) then attempt expansion,

xe = xc + γ (xr- xc)

if P(xe) < P(xr) the expansion was successful,form the new polytope replacing xh with xe.

else the expansion step failed,form the new polytope replacing xh with xr.

end if

!"

#$%

&'()

*+,

-

'= .

+

=h

n

i

ic

nxxx

1

11

1

γ >1 (usually 2~3, or could do a line search)

Page 15: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Nelder-Meade Simplex

elseif P(xr) < max{P(xi) | xi ≠ xh} use the reflection,

form the new polytope replacing xh with xr.

elsethe reflection step failed, try a contraction,

if P(xs) < min{P(xh),P(xr)} use contraction, form the new polytope replacing xh with xs.else repeat contraction.end if.

repeat the entire procedure until termination.

The Nelder-Meade Simplex method can be slow to converge,but it is useful for functions whose derivatives cannot becalculated or approximated (e.g. some non-smooth functions).

xx x x x x

x x x x xs

c h c r h

c r c r h

P P

P P =

+ ( - ),

+ ( - ),

!

!

( ) ( )

( ) ( )

"

<

#$%

where 0 <β <1,

usually β =½.

Page 16: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Nelder-Meade Simplex

Example

222 min21

2

2

2

1+!!+ xxxx

x

x1 x2 x3 P1 P2 P3 xr Pr notes

0 33

32

22

8 5 2 2

1

1 expansion γ=3, failed

1 21

11

22

1 5 2 1

1

0 expansion γ=3, failed

2 21

11

22

1 0 2 1

0

1 expansion γ=3, failed

3 21

11

10

1 0 1 0

0

2 contraction β= ½

4 3234

11

10

516

0 1 3274

1316

expansion γ=3, failed

5 3234

11

3274

516

0 1316

Page 17: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

This family of optimization methods use first-order derivativesto determine a “descent” direction. (Recall that the gradientgives the direction of quickest increase for the objectivefunction. Thus, the negative of the gradient gives the directionof quickest decrease for the objective function.)

Steepest Descent

It would seem that the fastest way to find an optimum wouldbe to always move in the direction in which the objectivefunction decreases the fastest. Although this idea is intuitivelyappealing, it is very rarely true; however, with a good linesearch every iteration will move closer to the optimum.

-0.5

0.5

-1 -0.5 0 0.5 1-1

0

1

Page 18: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

The Steepest Descent algorithm is:

1. choose a starting point x0,2. calculate the search direction:

3. determine the next iterate for x:

by solving the univariate optimization problem:

4. repeat steps 2 & 3 until termination. Some termination criteria to consider:

where ε is some small positive scalar.

[ ]sx xkP

k

= T

! "

x x sk k k k+

= +1

!

min ( )!

!k

Pk k k

x s+

( ) ( )

! "

"

"

"

k

k k

k k

P

P P

k

-

-

#

#

$ #

#

+

+

x x

x x

x x

1

1

Page 19: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

Steepest Descent Example #1

start at x0 = [3 3]T

start at x0 = [1 2]T

This example shows that the method of Steepest Descent isvery efficient for well-scaled quadratic optimization problems(the profit contours are concentric circles). This method is notnearly as efficient for non-quadratic objective functions orobjective functions with very elliptical profit contours (poorlyscaled).

!"

#$%

&

'

'=(

+''+

22

22

222 min

2

1

21

2

2

2

1

x

xP

xxxx

T

x

x

xk k

T

P xx! "

k P(xk)

0 3

3

#

$%&

'(

4

4

#

$%&

'(

? 8

1 1

1

#

$%&

'(

0

0

#

$%&

'(

0

xk k

T

P xx

! "k P(xk)

0 1

2

#

$%&

'(

0

2

#

$%&

'(

? 1

1 1

1

#

$%&

'(

0

0

#

$%&

'(

0

Page 20: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

Steepest Descent Example #2

Consider the minimization problem:

Then:

To develop an objective function for our line search, substitutexk+1 = xk + λksk into the original objective function:

To simplify our work, let H = , which yields:

This expression is quadratic in λk, thus making it easy toperform an exact line search:

minx

x x 1

2

T101 99

99 101

!

!

"

#$

%

&'

[ ]!"

"

#

$%

&

'( " "

xxP x x x x = = 101 + 101

T

1 2 1 2

101 99

99 10199 99

( ) ( )P P Pk k k k k k k

k k k k k k

k k

( + ) = 1

2- -

1

2- -

T

T

x s x x

x x x x

x x x x! ! !

! !

"#

#

$

%&

'

() "

=#

#

$

%&

'

()

*

+,

-

./

#

#

$

%&

'

()

#

#

$

%&

'

()

*

+,

-

./

101 99

99 101

101 99

99 101

101 99

99 101

101 99

99 101

101 99

99 101

!

!

"

#$

%

&'

[ ]Pk k k k k k k k k k k

( + ) = 1

2

T T Tx s x Hx x H x x H x! ! !" +2 2 2 3

dP

dk

k k k k k

!! = - = 0

T Tx H x x H x

2 3+

Page 21: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

Solving for the step length yields:

Starting at x0 = [2 1]T:

!k

T

T

T

2

T

3

T

T

=

=

=

x H x

x H x

x x

x x

x x

x x

k k

k k

k k

k k

k k

k k

2

3

101 99

99 101

101 99

99 101

20 002 19 998

19 998 20 002

4 000 004 3 999 996

3 999 996 4 000 004

"

"

#

$%

&

'(

"

"

#

$%

&

'(

"

"

#

$%

&

'(

"

"

#

$%

&

'(

, ,

, ,

, , , ,

, , , ,

xk P(xk) ∇x xP

k

T λk

0 21

54.50 103

97−

0.0050

1 1484514854..

4.4104 2 8809

30591..

0.4591

2 016180 0809

.

.

0.3569 8 3353

7 8497..−

0.0050

3 0120101202..

0.0289 0 2331

0 2476..

0.4591

4 0 01310 0065..

0.0023 0 6745

0 6352..−

0.0050

5 0 00970 0097..

1.8915×10-4 0 0189

0 0200..

0.4591

6 0 00110 0005..

1.5307×10-5 0 0547

0 0514..−

0.0050

7 7868 107872 10

4

4

.

×

−1.2387×10-4 0 0015

0 0016..

0.4591

Page 22: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

Conjugate Gradients

Steepest Descent was based on the idea that the minimum willbe found provided that we always move in the downhilldirection. The second example showed that the gradient doesnot always point in the direction of the optimum, due to thegeometry of the problem. Fletcher and Reeves (1964)developed a method which attempts to account for localcurvature in determining the next search direction.

The algorithm is:1. choose a starting point x0,2. set the initial search direction as:

3. determine the next iterate for x:

by solving the univariate optimization problem:

4. calculate the next search direction as:

5. repeat steps 3 & 4 until termination.

[ ]sx x0

0

= T

! " P

x x sk k k k+

= +1

!

min ( )!

!k

Pk k k

x s+

s sx x

x x xx

x x xx

k kP

P P

P Pk

kk

kk

+= !" +

" "

" "

++

1

11

T

T

T

Page 23: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

The manner in which the successive search directions arecalculated is important. For quadratic functions, thesesuccessive search directions are conjugate with respect to theHessian. This means that for the quadratic function:

successive search directions satisfy:

As a result, these successive search directions haveincorporated within them information about the geometry ofthe optimization problem.

Conjugate Gradients Example

Consider again the optimization problem:

We saw that Steepest Descent was slow to converge on thisproblem because of its poor scaling. As in the previousexample, we will use an exact line search. It can be shown thatthe optimal step length is:

P a( )x b x x Hx = + +T 12

T

0 = 1+k

T

kHss

minx

x x 1

2

T101 99

99 101

!

!

"

#$

%

&'

!k

T

T

=

-

k k

k k

x s

s s

101 99

99 101

101 99

99 101

"

"

#

$%

&

'(

"

"

#

$%

&

'(

Page 24: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Gradient-Based Methods

Starting at x0 = [2 1]T:

Notice the much quicker convergence of the algorithm. For aquadratic objective function with exact line searches, theConjugate Gradients method exhibits quadratic convergence.

The quicker convergence comes at an increased computationalrequirement. These include:

• a more complex search direction calculation,• increased storage for maintaining previous search

directions and gradients.These are usually small in relation to the performanceimprovements.

xk P(xk) !x xP

k

T

sk"k

0 2

1

#

$%&

'(

54.50

103

97)

#

$%

&

'(

103

97)

#

$%

&

'(

0.0050

1

14845

14854

.

.

#

$%

&

'(

4.4104

28809

30591

.

.

#

$%

&

'(

)

)

#

$%

&

'(

29717

29735

.

.

0.4996

2

0

0

#

$%&

'(

0

Page 25: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Newton’s Method

The Conjugate Gradients method showed that there was aconsiderable performance gain to be realized by incorporatingsome problem geometry into the optimization algorithm.However, the method did this in an approximate sense.Newton’s method does this by using second-order derivativeinformation.

In the multivariate case, Newton’s method determines a searchdirection by using the Hessian to modify the gradient. Themethod is developed directly from the Taylor Seriesapproximation of the objective function. Recall that anobjective function can be locally approximated as:

Then, stationarity can be approximated as:

Which can be used to determine an expression for calculatingthe next point in the minimization procedure:

Notice that in this case we get both the direction and the steplength for the minimization. Further, if the objective functionis quadratic, the optimum is found in a single (Newton Step)without a line search.

( ) ( ) ( )P P P Pk k k k

k k

( ) ( )x x x x x x x xx x x

x

T

! +" # + # " #12

2

( )! " ! + # !x x x x

xx x x 0P P P

k kk

( ) = T 2

( ) ( )x xx

xx xk k

P Pk k

+

!

= ! " "1

21

T

Page 26: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Newton’s Method

At a given point xk, the algorithm for Newton’s method is:

1. calculate the gradient at the current point ,

2. calculate the Hessian at the current point ,

3. calculate the Newton step:

4. calculate the next point:

5. repeat steps 1 through 4 until termination.

Newton’s Method Example

Consider once again the optimization problem:

The gradient and Hessian for this example is:

!x xP

k

!x

x

2P

k

( ) ( )!xx

xx xk

P Pk k

T

= " # #"

21

x x xk k k+

+1 = !

minx

x x 1

2

T101 99

99 101

!

!

"

#$

%

&'

!"

"

#

$%

&

'( !

"

"

#

$%

&

'(x x

xP P = 101

, = 101

T99

99 101

99

99 101

2

Page 27: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Newton’s Method

Starting at x0 = [2 1]T:

Comparing the three methods on this problem:

xk P(xk) !x xP

k

T !x

x

2P

k

0 2

1

"

#$%

&'

54.50 103

97(

"

#$

%

&'

101 99

99 101

(

(

"

#$

%

&'

1 0

0

"

#$%

&'

0

0 0.5 1 1.5 20

0.5

1

1.5

2

x1

x2

Steepest Descent

Conjugate Gradients

Newton

Page 28: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Newton’s Method

As expected Newton’s method was very effective, eventhoughthe problem was not well scaled.

poor scaling was compensated for by using the inverseof the Hessian.

Steepest Descent was very good for the first two iterations,when we were quite far from the optimum. But it slowedrapidly as:

The Conjugate Gradients approach avoided this difficulty byincluding some measure of problem geometry in thealgorithm. However, the method started out using the SteepestDescent direction and built in curvature information as thealgorithm progressed to the optimum. For higher-dimensionaland non-quadratic objective functions, the number ofiterations required for convergence can increase substantially.

In general, Newton’s Method will yield the best convergenceproperties, at the cost of increased computational load tocalculate and store the Hessian. The Conjugate Gradientsapproach can be effective in situations where computationalrequirements are an issue. However, there are some othermethods where the Hessian is approximated using gradientinformation and the approximate Hessian is used to calculate aNewton step. These are called the Quasi-Newton methods.

x x 0x xkP

k

! " !* Q

Page 29: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Newton’s Method

As we saw in the univariate case, care must be taken whenusing Newton’s method for complex functions:

Since Newton’s method is searching for a stationary point, itcan oscillate between such points in the above situation. Forsuch complex functions, Newton’s method is oftenimplemented with an alternative to step 4.

4′. calculate the next point:

where the step length is determined as:i) 0 < λk < 1 (so we don’t take a full step),ii) perform a line search on λk.

Generally, Newton and Newton-like methods are preferred toother methods, the main difficulty is determining the Hessian.

-20

2

-1

0

1-0.5

0

0.5

P(x)

x1 x2

x x xk k k k+

+1 = ! "

Page 30: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Approximate Newton Methods

As we saw in the univariate case the derivatives can beapproximated by finite differences. In multiple dimensionsthis can require substantially more calculations. As anexample, consider forward difference approximation of thegradient:

where δi is a perturbation in the direction of xi. This approachrequires 1 additional objective function evaluation perdimension for forward or backward differencing, and 2additional objective function evaluations per dimension forcentral differencing.

To approximate the Hessian using only finite differences inthe objective function could have the form:

Finite difference approximation of the Hessian requires atleast an additional 2 objective function evaluations perdimension. Some differencing schemes will give betterperformance than others; however, the increasedcomputational load required for difference approximation ofthe second derivatives precludes the use of this approach forlarger problems.

)()( =

i

kik

i

PP

x

PP

k

k !

!

"

" xx

x

xx

#+$%

&

'()

*+

[ ] [ ]

)()()()( =

22

ji

kjkkik

ji

PPPP

xx

PP

k

k !!

!!

""

" xxxx

x

xx

#+##+$

%%&

'

(()

*+

Page 31: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Approximate Newton Methods

Alternatively, the Hessian can be approximated in terms ofgradient information. In the forward difference case theHessian can be approximated as:

Then, we can form a finite difference approximation to theHessian as:

The problem is that often this approximate Hessian is non-symmetric. A symmetric approximation can be formed as:

Whichever approach is used to approximate the derivatives,the Newton step is calculated from them. In general, Newton’smethods based on finite differences can produce resultssimilar to analytical results, providing care is taken inchoosing the perturbations δi. (Recall that as the algorithmproceeds:

Then small approximation errors will affect convergence andaccuracy.)

Some alternatives which can require fewer computations, yetbuild curvature information as the algorithms proceed are theQuasi-Newton family.

= =

2

i

i

i

kik

k

k

PP

x

PP

!"

" ! xxxx

x

xx

h

#$#%&

'

()*

+#

+

[ ]~H h =

i

[ ]$~ ~

H H H = 1

2

T+

x x 0x xkP

k

! " !*

. and

Page 32: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Quasi-Newton Methods

This family of methods are the multivariate analogs of theunivariate Secant methods. They build second derivative(Hessian) information as the algorithm proceeds to solution,using available gradient information.

Consider the Taylor series expansion for the gradient of theobjective function along the step direction sk:

Truncating the Taylor series at the second-order terms an re-arranging slightly yields the so-called Quasi-NewtonCondition:

Thus, any algorithm which satisfies this condition can build upcurvature information as it proceeds from xk to xk+1 in thedirection Δxk; however, the curvature information is gained inonly one direction. Then as these algorithms proceed the fromiteration-to-iteration, the approximate Hessians can differ byonly a rank-one matrix:

Combining the Quasi-Newton Condition and the updateformula yields:

( )! ! + ! ++

x x x x xx

xP P Pk k

k

k1

2 =

T

" K

( )! !x H gx x x xk

T

= = $k k

P Pk k

+ " #"+

11

$ $H H vuk k+

+1 =

T

( ) ( ) ( )! ! !x H x H vu gk k k k k

T T T = = $ $

+ +1

Page 33: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Quasi-Newton Methods

Which yields a solution for the vector u of:

and a Hessian update formula:

Unfortunately this update formula is not unique with respect tothe Quasi-Newton Condition and the step vector sk. We couldadd an additional term of wzT to the update formula, where thevector w is any vector from the null space of Δxk. (Recall thatif w ∈ null(Δxk), then Δxk

T w = 0). Thus there are a family of

such Quasi-Newton methods which differ only in thisadditional term wzT.

Perhaps the most successful member of the family is theBroyden-Fletcher-Goldfarb-Shanno (BFGS) update:

The BFGS update has several advantages including that it issymmetric and it can be further simplified if the step iscalculated according to:

[ ]ux v

g x HT

T

T =

1

!! !

k

k k k" $

[ ]$ $ $H Hx v

v g x Hk k

k

k k k+ + !1 =

1

T

T

"" "

providing Δxk and v are not orthogonal

$ $$ $

$H H

g g

g x

H x x H

x H xk k

k k

k k

k k k k

k k k

++ !

1 =

T T

T

" "

" "

" "

" "

$H xx xk k kP

k

! = T

" #$

Page 34: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Quasi-Newton Methods

In this case the BFGS update formula simplifies to:

General Quasi-Newton Algorithm

1. Initialization:- choose a starting point x0,- choose an initial Hessian approximation

(usually ).2. At iteration k:

- calculate the gradient ,- calculate the search direction:

- calculate the next iterate:

using a line search on λk.- compute- update the Hessian ( ) using the method

of your choice (e.g. BFGS).3. Repeat step 2 until termination.

$ $H Hg g

g x x

x x

x

k k

k k

k k

k k k

k k

P P

P+

+ +! !

!1 =

TT

" "

" " "

#

$H I0 =

x x sk k k k+

= +1

!

( ) ( )s Hx xk k k

P T

= ! "!

$1

!x xP

k

!x x

g xPk

k k, , . " "

$Hk+1

Page 35: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Quasi-Newton Methods

BFGS Example

Consider once again the optimization problem:

Recall that the gradient for this example is:

As before starting at x0 = [2 1]T:

minx

x x 1

2

T101 99

99 101

!

!

"

#$

%

&'

!"

"

#

$%

&

'(x

xP = 101

T

99

99 101

xk P(xk) ∇x xP

k

T $H k

sk λk

0 21

54.5 103

97−

1 00 1

10397−

0.0050

1 1484514854..

4.4104 2 8809

30591..

100 5291 99 599 5 100 4681. .

. .

297172 9735..

0.4996

2 7 810 107 815 10

4

4

.

.

×

×

−1.2207×10-8 1516 10

1609 10

4

4

.

.

×

×

101 9999 101

− ×

− ×

7 810 107 815 10

4

4

.

.1.0000

3 00

Page 36: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Quasi-Newton Methods

It is worth noting that the optimum is found in 3 steps(although we are very close within 2). Also, notice that wehave a very accurate approximation for the Hessian (to 7significant figures) after 2 updates.

The BFGS algorithm was: not quite as efficient as Newton's method, approximately as efficient as the Conjugate Gradients

approach, much more efficient than Steepest Descent.

This is what should be expected for quadratic objectivefunctions of low dimension. As the dimension of the problemincreases, the Newton and Quasi-Newton methods will usuallyout perform the other methods.

A cautionary note:The BFGS algorithm guarantees that the approximate Hessianremains positive definite (and invertible) providing that theinitial matrix is chosen as positive definite, in theory.However, round-off errors and sometimes the search historycan cause the approximate Hessian to become badlyconditioned. When this occurs, the approximate Hessianshould be reset to some value (often the identity matrix I).

Page 37: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Convergence

During our discussions we have mentioned convergenceproperties of various algorithms. There are a number of wayswith which convergence properties of an algorithm can becharacterized. The most conventional approach is to determinethe asymptotic behaviour of the sequence of distances betweenthe iterates (xk) and the optimum (x*), as the iterations of aparticular algorithm proceed. Typically, the distance betweenan iterate and the optimum is defined as:

We are most interested in the behaviour of an algorithm withinsome neighbourhood of the optimum; hence, the asymptoticanalysis. The asymptotic rate of convergence is defined as:

with the asymptotic order p and asymptotic error β.

In general, most algorithms show convergence propertieswhich are within three categories:

• linear (0 ≤ β < 1, p = 1),• superlinear (β = 0, p = 1),• quadratic (β ≥ 0, p = 2),

- *

x xk

limk

k+

k

p!"

-

-

=

*

*

x x

x x

1

#

Page 38: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Convergence

For the methods we have studied, it can be shown that:

1) the Steepest Descent method exhibits superlinear convergence in most cases. For quadratic objective functions the asymptotic convergence properties can be shown to approach quadratic as κ(H) →1 and linear as κ(H) →∞.

2) the Conjugate Gradients method will generally show superlinear (and often nearly quadratic) convergence properties.

3) Newton’s method converges quadratically.

4) Quasi-Newton methods can closely approach quadratic rates of convergence.

Page 39: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Multivariate Optimization

As in the univariate case, there are two basic approaches:• direct search (Nelder-Meade Simplex, ...),• derivative-based (Steepest Descent, Newton’s ...).

Choosing which method to use for a particular problem is atrade-off among:

• ease of implementation,• convergence speed and accuracy,• computational limitations.

Unfortunately there is no ‘best’ method in all situations. Fornearly quadratic functions Newton’s and Quasi-Newtonmethods will usually be very efficient. For nearly flat or non-smooth objective functions, the direct search methods areoften a good choice. For very large problems (more than 1000decision variables), algorithms which use only gradientinformation (Steepest Descent, Conjugate Gradients, Quasi-Newton, etc.) can be the only practical methods.

Remember that the solution to a multivariable optimizationproblem requires:

• a function (and derivatives) that can be evaluated,• an appropriate optimization method,• a good starting point,• a well chosen termination criterion.

Page 40: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Optimization Problems

1. For the Wastewater settling pond problem discussed in class,we found that the outlet concentration could be described as:

Assuming τ = 4 hours and ci=100 grams/liter, please do eachof the following:

a) Find the maximum outlet concentration using Matlab’s“fminbnd” and “fminunc” commands.

b) Determine the sensitivity of the maximum outletconcentration and time at which the maximum occursto the assumed value of τ.

c) Determine the sensitivity of the maximum outletconcentration and time at which the maximum occursto the assumed value of ci.

!

t

itectc

"

= )(0

Page 41: Unconstrained Multivariate Optimization - University of …aksikas/nlpm.pdf · 2008-11-05 · Unconstrained Multivariate Optimization Like the univariate search methods we studied

Unconstrained Optimization Problems

2. The file “inhibit.mat” contains data from experiments that relate theconsumption rate (µ) of substrate (hr-1) in a wastewater treatmentplant to the concentration of the substrate (S) in the feed (grams/litre)to the wastewater treatment plant. The relationship is expected to be:

Using the given data, please do each of the following:a) Estimate the model parameters µ, Km, and K1 using Matlab’s

“lsqcurvefit” command.b) The last data point in the supplied data is expected to be an

outlier. Determine how sensitive the parameters estimates areto the suspected outlier?

Constrained ultivariable NLP- Until now we have only been

discussing NLP that do not have constraints.Most problems that we wish to solve will havesome form of constraints.

- i) equality constraints(material and energy balances)

- ii) inequality constraints(limits on operating conditions)

- These type of problems requiretechniques that rely heavily on theunconstrained methods.

-

-equality constraint

- The solution to this problem must lieon the equality constraint. So for this problem,we must find the value of x that has theoptimum profit and satisfies the equalityconstraint. Thus, the original a 2-dimensionalproblem has been reduced to a search along aconstraint (one dimensional search)

2

1

max

SKSK

S

m++

µ