FORCES
FORtran lib for Comp. Env. Sys.
|
Find initial temperature for simulated annealing. More...
Public Member Functions | |
real(dp) function | gettemperature_dp (eval, cost, paraset, acc_goal, prange, prange_func, samplesize, maskpara, seeds, printflag, weight, maxit, undef_funcval) |
Find initial temperature for simulated annealing.
Determines an initial temperature for Simulated Annealing achieving certain acceptance ratio.
Example
User defined function 'cost_dp' which calculates the cost function value for a parameter set (the interface given below has to be used for this function!).
See also test folder for a detailed example, "pf_tests/test_mo_anneal".
Literature
[in] | real(dp), dimension(:) :: paraset | Initial (valid) parameter set. |
[in] | INTERFACE :: eval | Interface calculating the eval function at a given point. |
[in] | INTERFACE :: cost | Interface calculating the cost function at a given point. |
[in] | INTERFACE :: prange_func | Interface for functional ranges. |
[in] | real(dp) :: acc_goal | Acceptance Ratio which has to be achieved. |
[in] | real(dp), dimension(size(para),2), optional :: prange | Lower and upper bound per parameter. |
[in] | INTERFACE, optional :: prange_func | Interface calculating the feasible range for a parameter at a certain point, if ranges are variable. |
[in] | integer(i4), optional :: samplesize | Number of iterations the estimation of temperature is based on. DEFAULT: Max(20_i4*n,250_i4) |
[in] | logical, dimension(size(para)), optional :: maskpara | maskpara(i) = .true. --> parameter is optimized. maskpara(i) = .false. --> parameter is discarded from optimiztaion. DEFAULT: .true. . |
[in] | INTEGER(I4/I8), dimension(2), optional :: seeds | Seeds of random numbers used for random parameter set generation. DEFAULT: dependent on current time. |
[in] | logical, optional :: printflag | If .true. detailed command line output is written. DEFAULT: .false. . |
[in] | real(dp), dimension(size(para,1)), optional :: weight | Vector of weights per parameter. Gives the frequency of parameter to be chosen for optimization (will be scaled to a CDF internally). eg. [1,2,1] --> parameter 2 is chosen twice as often as parameter 1 and 2. DEFAULT: weight = 1.0_dp. |
[in] | logical, optional :: maxit | Minimizing (.false.) or maximizing (.true.) a function. DEFAULT: .false. (minimization). |
[in] | real(dp), optional :: undef_funcval | Objective function value defining invalid model output, e.g. -999.0_dp. |
real(dp) :: temperature | Temperature achieving a certain acceptance ratio in Simulated Annealing. |
prange
) OR flexible parameter range (function interface prange_func
) has to be given in calling sequence.save_state
(random number variables) has to be replaced by i4.cost_dp
and prange_func
are user defined functions. See interface definition. Definition at line 275 of file mo_anneal.f90.
real(dp) function mo_anneal::gettemperature::gettemperature_dp | ( | procedure(eval_interface), intent(in), pointer | eval, |
procedure(objective_interface), intent(in), pointer | cost, | ||
real(dp), dimension(:), intent(in) | paraset, | ||
real(dp), intent(in) | acc_goal, | ||
real(dp), dimension(size(paraset, 1), 2), intent(in), optional | prange, | ||
external subroutine(real(dp), dimension(:), intent(in) paraset, integer(i4), intent(in) ipar, real(dp), dimension(2), intent(out) rangepar), optional | prange_func, | ||
integer(i4), intent(in), optional | samplesize, | ||
logical, dimension(size(paraset, 1)), intent(in), optional | maskpara, | ||
integer(i8), dimension(2), intent(in), optional | seeds, | ||
logical, intent(in), optional | printflag, | ||
real(dp), dimension(size(paraset, 1)), intent(in), optional | weight, | ||
logical, intent(in), optional | maxit, | ||
real(dp), intent(in), optional | undef_funcval | ||
) |
[in] | paraset | a valid parameter set of the model |
[in] | acc_goal | acceptance ratio to achieve |
[in] | prange | lower and upper limit per parameter |
[in] | samplesize | size of random set the acc_estimate is based on. DEFAULT: Max(250, 20*Number paras) |
[in] | maskpara | true if parameter will be optimized. false if parameter is discarded in optimization. DEFAULT: .true. |
[in] | seeds | Seeds of random numbers. DEFAULT: time dependent. |
[in] | printflag | .true. if detailed temperature estimation is printed. DEFAULT: .false. |
[in] | weight | vector of weights per parameter gives the frequency of parameter to be chosen for optimization. DEFAULT: equal weighting |
[in] | maxit | Maxim. or minim. of function maximization = .true., minimization = .false. . DEFAULT: .false. |
[in] | undef_funcval | objective function value occuring if parameter set leads to invalid model results, e.g. -999.0_dp. DEFAULT: not present |
Definition at line 991 of file mo_anneal.f90.
References mo_kind::dp, mo_anneal::gettemperature_dp(), mo_kind::i4, and mo_kind::i8.