Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Added new utility to minimize a non-linear function using the Broyden-Fletcher-Goldfarb-Shanno optimization algorithm. Based on C code I wrote in grad school in 2003 for an Engineering Optimization class.
  • Loading branch information
daminton committed May 13, 2021
1 parent b1727ac commit a84a01c
Show file tree
Hide file tree
Showing 2 changed files with 664 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/modules/module_interfaces.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,22 @@ function util_solve_linear_system(n,A,b) result(x)
real(DP), dimension(:), intent(in) :: b
real(DP), dimension(n) :: x
end function util_solve_linear_system

function util_bfgs(f, N, x1, eps) result(fnum)
use swiftest_globals
implicit none
integer(I4B), intent(in) :: N
interface
pure function f(x) ! Objective function template
import DP
real(DP), dimension(:), intent(in) :: x
real(DP) :: f
end function f
end interface
real(DP), dimension(:), intent(inout) :: x1
real(DP), intent(in) :: eps
integer(I4B) :: fnum
end function util_bfgs
end interface

INTERFACE
Expand Down
Loading

0 comments on commit a84a01c

Please sign in to comment.