131 subroutine cauchy(n, x, l, u, nbd, g, iorder, iwhere, t, d, xcp,
132 + m, wy, ws, sy, wt, theta, col, head, p, c, wbp,
133 + v, nseg, iprint, sbgnrm, epsmch)
135 integer n, m, head, col, nseg, iprint,
136 + nbd(n), iorder(n), iwhere(n)
137 double precision theta, epsmch,
138 + x(n), l(n), u(n), g(n), t(n), d(n), xcp(n),
139 + wy(n, col), ws(n, col), sy(m, m),
140 + wt(m, m), p(2*m), c(2*m), wbp(2*m), v(2*m)
168 logical xlower,xupper,bnded
169 integer i,j,col2,nfree,nbreak,pointr,
170 + ibp,nleft,ibkmin,iter
171 double precision f1,f2,dt,dtm,tsum,dibp,zibp,dibp2,bkmin,
172 + tu,tl,wmc,wmp,wmw,ddot,tj,tj0,neggi,sbgnrm,
174 double precision one,zero
175 parameter (one=1.0d0,zero=0.0d0)
181 if (sbgnrm .le. zero)
then
182 if (iprint .ge. 0)
write (6,*)
'Subgnorm = 0. GCP = X.'
183 call dcopy(n,x,1,xcp,1)
193 if (iprint .ge. 99)
write (6,3010)
207 if (iwhere(i) .ne. 3 .and. iwhere(i) .ne. -1)
then
210 if (nbd(i) .le. 2) tl = x(i) - l(i)
211 if (nbd(i) .ge. 2) tu = u(i) - x(i)
215 xlower = nbd(i) .le. 2 .and. tl .le. zero
216 xupper = nbd(i) .ge. 2 .and. tu .le. zero
221 if (neggi .le. zero) iwhere(i) = 1
222 else if (xupper)
then
223 if (neggi .ge. zero) iwhere(i) = 2
225 if (abs(neggi) .le. zero) iwhere(i) = -3
229 if (iwhere(i) .ne. 0 .and. iwhere(i) .ne. -1)
then
233 f1 = f1 - neggi*neggi
236 p(j) = p(j) + wy(i,pointr)* neggi
237 p(col + j) = p(col + j) + ws(i,pointr)*neggi
238 pointr = mod(pointr,m) + 1
240 if (nbd(i) .le. 2 .and. nbd(i) .ne. 0
241 + .and. neggi .lt. zero)
then
245 t(nbreak) = tl/(-neggi)
246 if (nbreak .eq. 1 .or. t(nbreak) .lt. bkmin)
then
250 else if (nbd(i) .ge. 2 .and. neggi .gt. zero)
then
255 if (nbreak .eq. 1 .or. t(nbreak) .lt. bkmin)
then
263 if (abs(neggi) .gt. zero) bnded = .false.
272 if (theta .ne. one)
then
274 call dscal(col,theta,p(col+1),1)
279 call dcopy(n,x,1,xcp,1)
281 if (nbreak .eq. 0 .and. nfree .eq. n + 1)
then
283 if (iprint .gt. 100)
write (6,1010) (xcp(i), i = 1, n)
298 call bmv(m,sy,wt,col,p,v)
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)
410 wmc = ddot(col2,c,1,v,1)
411 wmp = ddot(col2,p,1,v,1)
412 wmw = ddot(col2,wbp,1,v,1)
415 call daxpy(col2,-dibp,wbp,1,p,1)
419 f2 = f2 + 2.0d0*dibp*wmp - dibp2*wmw
422 f2 = max(epsmch*f2_org,f2)
423 if (nleft .gt. 0)
then
438 if (iprint .ge. 99)
then
440 write (6,*)
'GCP found in this segment'
441 write (6,4010) nseg,f1,f2
444 if (dtm .le. zero) dtm = zero
450 call daxpy(n,tsum,d,1,xcp,1)
457 if (col .gt. 0)
call daxpy(col2,dtm,p,1,c,1)
458 if (iprint .gt. 100)
write (6,1010) (xcp(i),i = 1,n)
459 if (iprint .ge. 99)
write (6,2010)
461 1010
format (
'Cauchy X = ',/,(4x,1p,6(1x,d11.4)))
462 2010
format (/,
'---------------- exit CAUCHY----------------------',/)
463 3010
format (/,
'---------------- CAUCHY entered-------------------')
464 4010
format (
'Piece ',i3,
' --f1, f2 at start point ',1p,2(1x,d11.4))
465 4011
format (/,
'Piece ',i3,
' --f1, f2 at start point ',
467 5010
format (
'Distance to the next break point = ',1p,d11.4)
468 6010
format (
'Distance to the stationary point = ',1p,d11.4)
subroutine bmv(m, sy, wt, col, v, p)
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, 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.