yaeos__optimizers_nelder_mead Module



Variables

Type Visibility Attributes Name Initial
class(*), private, pointer :: in_data

Hidden pointer to special data of the objective function

procedure(obj_func), private, pointer :: obj_fun

Hidden pointer to the objective function to optimize


Derived Types

type, public, extends(Optimizer) ::  NelderMead

Nelder-Mead optimization algorithm. This is a gradient-free optimization algorithm. It is a direct search method that does not require the gradient of the objective function. The algorithm is based on the simplex method of Nelder and Mead (1965). The original source code was taken from (https://people.math.sc.edu/Burkardt/f_src/asa047/asa047.html)

Components

Type Visibility Attributes Name Initial
real(kind=pr), public :: convergence_tolerance = 1e-5
integer, public :: kcount = 1e8

Maximum number of function evaluations

integer, public :: konvge = 1000

Convergence check is carried out every KONVGE iterations

integer, public :: max_iters = 10000

Maxium number of iterations

real(kind=pr), public, allocatable :: parameter_step(:)
real(kind=pr), public :: solver_tolerance = 1e-9_pr
logical, public :: verbose

Type-Bound Procedures

procedure, public :: optimize

Functions

private function foo_wrap(x) result(y)

Wrapper function to use the objective function with the Nelder-Mead algorithm

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: x(:)

Return Value real(kind=pr)


Subroutines

private subroutine nelmin(fn, n, start, xmin, ynewlo, reqmin, step, konvge, kcount, icount, numres, ifault)

Arguments

Type IntentOptional Attributes Name
private function fn(x)
Arguments
Type IntentOptional Attributes Name
real(kind=rk), intent(in), dimension(:) :: x
Return Value real(kind=rk)
integer :: n
real(kind=rk) :: start(n)
real(kind=rk) :: xmin(n)
real(kind=rk) :: ynewlo
real(kind=rk) :: reqmin
real(kind=rk) :: step(n)
integer :: konvge
integer :: kcount
integer :: icount
integer :: numres
integer :: ifault

private subroutine optimize(self, foo, x, F, data)

Optimize the input function

Arguments

Type IntentOptional Attributes Name
class(NelderMead), intent(inout) :: self

Optimizer

procedure(obj_func) :: foo

Objective function

real(kind=pr), intent(inout) :: x(:)

Initial guess and final result

real(kind=pr), intent(out) :: F

Objective function value at final step

class(*), intent(inout), optional, target :: data

Optional data for the objective function