One-dimensional minimizers
One-dimensional minimization is performed by descendants of o2scl::min_base . There are two one-dimensional minimization algorithms, o2scl::min_cern and o2scl::min_brent_gsl, and they are both bracketing algorithms type where an interval and an initial guess must be provided. If only an initial guess and no bracket is given, these two classes will attempt to find a suitable bracket from the initial guess. While the o2scl::min_base base class is designed to allow future descendants to optionally use derivative information, this is not yet supported for any one-dimensional minimizers.
Multi-dimensional minimizers
Multi-dimensional minimization is performed by descendants of o2scl::mmin_base. O2scl includes a simplex minimizer (o2scl::mmin_simp2), traditional minimizers which use gradient information (o2scl::mmin_conp, o2scl::mmin_conf, and o2scl::mmin_bfgs2), and differential evolution minimizers (o2scl::diff_evo and o2scl::diff_evo_adapt). Minimization by simulated annealing is included and described in the Simulated Annealing section. Constrained minimization is also included and described in separately in Constrained Minimization.
See an example for the usage of the multi-dimensional minimizers in the Multidimensional minimizer example below.
Simplex minimizer
The class o2scl::mmin_simp2 minimizes a function using the Nelder-Mead simplex algorithm and does not require any information about the gradient. It is based on GSL and has been updated with the new "simplex2" method from GSL-1.12.
Restarts of the simplex minimizer are sometimes required to find the correct minimum, and o2scl::mmin_simp2 can get caught in infinite loops, especially for functions which have symmetries directly related to one or more of the parameters.
Traditional minimizers with gradient information
Classes o2scl::mmin_conp, o2scl::mmin_conf, and o2scl::mmin_bfgs2 are intended for use when the gradient of the function is available, but they can also automaticallly compute the gradient numerically. The standard way to provide the gradient is to use an object of type o2scl::grad_funct11 . The user may specify the automatic gradient object of type o2scl::gradient which is used by the minimizer to compute the gradient numerically when a function is not specified.
Generally, when a closed expression is available for the gradient, o2scl::mmin_bfgs2 is likely the best choice. However, the simplex methods can be more robust for sufficiently difficult functions.
It is important to note that not all of the minimization routines test the second derivative to ensure that it doesn't vanish to ensure that we have indeed found a true minimum.
Fixing Parameters
The class o2scl::mmin_fix_params provides a convenient way of fixing some of the parameters and minimizing over others, without requiring a the function interface to be rewritten. An example is given in the Minimizer fixing variables example below.
This example uses the O2scl minimizers based on GSL to minimize a rather complicated three-dimensional function which has constant level surfaces which look like springs oriented along the z-axis. This example function, originally created here for O2scl , was added later to the GSL library minimization test functions.
This example uses the o2scl::mmin_fix_params class to minimize the function
while fixing some of the parameters.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).