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

Anneal optimization of cost function. More...

Data Types

interface  anneal
 Optimize cost function with simulated annealing. More...
 
interface  generate_neighborhood_weight
 
interface  gettemperature
 Find initial temperature for simulated annealing. More...
 

Functions/Subroutines

real(dp) function, dimension(size(para, 1)) anneal_dp (eval, cost, para, prange, prange_func, temp, dt, nitermax, len, nst, eps, acc, seeds, printflag, maskpara, weight, changeparamode, reflectionflag, pertubflexflag, maxit, undef_funcval, tmp_file, funcbest, history)
 
real(dp) function gettemperature_dp (eval, cost, paraset, acc_goal, prange, prange_func, samplesize, maskpara, seeds, printflag, weight, maxit, undef_funcval)
 
real(dp) function pargen_anneal_dp (old, dmax, omin, omax, rn)
 
real(dp) function pargen_dds_dp (old, perturb, omin, omax, rn)
 
real(dp) function dchange_dp (delta, idigit, iszero)
 
subroutine generate_neighborhood_weight_dp (truepara, cum_weight, save_state_xor, itotalcounter, nitermax, neighborhood)
 

Detailed Description

Anneal optimization of cost function.

Minimization of cost function and temperature finding of minima.

Changelog
  • Juliane Mai, Mar 2012
    • module implementation
  • Juliane Mai, May 2012
    • anneal: sp version
  • Juliane Mai, May 2012
    • anneal: documentation
  • Juliane Mai, May 2012
    • GetTemperature: sp and dp version
  • Juliane Mai, Jun 2012
    • weighted parameter selection
  • Juliane Mai, Aug 2012
    • function anneal instead of subroutine
    • using new module get_timeseed as default for seeding
    • new optional for minimization or maximization
    • fixed parameter ranges possible instead of interface range
  • Juliane Mai, Nov 2012
    • history of achieved objective function values as optional out only in anneal but not anneal_valid
  • Juliane Mai, Jan 2013
    • including DDS features in anneal, i.e. reflection at parameter boundaries, different parameter selection modes (one, all, neighborhood), and different parameter pertubation modes (flexible r=dR (anneal version) or constant r=0.2 (dds version))
    • remove sp versions
    • fixed and flexible parameter ranges are now in one function using optional arguments
    • undef_funcval instead of anneal_valid function
  • Juliane Mai, Feb 2013
    • xor4096 optionals combined in save_state
  • Arya Prasetya, Dec 2021
    • doxygen documentation anneal and get_temperature
Author
Juliane Mai
Date
Mar 2012

Function/Subroutine Documentation

◆ anneal_dp()

real(dp) function, dimension(size(para, 1)) mo_anneal::anneal_dp ( procedure(eval_interface), intent(in), pointer  eval,
procedure(objective_interface), intent(in), pointer  cost,
real(dp), dimension(:), intent(in)  para,
real(dp), dimension(size(para, 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,
real(dp), intent(in), optional  temp,
real(dp), intent(in), optional  dt,
integer(i4), intent(in), optional  nitermax,
integer(i4), intent(in), optional  len,
integer(i4), intent(in), optional  nst,
real(dp), intent(in), optional  eps,
real(dp), intent(in), optional  acc,
integer(i8), dimension(3), intent(in), optional  seeds,
logical, intent(in), optional  printflag,
logical, dimension(size(para, 1)), intent(in), optional  maskpara,
real(dp), dimension(size(para, 1)), intent(in), optional  weight,
integer(i4), intent(in), optional  changeparamode,
logical, intent(in), optional  reflectionflag,
logical, intent(in), optional  pertubflexflag,
logical, intent(in), optional  maxit,
real(dp), intent(in), optional  undef_funcval,
character(len = *), intent(in), optional  tmp_file,
real(dp), intent(out), optional  funcbest,
real(dp), dimension(:, :), intent(out), optional, allocatable  history 
)
private
Parameters
[in]parainitial parameter
[in]prangelower and upper limit per parameter
[in]tempstarting temperature (DEFAULT: Get_Temperature)
[in]dtgeometrical decreement, 0.7<DT<0.999 (DEFAULT: 0.9)
[in]nitermaxmaximal number of iterations (DEFAULT: 1000)
[in]lenLength of Markov Chain, DEFAULT: max(250, size(para,1))
[in]nstNumber of consecutive LEN steps! (DEFAULT: 5)
[in]epsepsilon decreement of cost function (DEFAULT: 0.01)
[in]accAcceptance Ratio, <0.1 stopping criteria (DEFAULT: 0.1)
[in]seedsSeeds of random numbers (DEFAULT: Get_timeseed)
[in]printflagIf command line output is written (.true.) (DEFAULT: .false.)
[in]maskparatrue if parameter will be optimized false if parameter is discarded in optimization (DEFAULT: .true.)
[in]weightvector of weights per parameter gives the frequency of parameter to be chosen for optimization (DEFAULT: uniform)
[in]changeparamodewhich and how many param. are changed in a step 1 = one parameter 2 = all parameter 3 = neighborhood parameter (DEFAULT: 1_i4)
[in]reflectionflagif new parameter values are selected normal distributed and reflected (.true.) or uniform in range (.false.) (DEFAULT: .false.)
[in]pertubflexflagif pertubation of normal distributed parameter values is constant 0.2 (.false.) or depends on dR (.true.) (DEFAULT: .true.)
[in]maxitMaximization or minimization of function maximization = .true., minimization = .false. (DEFAULT: .false.)
[in]undef_funcvalobjective function value occuring if parameter set leads to invalid model results, e.g. -9999.0_dp! (DEFAULT: not present)
[in]tmp_filefile for temporal output
[out]funcbestminimized value of cost function (DEFAULT: not present)
[out]historyreturns a vector of achieved objective! after ith model evaluation (DEFAULT: not present)
Returns
parameter set minimizing objective

Definition at line 289 of file mo_anneal.f90.

◆ dchange_dp()

real(dp) function mo_anneal::dchange_dp ( real(dp), intent(in)  delta,
integer(i4), intent(in)  idigit,
integer(i4), intent(in)  iszero 
)
private

Definition at line 1319 of file mo_anneal.f90.

◆ generate_neighborhood_weight_dp()

subroutine mo_anneal::generate_neighborhood_weight_dp ( integer(i4), dimension(:), intent(in)  truepara,
real(dp), dimension(:), intent(in)  cum_weight,
integer(i8), dimension(n_save_state), intent(inout)  save_state_xor,
integer(i4), intent(in)  itotalcounter,
integer(i4), intent(in)  nitermax,
logical, dimension(size(cum_weight)), intent(out)  neighborhood 
)
private

Definition at line 1344 of file mo_anneal.f90.

◆ gettemperature_dp()

real(dp) function mo_anneal::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 
)
private
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.

Referenced by mo_anneal::gettemperature::gettemperature_dp().

Here is the caller graph for this function:

◆ pargen_anneal_dp()

real(dp) function mo_anneal::pargen_anneal_dp ( real(dp), intent(in)  old,
real(dp), intent(in)  dmax,
real(dp), intent(in)  omin,
real(dp), intent(in)  omax,
real(dp), intent(in)  rn 
)
private

Definition at line 1252 of file mo_anneal.f90.

◆ pargen_dds_dp()

real(dp) function mo_anneal::pargen_dds_dp ( real(dp), intent(in)  old,
real(dp), intent(in)  perturb,
real(dp), intent(in)  omin,
real(dp), intent(in)  omax,
real(dp), intent(in)  rn 
)
private

Definition at line 1292 of file mo_anneal.f90.