if the function is to be minimized, switch the sign of the function. note that all intermediate and final output switches the sign back to eliminate any possible confusion for the user.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(simulated_annealing_type), | intent(in) | :: | me | |||
| real(kind=wp), | intent(in) | :: | f |
pure function func(me,f) class(simulated_annealing_type),intent(in) :: me real(wp),intent(in) :: f real(wp) :: func if (me%maximize) then func = f else func = -f end if end function func