209 integer,
parameter :: n = 25, m = 5, iprint = 1
210 integer,
parameter :: dp = kind(1.0d0)
211 real(dp),
parameter :: factr = 1.0d+7, pgtol = 1.0d-5
213 character(len=60) :: task, csave
217 real(dp) :: dsave(29)
218 integer,
allocatable :: nbd(:), iwa(:)
219 real(dp),
allocatable :: x(:), l(:), u(:), g(:), wa(:)
228 allocate ( nbd(n), x(n), l(n), u(n), g(n) )
229 allocate ( iwa(3*n) )
230 allocate ( wa(2*m*n + 5*n + 11*m*m + 8*m) )
253 16
format(/,5x,
'Solving sample problem.', &
254 /,5x,
' (f = 0.0 at the optimal solution.)',/)
262 do while(task(1:2).eq.
'FG'.or.task.eq.
'NEW_X'.or. &
267 call setulb( n, m, x, l, u, nbd, f, g, factr, pgtol, &
268 wa, iwa, task, iprint,&
269 csave, lsave, isave, dsave )
271 if (task(1:2) .eq.
'FG')
then
273 f=.25d0*( x(1)-1.d0 )**2
275 f = f + ( x(i)-x(i-1 )**2 )**2
282 g(1) = 2.d0*(x(1) - 1.d0) - 1.6d1*x(1)*t1
285 t1 = x(i+1) - x(i)**2
286 g(i) = 8.d0*t2 - 1.6d1*x(i)*t1