Hi everyone,
I'm trying to learn how to use IMSL. I have a very simple program that finds a minimum and I would like to make a modification to it.
Right now the function I'm minimizing is
F = 1.0E2*(X(2)-X(1)*X(1))**2 + (1.0E0-X(1))**2
I'm trying to figure out whether is possible to write my own subroutine (minimize1) that uses IMSL and takes a and b as arguments instead of having 1.0E2 and 1.0E0 as numbers in F.
Is this posible?
Thanks!!
I'm trying to learn how to use IMSL. I have a very simple program that finds a minimum and I would like to make a modification to it.
Right now the function I'm minimizing is
F = 1.0E2*(X(2)-X(1)*X(1))**2 + (1.0E0-X(1))**2
I'm trying to figure out whether is possible to write my own subroutine (minimize1) that uses IMSL and takes a and b as arguments instead of having 1.0E2 and 1.0E0 as numbers in F.
Is this posible?
Thanks!!
Code:
USE BCONF_INT
USE UMACH_INT
IMPLICIT NONE
INTEGER N
PARAMETER (N=2)
!
INTEGER IPARAM(7), ITP, L, NOUT
REAL F, FSCALE, RPARAM(7), X(N), XGUESS(N), &
XLB(N), XSCALE(N), XUB(N)
EXTERNAL ROSBRK
!
DATA XGUESS/-1.2E0, 1.0E0/
DATA XLB/-2.0E0, -1.0E0/, XUB/0.5E0, 2.0E0/
! All the bounds are provided
ITP = 0
! Default parameters are used
IPARAM(1) = 0
! Minimize Rosenbrock function using
! initial guesses of -1.2 and 1.0
CALL BCONF (ROSBRK, ITP, XLB, XUB, X, XGUESS=XGUESS, &
iparam=iparam, FVALUE=F)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) X, F, (IPARAM(L),L=3,5)
!
99999 FORMAT (' The solution is ', 6X, 2F8.3, //, ' The function ', &
'value is ', F8.3, //, ' The number of iterations is ', &
10X, I3, /, ' The number of function evaluations is ', &
I3, /, ' The number of gradient evaluations is ', I3)
!
END
!
SUBROUTINE ROSBRK (N, X, F)
INTEGER N
REAL X(N), F
!
F = 1.0E2*(X(2)-X(1)*X(1))**2 + (1.0E0-X(1))**2
!
RETURN
END