Module objectiveFunctions Use ISO_FORTRAN_ENV, ONLY: WP=>REAL64 Implicit NONE Type, ABSTRACT :: objective_function_t Contains Procedure(objfn), DEFERRED :: fun End Type Type, ABSTRACT :: objective_functions_t Contains Procedure(mobjfn), DEFERRED :: funs End Type Type, ABSTRACT :: objective_function_deriv_t Contains Procedure(derivobjfn), DEFERRED :: fun_deriv End Type Type, ABSTRACT :: constraint_function_t Contains Procedure(consfn), DEFERRED :: confun End Type ABSTRACT INTERFACE Function objfn(this, x) RESULT (f) IMPORT :: objective_function_t, WP Implicit NONE Class(objective_function_t), Intent(INOUT) :: this Real(WP), Intent(IN) :: x(:) Real(WP) :: f End Function objfn Function derivobjfn(this, x) RESULT (fderiv) IMPORT :: objective_function_deriv_t, WP Implicit NONE Class(objective_function_deriv_t), Intent(INOUT) :: this Real(WP), Intent(IN) :: x(:) Real(WP) :: fderiv End Function derivobjfn Subroutine mobjfn(this, x, f) IMPORT :: objective_functions_t, WP Implicit NONE Class(objective_functions_t), Intent(INOUT) :: this Real(WP), Intent(IN) :: x(:,:) Real(WP), Intent(INOUT) :: f(:) End Subroutine mobjfn Subroutine consfn(this, x, penalty, constraint) IMPORT :: constraint_function_t, WP Implicit NONE Class(constraint_function_t), Intent(INOUT) :: this Real(WP), Intent(IN) :: x(:,:) Real(WP), Intent(IN) :: penalty Real(WP), Intent(INOUT) :: constraint(:) End Subroutine consfn End Interface End module objectiveFunctions