0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_anneal::gettemperature Interface Reference

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)
 

Detailed Description

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!).

para = (/ 1.0_dp , 2.0_dp /)
acc_goal = 0.95_dp
prange(1,:) = (/ 0.0_dp, 10.0_dp /)
prange(2,:) = (/ 0.0_dp, 50.0_dp /)
temp = gettemperature(para, cost_dp, acc_goal, prange)

See also test folder for a detailed example, "pf_tests/test_mo_anneal".

Literature

  1. Walid Ben-Ameur. Compututing the Initial Temperature of Simulated Annealing. Comput. Opt. and App. (2004).
Parameters
[in]real(dp), dimension(:) :: parasetInitial (valid) parameter set.
[in]INTERFACE :: evalInterface calculating the eval function at a given point.
[in]INTERFACE :: costInterface calculating the cost function at a given point.
[in]INTERFACE :: prange_funcInterface for functional ranges.
[in]real(dp) :: acc_goalAcceptance Ratio which has to be achieved.
[in]real(dp), dimension(size(para),2), optional :: prangeLower and upper bound per parameter.
[in]INTERFACE, optional :: prange_funcInterface calculating the feasible range for a parameter at a certain point, if ranges are variable.
[in]integer(i4), optional :: samplesizeNumber of iterations the estimation of temperature is based on.
DEFAULT: Max(20_i4*n,250_i4)
[in]logical, dimension(size(para)), optional :: maskparamaskpara(i) = .true. --> parameter is optimized.
maskpara(i) = .false. --> parameter is discarded from optimiztaion.
DEFAULT: .true. .
[in]INTEGER(I4/I8), dimension(2), optional :: seedsSeeds of random numbers used for random parameter set generation.
DEFAULT: dependent on current time.
[in]logical, optional :: printflagIf .true. detailed command line output is written. DEFAULT: .false. .
[in]real(dp), dimension(size(para,1)), optional :: weightVector 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 :: maxitMinimizing (.false.) or maximizing (.true.) a function.
DEFAULT: .false. (minimization).
[in]real(dp), optional :: undef_funcvalObjective function value defining invalid model output, e.g. -999.0_dp.
Return values
real(dp) :: temperatureTemperature achieving a certain acceptance ratio in Simulated Annealing.
Note
  • Either fixed parameter range (prange) OR flexible parameter range (function interface prange_func) has to be given in calling sequence.
  • Only double precision version available.
  • If single precision is needed not only dp has to be replaced by sp but also i8 of save_state (random number variables) has to be replaced by i4.
  • ParaChangeMode > 1 is not applied in GetTemperature.
  • For Temperature estimation always only one single parameter is changed (ParaChangeMode=1) which should give theoretically always the best estimate.
  • cost_dp and prange_func are user defined functions. See interface definition.
Author
Juliane Mai
Date
May 2012

Definition at line 275 of file mo_anneal.f90.

Member Function/Subroutine Documentation

◆ gettemperature_dp()

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 
)
Parameters
[in]paraseta valid parameter set of the model
[in]acc_goalacceptance ratio to achieve
[in]prangelower and upper limit per parameter
[in]samplesizesize of random set the acc_estimate is based on. DEFAULT: Max(250, 20*Number paras)
[in]maskparatrue if parameter will be optimized. false if parameter is discarded in optimization. DEFAULT: .true.
[in]seedsSeeds of random numbers. DEFAULT: time dependent.
[in]printflag.true. if detailed temperature estimation is printed. DEFAULT: .false.
[in]weightvector of weights per parameter gives the frequency of parameter to be chosen for optimization. DEFAULT: equal weighting
[in]maxitMaxim. or minim. of function maximization = .true., minimization = .false. . DEFAULT: .false.
[in]undef_funcvalobjective 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.

Here is the call graph for this function:

The documentation for this interface was generated from the following file: