solve optimization problem using simulated annealing from C
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=c_intptr_t), | intent(in), | value | :: | iproblem | ||
| integer(kind=c_int), | intent(in), | value | :: | n | ||
| real(kind=c_double), | intent(inout), | dimension(n) | :: | x | ||
| real(kind=c_double), | intent(in), | value | :: | rt | ||
| real(kind=c_double), | intent(inout) | :: | t | |||
| real(kind=c_double), | intent(inout), | dimension(n) | :: | vm | ||
| real(kind=c_double), | intent(out), | dimension(n) | :: | xopt | ||
| real(kind=c_double), | intent(out) | :: | fopt | |||
| integer(kind=c_int), | intent(out) | :: | nacc | |||
| integer(kind=c_int), | intent(out) | :: | nfcnev | |||
| integer(kind=c_int), | intent(out) | :: | ier |
subroutine solve_simulated_annealing(iproblem, n, x, rt, t, vm, & xopt, fopt, nacc, nfcnev, ier) & bind(C, name="solve_simulated_annealing") integer(c_intptr_t), intent(in), value :: iproblem integer(c_int), intent(in), value :: n real(c_double), dimension(n), intent(inout) :: x real(c_double), intent(in), value :: rt real(c_double), intent(inout) :: t real(c_double), dimension(n), intent(inout) :: vm real(c_double), dimension(n), intent(out) :: xopt real(c_double), intent(out) :: fopt integer(c_int), intent(out) :: nacc integer(c_int), intent(out) :: nfcnev integer(c_int), intent(out) :: ier type(c_sa_wrapper_type), pointer :: wrapper call int_pointer_to_f_pointer(iproblem, wrapper) if (associated(wrapper)) then call wrapper%optimize(x=x, rt=rt, t=t, vm=vm, & xopt=xopt, fopt=fopt, nacc=nacc, & nfcnev=nfcnev, ier=ier) else error stop 'error in solve_simulated_annealing: wrapper or SA class is not associated' end if end subroutine solve_simulated_annealing