• Ingen resultater fundet

Secant version of the L–M method

6. Nonlinear Least Squares Problems 113

6.4. Secant version of the L–M method

f(x+h) ℓ(h) f(x) +f(x)h Solve the linear problem ℓ(h) = 0 xnew:=x+h

(6.23) If we cannot implement f(x), then we can approximate it by

(f(x+δ)f(x))/δ

withδ chosen appropriately small. More generally, we can replace (6.23) by

f(x+h) λ(h) f(x) +g h with gf(x) Solve the linear problem λ(h) = 0

xnew:=x+h

(6.24) Suppose that we already know xprev and f(xprev). Then we can fix the factorg (the approximation tof(x)) by requiring that

f(xprev) = λ(xprevx). This gives

g = (f(x)f(xprev))/(xxprev) ,

and with this choice ofgwe recognize (6.24) as thesecant method, see for instance [18, pp 70f]. The main advantage of the secant method over an alternative finite difference approximation to Newton–Raphson’s method is that we only need one function evaluation per iteration step instead of two.

Now, consider the linear model (6.8) forr:Rn7→Rm, r(x+h) ≃ ℓ(h) ≡ r(x) +J(x)h. We will replace it by

r(x+h) ≃ λ(h) ≡ r(x) +Gh,

whereGis the current approximation toJ(x). In the next iteration we need Bnew so that

r(xnew+h) ≃ r(xnew) +Gnewh.

Especially, we want this model to hold with equality for h =x−xnew, ie

r(x) = r(xnew) +Gnew(x−xnew) . (6.25) This gives us m equations in the m·n unknown elements of Gnew, so we need more conditions. Broyden, [6], suggested to supplement (6.25) with

Gnewv = G v for all v⊥(x−xnew) . (6.26)

132 6. Nonlinear Least Squares It is easy to verify that conditions (6.25)–(6.26) are satisfied by the updating formula discussed in Example 3.6:

Definition 6.27. Broyden’s rank one update

Gnew = G+u hT , where

h=xnew−x , u= 1

hTh(r(xnew)−r(x)−Gh) .

Comparing with Example 6.15 we see that condition (6.25) corre-sponds to the secant condition in the case n= 1. We say that this approach is ageneralized secant method.

A brief sketch of the central part of Algorithm 6.18 with this modi-fication has the form

Solve (GTG+µI)hslm=−GTr(x) xnew :=x+hslm

UpdateGby Definition 6.27

Updateµand xas in Algorithm 6.18

Powell has shown that if the set of vectors x0,x1,x2, . . . converges to xˆ and if the set of steps {hk ≡xk−xk−1} satisfy the condition that {hk−n+1, . . . ,hk} are linearly independent (they span the whole ofRn) for eachk≥n, then the set of approximations {Gk} converges toJ(ˆx), irrespective of the choice ofG0.

In practice, however, it often happens that the previous n steps do not span the whole of Rn, and there is a risk that after some iterations the current Gis such a poor approximation to the true Jacobian, that

−GTr(x) is not even a downhill direction. In that case x will stay unchanged and µ is increased. The approximation G is changed, but may still be a poor approximation, leading to a further increase in µ, etc. Eventually the process is stopped by hslm being so small that the second criterion in (6.17) is satisfied, althoughx may be far fromx.ˆ

A number of strategies have been proposed to overcome this problem, for instance to make occasional recomputations ofGby finite differences.

In Algorithm 6.29 below we supplement the updatings determined by Definition 6.27 with a cyclic, coordinate-wise series of updatings: Leth denote the current step, and letj be the current coordinate number. If the pseudo angle θ between h and e(j) is “large”, then we compute a

6.4. Secant version of the L–M method 133 finite difference approximation to the jth column of J. More specific, this is done if

cosθ = |hTe(j)|

khk · ke(j)k < γ ⇔ |hj| < γkhk. (6.28) Experiments indicated that the (rather pessimistic) choice γ= 0.8 gave good performance. With this choice we can expect that each iteration step needs (almost) two evaluations of the vector function r.

Now we are ready to present the algorithm:

Algorithm 6.29. Secant version of the L–M method begin

k:= 0; x:=x0; G:=G0; j := 0; µ:=µ0 {1} g:=GTr(x); found= (kgk≤ε1)

while (notfound) and(k < kmax) k:=k+1; Solve (GTG+µI)h=−g if khk ≤ε2(kxk+ε2)

found:=true else

j:= mod(j, n)+1; if |hj|<0.8khk {2} Update Gby (6.22), usingxnew=x+ηe(j) {3} xnew:=x+h; UpdateGby 6.27

Updateµ as in Algorithm 6.18 if f(xnew)< f(x)

x:=xnew

g:=GTr(x); found:= (kgk≤ε1) {4} end

Comments:

1 Initialization. µ0 is computed by (6.13). x0, τ, parameters in the stopping criteria (6.17) and the relative step δ (see 3 below) to use in (6.22) are input, and G0 is either input or it is computed by (6.22).

2 Cf (6.28). mod(j, n) is the remainder after division by n.

3 The stepη is given by

if xj = 0 then η:=δ2 else η:=δ|xj|.

134 6. Nonlinear Least Squares 4 Whereas the iterate x is updated only if the descending condition is satisfied, the approximation Gis updated in every step. There-fore the approximate gradient g may change also when r(x) is un-changed.

Example 6.16. We have applied Algorithm 6.29 to the Rosenbrock problem from Example 6.9. If we use the same starting point and stopping criteria as in that example, and take δ= 10−7 in the difference approximation (6.22), we find the solution after 29 iteration steps, involving a total of 53 evaluations ofr(x). For comparison, the “true” L–M algorithm needs only 17 steps, implying a total of 18 evaluations ofr(x) andJ(x).

We have also used the secant algorithm on the data fitting problem from 6.10. With δ= 10−7 and the same starting point and stopping criteria as in Example 6.10 the secant version needed 145 iterations, involving a total of 295 evaluations ofr(x). For comparison, Algorithm 6.18 needs 62 iterations.

These two problems indicate that Algorithm 6.29 is robust, but they also illustrate a general rule of thumb: If gradient information is available, it normally pays to use it.

In many applications the numbersmandnare large, but each of the functionsfi(x) depends only on a few of the elements inx. In such cases most of the ∂x∂fi

j(x) are zero, and we say that J(x) is a sparse matrix. There are efficient methods exploiting sparsity in the solution of the equation (GTG+µI)h = −g, see for instance [17]. In the updating formula in Definition 6.27, however, normally all elements in the vectors handu are nonzero, so thatGnewwill be a dense matrix. It is outside the scope of this book to discuss how to cope with this; we refer to [21], [51] and [44, Chapter 9].

6.5. A secant version of the Dog Leg method

The idea of using a secant approximation to the Jacobian can, of course, also be used in connection with the Dog Leg method from Section 6.3.

In this section we shall consider the special case ofm=n, ie in the solu-tion of nonlinear systems of equasolu-tions. Broyden, [6], not only gave the formula from Definition 6.27 for updating the approximate Jacobian. He also gave a formula for updating an approximate inverse of the Jacobian,

6.5. Secant version of the Dog Leg method 135