229       integer,  
parameter    :: dp = kind(1.0d0)
 
  230       integer, 
intent(in) :: n 
 
  231       real(kind=dp), 
intent(in) :: factr_in
 
  232       real(kind=dp), 
intent(in) :: pgtol_in
 
  233       real(kind=dp), 
dimension(n), 
intent(inout) :: x
 
  234       integer, 
dimension(n), 
intent(in) :: nbd
 
  235       real(kind=dp), 
dimension(n), 
intent(in) :: l
 
  236       real(kind=dp), 
dimension(n), 
intent(in) :: u
 
  238       integer,  
parameter    :: m = 5, iprint = 1
 
  240       real(dp)               :: factr  = 1.0d+7, pgtol  = 1.0d-5
 
  242       character(len=60)      :: task, csave
 
  246       real(dp)               :: dsave(29)
 
  247       integer,  
allocatable  :: iwa(:)
 
  248       real(dp), 
allocatable  :: g(:), wa(:)
 
  259       allocate ( iwa(3*n) )
 
  260       allocate ( wa(2*m*n + 5*n + 11*m*m + 8*m) )
 
  264   16  
format(/,5x, 
'Solving sample problem.', &
 
  265              /,5x, 
' (f = 0.0 at the optimal solution.)',/)               
 
  273       do while(task(1:2).eq.
'FG'.or.task.eq.
'NEW_X'.or. &
 
  278          call setulb( n, m, x, l, u, nbd, f, g, factr, pgtol, &
 
  279                        wa, iwa, task, iprint,&
 
  280                        csave, lsave, isave, dsave )
 
  282          if (task(1:2) .eq. 
'FG') 
then 
subroutine lbfgsb_sub(n, factr_in, pgtol_in, x, nbd, l, u)
Limited memory BFGS bound constrained optimization code as callable subroutine. 
 
subroutine fcn(n, x, f, g)
This is the subroutine which the optimization routines call to get the objective function value and i...