130 subroutine cauchy(n, x, l, u, nbd, g, iorder, iwhere, t, d, xcp,
131 + m, wy, ws, sy, wt, theta, col, head, p, c, wbp,
132 + v, nseg, iprint, sbgnrm, info, epsmch)
134 integer n, m, head, col, nseg, iprint, info,
135 + nbd(n), iorder(n), iwhere(n)
136 double precision theta, epsmch,
137 + x(n), l(n), u(n), g(n), t(n), d(n), xcp(n),
138 + wy(n, col), ws(n, col), sy(m, m),
139 + wt(m, m), p(2*m), c(2*m), wbp(2*m), v(2*m)
167 logical xlower,xupper,bnded
168 integer i,j,col2,nfree,nbreak,pointr,
169 + ibp,nleft,ibkmin,iter
170 double precision f1,f2,dt,dtm,tsum,dibp,zibp,dibp2,bkmin,
171 + tu,tl,wmc,wmp,wmw,ddot,tj,tj0,neggi,sbgnrm,
173 double precision one,zero
174 parameter (one=1.0d0,zero=0.0d0)
180 if (sbgnrm .le. zero)
then
181 if (iprint .ge. 0)
write (6,*)
'Subgnorm = 0. GCP = X.'
182 call dcopy(n,x,1,xcp,1)
192 if (iprint .ge. 99)
write (6,3010)
206 if (iwhere(i) .ne. 3 .and. iwhere(i) .ne. -1)
then
209 if (nbd(i) .le. 2) tl = x(i) - l(i)
210 if (nbd(i) .ge. 2) tu = u(i) - x(i)
214 xlower = nbd(i) .le. 2 .and. tl .le. zero
215 xupper = nbd(i) .ge. 2 .and. tu .le. zero
220 if (neggi .le. zero) iwhere(i) = 1
221 else if (xupper)
then
222 if (neggi .ge. zero) iwhere(i) = 2
224 if (abs(neggi) .le. zero) iwhere(i) = -3
228 if (iwhere(i) .ne. 0 .and. iwhere(i) .ne. -1)
then
232 f1 = f1 - neggi*neggi
235 p(j) = p(j) + wy(i,pointr)* neggi
236 p(col + j) = p(col + j) + ws(i,pointr)*neggi
237 pointr = mod(pointr,m) + 1
239 if (nbd(i) .le. 2 .and. nbd(i) .ne. 0
240 + .and. neggi .lt. zero)
then
244 t(nbreak) = tl/(-neggi)
245 if (nbreak .eq. 1 .or. t(nbreak) .lt. bkmin)
then
249 else if (nbd(i) .ge. 2 .and. neggi .gt. zero)
then
254 if (nbreak .eq. 1 .or. t(nbreak) .lt. bkmin)
then
262 if (abs(neggi) .gt. zero) bnded = .false.
271 if (theta .ne. one)
then
273 call dscal(col,theta,p(col+1),1)
278 call dcopy(n,x,1,xcp,1)
280 if (nbreak .eq. 0 .and. nfree .eq. n + 1)
then
282 if (iprint .gt. 100)
write (6,1010) (xcp(i), i = 1, n)
297 call bmv(m,sy,wt,col,p,v,info)
298 if (info .ne. 0)
return
299 f2 = f2 - ddot(col2,v,1,p,1)
305 +
write (6,*)
'There are ',nbreak,
' breakpoints '
309 if (nbreak .eq. 0)
goto 888
325 if (iter .eq. 1)
then
332 if (iter .eq. 2)
then
335 if (ibkmin .ne. nbreak)
then
336 t(ibkmin) = t(nbreak)
337 iorder(ibkmin) = iorder(nbreak)
342 call hpsolb(nleft,t,iorder,iter-2)
349 if (dt .ne. zero .and. iprint .ge. 100)
then
350 write (6,4011) nseg,f1,f2
357 if (dtm .lt. dt)
goto 888
367 if (dibp .gt. zero)
then
368 zibp = u(ibp) - x(ibp)
372 zibp = l(ibp) - x(ibp)
376 if (iprint .ge. 100)
write (6,*)
'Variable ',ibp,
' is fixed.'
377 if (nleft .eq. 0 .and. nbreak .eq. n)
then
392 f1 = f1 + dt*f2 + dibp2 - theta*dibp*zibp
393 f2 = f2 - theta*dibp2
397 call daxpy(col2,dt,p,1,c,1)
403 wbp(j) = wy(ibp,pointr)
404 wbp(col + j) = theta*ws(ibp,pointr)
405 pointr = mod(pointr,m) + 1
409 call bmv(m,sy,wt,col,wbp,v,info)
410 if (info .ne. 0)
return
411 wmc = ddot(col2,c,1,v,1)
412 wmp = ddot(col2,p,1,v,1)
413 wmw = ddot(col2,wbp,1,v,1)
416 call daxpy(col2,-dibp,wbp,1,p,1)
420 f2 = f2 + 2.0d0*dibp*wmp - dibp2*wmw
423 f2 = max(epsmch*f2_org,f2)
424 if (nleft .gt. 0)
then
439 if (iprint .ge. 99)
then
441 write (6,*)
'GCP found in this segment'
442 write (6,4010) nseg,f1,f2
445 if (dtm .le. zero) dtm = zero
451 call daxpy(n,tsum,d,1,xcp,1)
458 if (col .gt. 0)
call daxpy(col2,dtm,p,1,c,1)
459 if (iprint .gt. 100)
write (6,1010) (xcp(i),i = 1,n)
460 if (iprint .ge. 99)
write (6,2010)
462 1010
format (
'Cauchy X = ',/,(4x,1p,6(1x,d11.4)))
463 2010
format (/,
'---------------- exit CAUCHY----------------------',/)
464 3010
format (/,
'---------------- CAUCHY entered-------------------')
465 4010
format (
'Piece ',i3,
' --f1, f2 at start point ',1p,2(1x,d11.4))
466 4011
format (/,
'Piece ',i3,
' --f1, f2 at start point ',
468 5010
format (
'Distance to the next break point = ',1p,d11.4)
469 6010
format (
'Distance to the stationary point = ',1p,d11.4)
subroutine bmv(m, sy, wt, col, v, p, info)
This subroutine computes the product of the 2m x 2m middle matrix in the compact L-BFGS formula of B ...
subroutine cauchy(n, x, l, u, nbd, g, iorder, iwhere, t, d, xcp, m, wy, ws, sy, wt, theta, col, head, p, c, wbp, v, nseg, iprint, sbgnrm, info, epsmch)
Compute the Generalized Cauchy Point along the projected gradient direction.
subroutine hpsolb(n, t, iorder, iheap)
This subroutine sorts out the least element of t, and puts the remaining elements of t in a heap.