Docsity

Optimization Methods the Unconstrained Extermination Problem - Report | ECE 2671, Papers of Linear Algebra

Toggle sidebar
bg1
Optimization Methods the unconstrained
extremization problem
Narayanan Krishnamurthy1∗
for ECE-2671 taught by Dr. Simaan A. Marwan2∗
Abstract. The subject of this technical report is the evaluation of different uncon-
strained optimization methods; that determine the extremum points of the given objective
function(s). The analysis is done using Matlab, and assumes the same starting point and
termination criteria for comparing the different iterative algorithms.
Key words. Gradient Methods, Method of Steepest Descent, Conjugate Direction
Method, Newton-Raphson Method, Region Elimination Methods, Bisection Method, Equal
Spacing Method, Fibonacci Search, Golden Search, Polynomial Approximation,
∗1 Department of Electrical and Computer Engg. 2*Professor ECE Department University of Pittsburgh,
Pittsburgh, PA 15261
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Optimization Methods the Unconstrained Extermination Problem - Report | ECE 2671 and more Papers Linear Algebra in PDF only on Docsity!

Optimization Methods the unconstrained

extremization problem

Narayanan Krishnamurthy^1 ∗

for ECE-2671 taught by Dr. Simaan A. Marwan^2 ∗

Abstract. The subject of this technical report is the evaluation of different uncon-

strained optimization methods; that determine the extremum points of the given objective

function(s). The analysis is done using Matlab, and assumes the same starting point and

termination criteria for comparing the different iterative algorithms.

Key words. Gradient Methods, Method of Steepest Descent, Conjugate Direction

Method, Newton-Raphson Method, Region Elimination Methods, Bisection Method, Equal

Spacing Method, Fibonacci Search, Golden Search, Polynomial Approximation,

∗1 Department of Electrical and Computer Engg. 2*Professor ECE Department University of Pittsburgh, Pittsburgh, PA 15261

Contents

variant of the function f and is given by the second-order derivative matrix:

∇^2 f (x∗) =

[

∂^2 f

∂xi∂xj

x∗

]

i,j

, where 1 ≤ i, j ≤ n (2.5)

The Second-Order Sufficient conditions for a relative minimum point x∗^ of a twice differen-

tiable function f (x) is:

∇f (x∗) = 0 and ∇^2 f (x∗) is positive definite (2.6)

The Taylor’s approximation of the function f based on the first and second variants of

f is given by:

f (x) = f (x^0 )+ < ∇f (x^0 ), (x − x^0 ) > +

< (x − x^0 ), ∇^2 f (x^0 )(x − x^0 ) >

+ Higher Order Terms (2.7)

where < .,. > is the notation for inner product between vectors in Rn, for more details

on vector spaces and FONC/SONC and sufficiency conditions refer [2, 4].

3 Iso-line plots of given objective functions

Two objective functions were provided to evaluate the performance of the various algorithms,

the initial iteration guess x 0 y0 is chosen as [2 2]T^ and termination condition of the iterative

search for the relative minimum is ||∇f (xkyk)|| <  where  = 0.05.

f 1 (x 1 , x 2 ) = (x^21 − x 2 )^2 + (x 1 − 1)^2 (3.1)

f 2 (x 1 , x 2 ) = 100(x^21 − x 2 )^2 + (x 1 − 1)^2 (3.2)

The objective functions f 1 and f 2 are common test functions used to test convergence

properties of any new algorithm. f 1 was introduced by Witte and Holst (1964), while f 2 was

proposed by Rosenbrock (1960).

Iso-lines or contours are good to visualize the gradient or descent/ascent direction of the

functions, and to locate the minima or maximum, especially if the function is dependent on

just two variables.

(a) (b)

Figure 1: (a)Contour Plot of f 1 (x 1 , x 2 ) (b)Contour Plot of f 2 (x 1 , x 2 )

4 Gradient Methods

The objective of the gradient methods is to generate a sequence of vectors, x^0 , x^1 ,... , xn,in

Rn,such that: f (x^0 ) > f (x^1 ) · · · > f (xn). Thus the iterative method of generating such

sequences can be mathematically expressed as:

xk+1^ = xk^ − tkAk∇f (xk) (4.1)

where tk is the step-size for the ’kth’ iteration. Note the process of determining the

minimum involves traversing along the negative direction of the gradient vector given by

∇f (xk). Ak is a linear transformation of the gradient vector, which provides more flexibility

4.1 Constant and Variable Step-size Steepest Descent Methods

Constant and variable step size steepest descent methods involves choosing a constant tk

or multiple tk’s in the equation 4.1. In the variable step size method, at every step of

generation of next exploration point in the function, that step from the chosen array that

gives a minimum value of f evaluated at that point is chosen. Optimal Step-size method

The minima of f1 found after 39 iterations,

Convergence of f1 using variable steps chosen from 0.05,0.15 and 0.25, and negative direction of gradient is used as the line of exploration.

The minima of f1 found after 30 iterations, using Variable Stepsizes chosen from =0.090,0.150,0.200, gradient method are x1=1.055874 x2=1.133855, and the min value of function is =0.


Convergence of f2: The function f2 did not converge at all for constant and variable stepsize methods, various intial points ranging from [-1 1], [-1. 0.5] [2 2] and various step sizes ranging from 0.05,0.09,0.15 were tried in vain the steepest descent algorithm couldnt locate the descent direction to iterate on and hence a failed output:

iteration x1 x2 f2(x1,x2) Norm(gradient) not a descent direction ... exiting The extremum could not be located after 2 iterations

4.2 Newton-Raphson method

The Newton-Raphson method, uses not only the first variant, but also the second variant

information in its search for the minima. The Taylor’s approximation of a function given by

the expression 2.7, can be re-written (ignoring the higher order terms) as:

The minima of f2 found after 3 iterations, with initial pt 2.0,2.0,using Newton-Raphson(NR) method are x1=1.001233 x2=1.002467, and the min value of function is =0.


4.3 Conjugate Gradient Method

The conjugate gradient method uses a method similar to Gram-Schmidt’s orthogonaliza-

tion procedure to generate Q-Conjugate vectors [1]. That is dk^ is constructed as a linear

combination of dk−^1 vectors, with the coefficient βk− 1 chosen such that < dk, Qdk−^1 >= 0.

The conjugate gradient algorithm can be expressed as the following sequence of steps:

epsilon = 0.05 %termination condition r0 = gradient_f1(x0_y0) H = hessian_f1(x0_y0) d0 = -r t0 = - <d0,r0> / <d0,(H d0)> x1_y1 = x0_y0 + t0d r1 = gradient_f1(x1_y1) b0 = <r1,r1>/<r0,r0> d1 = -r1 + b0d

while (norm(gradient_f1(xk_yk)) < epsilon) {

H = hessian_f1(x0_y0) xk_yk = xk-1_yk-1 + tk-1 * dk- rk = gradient_f1(xk_yk) bk-1 = <rk,rk> / <rk-1,rk-1> dk = -rk + bk-1 * dk- tk = - <dk,rk> / <dk,(H dk)> }

Results of Convergence of f1 using the conjugate gradient algorithm whose pseudo-code is given above is:

iteration x1 x2 f1(x1,x2) Norm(gradient) 2 1.4975 2.1115 0.2646 1. 3 1.4275 2.1236 0.1901 0. 4 1.4032 2.1165 0.1843 0. 5 1.3242 1.9980 0.1649 0.

(a) (b)

The minima of f1 found after 14 iterations,

Convergence of f2: The function f2 does not converge using current implementation of conjugate gradient method. The Gradient vector/Hessian becomes abnormally large after a few iterations, due to precision errors while calculating the gradient when the itinerant approaches the minima. Note the direction of approach of itinerant before the abnormal gradient value is headed in the right direction i.e. towards the minima. A better approach would be to use direct methods to calculate next estimate like the polynomial fit thereby circumventing

(a) (b)

The minima of f1 found after 6 iterations,

Results of convergence of f2 using Golden Search method:

The minima of f2 found after 9 iterations,

5.2 Polynomial Approximation -Quadratic fit method

The algorithm for fitting a quadratic polynomial to known three points a,b,c and function values fa,fb,fc at these points is as follows[1]:

d0 is any direction vector that is normalized such that ||d0|| = 1 d0 = [1/sqrt(2) 1/sqrt(2)]^T %(say) x0_y0 = [2 2]^T %initial point t0 = 0.15 %(say) assumed initial step size fa = f(x0_y0) fb = f(x0_y0 + t0.* d0) if fa < fb fc = f(x0_y0 - t0.* d0) else fc = f(x0_y0 + 2t0.d0) while norm(gradient_fl(xk_yk)) < e {

tk = − (^12)

1 f a a^2 1 f b b^2 1 f c c^2

1 a f a 1 b f b 1 c f c

= − 12 (b

(^2) − a (^2) )f a + (c (^2) − a (^2) )f b + (a (^2) − b (^2) )f c (b − c)f a + (c − a)f b + (a − b) ∗ f c =^ −^

α 1 2 α 2

Note: For the algorithm to converge:

α 2 = (c^ −^ b) (f aa −+ ( b)(a^ b− −^ c )cf b)(c^ + ( − ab)^ − c)f c> 0

xk+1^ = xk^ + tkd 0

} The essence of the above algorithm is in approximating the neighbourhood of f(x) with a quadratic polynomial:

f (x + tkd 0 ) ≈ α 0 + α 1 tk + α 2 t^2 k

Results of convergence of f1 using quadratic approximation: iteration x1 x2 f1(x1,x2) Norm(gradient) 2 1.1923 1.1923 0.0896 1. 3 1.0413 1.0413 0.0036 0. 4 1.0024 1.0024 0.0000 0.


6 Observations and interpretation of results of differ-

ent methods

The programming experience and visually seeing the convergence of different algorithms

from program output or through plots helped in understanding the different methods viz.;

the gradient and direct search methods. Here are the observations of the exercise:

  • The contour plots(figure 1) of f 1 and f 2 indicate they have a relative minima at [1 1]T^.

It is also apparent from the expressions for the functions given by equations 3.1.

  • The constant step-size steepest descent method on f 1 converged to the minima in 39

iterations,while the variable step-size method though more complex than the first was a

clear improvement with convergence in 30 iterations. Note: If the sequence of steps for

the variable step-size was taken to the limit, it would be the optimal step-size method

(ideally the best method but computationally expensive)

  • The Rosenbrock function f 2 did not converge for steepest descent and conjugate gra-

dient methods. The method was unable to locate a descent direction to iterate upon

for the former, see results of section 4.1. While in the later, though the algorithm

heads in the right direction i.e. towards the minima, precision errors in calculating the

gradient vector close to zero makes the algorithm go awry, resulting in abnormally high

gradients in the opposite direction - see figure 4 for the partial success of the current

implementation.

  • The Newton-Raphson method like conjugate gradient method, though computationally

expensive involving the calculation of the first and second variants of the functions at

every iteration, converged to the minima with least number of iterations of all the

methods. f 1 converged in 4 iterations, while f 2 converged in 3 iterations.

  • The direct search methods were the computationally least expensive methods, as they

did not involve computations of Gradients/Hessians. The complexity of the meth-

ods increase from Golden-search to Quadratic fit, While the Golden search relies on

the limiting behavior of the Fibonacci sequence in determining the next itinerant,the

Quadratic fit locates the next itinerant by minimizing a fitted quadratic polynomial

through the known values of the function evaluated at the three known points.

  • The Quadratic fit method converged to the minima in 4 iterations on f 1 test function,

while it converged to the minima in 6 iterations on the f 2 test function

7 Conclusion

The unconstrained optimization problem of finding the relative minima x∗, of f(x) in Rn

was studied in this report. Various methods including gradient methods and direct search

methods were evaluated for the given test functions f 1 and f 2 , see previous section 6 for a

summary of the interpretation on the results.

References

[1] M. Aoki, Introduction to Optimization Techniques, The Macmillan Company, 1971.

[2] E. K. P. Chong and S. H. Zak, An Introduction to Optimization Second Edition,

Wiley-Intersciences Series, 2001.

[3] D. G. Luenberger, Introduction to Linear and Nonlinear Programming, Addison-

Wesley, 1972.

[4] S. A. Marwan, Lecture notes. ECE-2671 fall 2005.

A Matlab Code for the Project

The code for testing the various algorithms on f 1 and f 2 functions are identical, the only

changes are in the call to appropriate functions, for example Newton-Raphson algorithm

tested on f 2 , would call ’gradient f 2 ’ instead of ’gradient f 1 ’, and similarly call appropriate

functions depending on whether the test is on f 1 or f 2. Since code is identical, the code for

various algorithms tested on f 1 is provided here in the annex:

A.1 Code for Contour Plots of functions

%contour plots By Narayanan Krishnamurthy %For Dr.Simaan ece 2671 class clear,clf,clc n = 30; %# of contours format long g [X,Y] = meshgrid(-1:.02:2,-1.4:.02:4); Z = (X.^2 - Y).^2 + (X - ones(size(X))).^2; %Then, generate a contour plot of Z. [C,h] = contour(X,Y,Z,n);

break; end

disp(sprintf(’%-4d\t\t%3.4f\t\t\t%3.4f\t\t%3.4f\t\t%3.4f’,i,xk_yk(i,1),xk_yk(i,2), f1(xk_yk(i,:)),norm(gradient_f1(xk_yk(i,:))))); if norm(gradient_f1(xk_yk(i,:))) < e disp(’----------------------------------------------------------------------’); disp(sprintf(’The minima of f1 found after %d iterations,’,i)); disp(sprintf(’using constant step of %f, gradient methods are x1=%f x2=%f,’,t, xk_yk(i,1),xk_yk(i,2))); disp(sprintf(’and the min value of function is =%f’, f1(xk_yk(i,:)))); disp(’----------------------------------------------------------------------’); break;

end end

n = 30; %# of contours format long g [X,Y] = meshgrid(-1:.02:2,-1.4:.02:4); Z = (X.^2 - Y).^2 + (X - ones(size(X))).^2; %Then, generate a contour plot of Z. [C,h] = contour(X,Y,Z,n); clabel(C,h),xlabel(’x_1’,’Fontsize’,18),ylabel(’x_2’,’Fontsize’,18), title(sprintf(’f_1(x_1,x_2),Const Stepsize=%1.3f’,t),’Fontsize’,18); grid on

hold on; convergence = [x0_y0’ xk_yk’]; %scatter(convergence(1,:),convergence(2,:)); plot(convergence(1,:),convergence(2,:),’-ro’);

A.3 Code for Variable step size Steepest Descent Method

%Variable Step Size Steepest Descent Method, Narayanan Krishnamurthy %for ee2671 fall 2005 clear,clf,clc

%Gradient methods f clear; echo off; format long g; % initial point

x0_y0 = [2 2]; % termination point e = 0.05; N =1000; % constant step size tf1(1) = 0.09; tf1(2) =0.15; tf1(3) =0.2; t = check_min_t_f1(tf1(1),tf1(2),tf1(3),x0_y0); xk_yk(1,:) = x0_y0 - tf1(t).gradient_f1(x0_y0); disp(’iteration x1 x2 f1(x1,x2) Norm(gradient)’); for i = 2:N t = check_min_t_f1(tf1(1),tf1(2),tf1(3),xk_yk(i-1,:)); xk_yk(i,:) = xk_yk(i-1,:) - tf1(t).gradient_f1(xk_yk(i-1,:));

if f1(xk_yk(i,:)) > f1(xk_yk(i-1,:)) disp(’not a descent direction ... exiting’); disp(sprintf(’The extremum could not be located after %d iterations’,i)); break; end

disp(sprintf(’%-4d\t\t%3.4f\t\t\t%3.4f\t\t%3.4f\t\t%3.4f’,i,xk_yk(i,1), xk_yk(i,2),f1(xk_yk(i,:)),norm(gradient_f1(xk_yk(i,:)))));

if norm(gradient_f1(xk_yk(i,:))) < e disp(’----------------------------------------------------------------------’); disp(sprintf(’The minima of f1 found after %d iterations,’,i)); disp(sprintf(’using Variable Stepsizes chosen from =%1.3f,%1.3f,%1.3f, gradient method are x1=%f x2=%f,’, tf1(1),tf1(2),tf1(3),xk_yk(i,1),xk_yk(i,2))); disp(sprintf(’and the min value of function is =%f’, f1(xk_yk(i,:)))); disp(’----------------------------------------------------------------------’); break;

end end

n = 30; %# of contours format long g [X,Y] = meshgrid(-1:.02:2,-1.4:.02:4); Z = (X.^2 - Y).^2 + (X - ones(size(X))).^2; %Then, generate a contour plot of Z. [C,h] = contour(X,Y,Z,n); clabel(C,h),xlabel(’x_1’,’Fontsize’,18),ylabel(’x_2’,’Fontsize’,18), title(sprintf(’f_1(x_1,x_2) Variable Stepsizes chosen from =