hmatrix-gsl-0.19.0.1: Numerical computation

Copyright | (c) Alberto Ruiz 2006-9
License | GPL
Maintainer | Alberto Ruiz
Stability | provisional
Safe Haskell | None
Language | Haskell2010

Numeric.GSL.Minimization

Description

Minimization of a multidimensional function using some of the algorithms described in:

http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html

The example in the GSL manual:

    f [x,y] = 10*(x-1)^2 + 20*(y-2)^2 + 30

    main = do
        let (s,p) = minimize NMSimplex2 1E-2 30 [1,1] f [5,7]
        print s
        print p

    >>> main
    [0.9920430849306288,1.9969168063253182]
     0.000  512.500  1.130  6.500  5.000
     1.000  290.625  1.409  5.250  4.000
     2.000  290.625  1.409  5.250  4.000
     3.000  252.500  1.409  5.500  1.000
     ...
    22.000   30.001  0.013  0.992  1.997
    23.000   30.001  0.008  0.992  1.997

The path to the solution can be graphically shown by means of:

    mplot $ drop 3 (toColumns p)

Taken from the GSL manual:

The vector Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm is a quasi-Newton method which builds up an approximation to the second derivatives of the function f using the difference between successive gradient vectors. By combining the first and second derivatives the algorithm is able to take Newton-type steps towards the function minimum, assuming quadratic behavior in that region.

The bfgs2 version of this minimizer is the most efficient version available, and is a faithful implementation of the line minimization scheme described in Fletcher's Practical Methods of Optimization, Algorithms 2.6.2 and 2.6.4. It supercedes the original bfgs routine and requires substantially fewer function and gradient evaluations. The user-supplied tolerance tol corresponds to the parameter sigma used by Fletcher. A value of 0.1 is recommended for typical use (larger values correspond to less accurate line searches).

The nmsimplex2 version is a new O(N) implementation of the earlier O(N^2) nmsimplex minimiser. It calculates the size of simplex as the rms distance of each vertex from the center rather than the mean distance, which has the advantage of allowing a linear update.

Synopsis

- minimize :: MinimizeMethod -> Double -> Int -> [Double] -> ([Double] -> Double) -> [Double] -> ([Double], Matrix Double)
- minimizeV :: MinimizeMethod -> Double -> Int -> Vector Double -> (Vector Double -> Double) -> Vector Double -> (Vector Double, Matrix Double)
- data MinimizeMethod
  - = NMSimplex
  - | NMSimplex2
- minimizeD :: MinimizeMethodD -> Double -> Int -> Double -> Double -> ([Double] -> Double) -> ([Double] -> [Double]) -> [Double] -> ([Double], Matrix Double)
- minimizeVD :: MinimizeMethodD -> Double -> Int -> Double -> Double -> (Vector Double -> Double) -> (Vector Double -> Vector Double) -> Vector Double -> (Vector Double, Matrix Double)
- data MinimizeMethodD
  - = ConjugateFR
  - | ConjugatePR
  - | VectorBFGS
  - | VectorBFGS2
  - | SteepestDescent
- uniMinimize :: UniMinimizeMethod -> Double -> Int -> (Double -> Double) -> Double -> Double -> Double -> (Double, Matrix Double)
- data UniMinimizeMethod
  - = GoldenSection
  - | BrentMini
  - | QuadGolden
- minimizeNMSimplex :: ([Double] -> Double) -> [Double] -> [Double] -> Double -> Int -> ([Double], Matrix Double)
- minimizeConjugateGradient :: Double -> Double -> Double -> Int -> ([Double] -> Double) -> ([Double] -> [Double]) -> [Double] -> ([Double], Matrix Double)
- minimizeVectorBFGS2 :: Double -> Double -> Double -> Int -> ([Double] -> Double) -> ([Double] -> [Double]) -> [Double] -> ([Double], Matrix Double)

# Documentation

minimize Source #

Arguments

:: MinimizeMethod |
-> Double | desired precision of the solution (size test)
-> Int | maximum number of iterations allowed
-> [Double] | sizes of the initial search box
-> ([Double] -> Double) | function to minimize
-> [Double] | starting point
-> ([Double], Matrix Double) | solution vector and optimization path

Minimization without derivatives

minimizeV Source #

Arguments

:: MinimizeMethod |
-> Double | desired precision of the solution (size test)
-> Int | maximum number of iterations allowed
-> Vector Double | sizes of the initial search box
-> (Vector Double -> Double) | function to minimize
-> Vector Double | starting point
-> (Vector Double, Matrix Double) | solution vector and optimization path

Minimization without derivatives (vector version)

data MinimizeMethod Source #

Constructors

NMSimplex |
NMSimplex2 |

#### Instances

Instances details

Bounded MinimizeMethod Source # |
Instance details Defined in Numeric.GSL.Minimization Methods minBound :: MinimizeMethod Source # maxBound :: MinimizeMethod Source #
Enum MinimizeMethod Source # |

Instance details

Defined in Numeric.GSL.Minimization

Methods

succ :: MinimizeMethod -> MinimizeMethod Source #

pred :: MinimizeMethod -> MinimizeMethod Source #

toEnum :: Int -> MinimizeMethod Source #

fromEnum :: MinimizeMethod -> Int Source #

enumFrom :: MinimizeMethod -> [MinimizeMethod] Source #

enumFromThen :: MinimizeMethod -> MinimizeMethod -> [MinimizeMethod] Source #

enumFromTo :: MinimizeMethod -> MinimizeMethod -> [MinimizeMethod] Source #

enumFromThenTo :: MinimizeMethod -> MinimizeMethod -> MinimizeMethod -> [MinimizeMethod] Source #

Show MinimizeMethod Source # |
Instance details Defined in Numeric.GSL.Minimization Methods showsPrec :: Int -> MinimizeMethod -> ShowS Source # show :: MinimizeMethod -> String Source # showList :: [MinimizeMethod] -> ShowS Source #
Eq MinimizeMethod Source # |
Instance details Defined in Numeric.GSL.Minimization Methods (==) :: MinimizeMethod -> MinimizeMethod -> Bool Source # (/=) :: MinimizeMethod -> MinimizeMethod -> Bool Source #

minimizeD Source #

Arguments

:: MinimizeMethodD |
-> Double | desired precision of the solution (gradient test)
-> Int | maximum number of iterations allowed
-> Double | size of the first trial step
-> Double | tol (precise meaning depends on method)
-> ([Double] -> Double) | function to minimize
-> ([Double] -> [Double]) | gradient
-> [Double] | starting point
-> ([Double], Matrix Double) | solution vector and optimization path

Minimization with derivatives.

minimizeVD Source #

Arguments

:: MinimizeMethodD |
-> Double | desired precision of the solution (gradient test)
-> Int | maximum number of iterations allowed
-> Double | size of the first trial step
-> Double | tol (precise meaning depends on method)
-> (Vector Double -> Double) | function to minimize
-> (Vector Double -> Vector Double) | gradient
-> Vector Double | starting point
-> (Vector Double, Matrix Double) | solution vector and optimization path

Minimization with derivatives (vector version)

data MinimizeMethodD Source #

Constructors

ConjugateFR |
ConjugatePR |
VectorBFGS |
VectorBFGS2 |
SteepestDescent |

#### Instances

Instances details

Bounded MinimizeMethodD Source # |
Instance details Defined in Numeric.GSL.Minimization Methods minBound :: MinimizeMethodD Source # maxBound :: MinimizeMethodD Source #
Enum MinimizeMethodD Source # |

Instance details

Defined in Numeric.GSL.Minimization

Methods

succ :: MinimizeMethodD -> MinimizeMethodD Source #

pred :: MinimizeMethodD -> MinimizeMethodD Source #

toEnum :: Int -> MinimizeMethodD Source #

fromEnum :: MinimizeMethodD -> Int Source #

enumFrom :: MinimizeMethodD -> [MinimizeMethodD] Source #

enumFromThen :: MinimizeMethodD -> MinimizeMethodD -> [MinimizeMethodD] Source #

enumFromTo :: MinimizeMethodD -> MinimizeMethodD -> [MinimizeMethodD] Source #

enumFromThenTo :: MinimizeMethodD -> MinimizeMethodD -> MinimizeMethodD -> [MinimizeMethodD] Source #

Show MinimizeMethodD Source # |
Instance details Defined in Numeric.GSL.Minimization Methods showsPrec :: Int -> MinimizeMethodD -> ShowS Source # show :: MinimizeMethodD -> String Source # showList :: [MinimizeMethodD] -> ShowS Source #
Eq MinimizeMethodD Source # |
Instance details Defined in Numeric.GSL.Minimization Methods (==) :: MinimizeMethodD -> MinimizeMethodD -> Bool Source # (/=) :: MinimizeMethodD -> MinimizeMethodD -> Bool Source #

uniMinimize Source #

Arguments

:: UniMinimizeMethod | The method used.
-> Double | desired precision of the solution
-> Int | maximum number of iterations allowed
-> (Double -> Double) | function to minimize
-> Double | guess for the location of the minimum
-> Double | lower bound of search interval
-> Double | upper bound of search interval
-> (Double, Matrix Double) | solution and optimization path

Onedimensional minimization.

data UniMinimizeMethod Source #

Constructors

GoldenSection |
BrentMini |
QuadGolden |

#### Instances

Instances details

Bounded UniMinimizeMethod Source # |
Instance details Defined in Numeric.GSL.Minimization Methods minBound :: UniMinimizeMethod Source # maxBound :: UniMinimizeMethod Source #
Enum UniMinimizeMethod Source # |

Instance details

Defined in Numeric.GSL.Minimization

Methods

succ :: UniMinimizeMethod -> UniMinimizeMethod Source #

pred :: UniMinimizeMethod -> UniMinimizeMethod Source #

toEnum :: Int -> UniMinimizeMethod Source #

fromEnum :: UniMinimizeMethod -> Int Source #

enumFrom :: UniMinimizeMethod -> [UniMinimizeMethod] Source #

enumFromThen :: UniMinimizeMethod -> UniMinimizeMethod -> [UniMinimizeMethod] Source #

enumFromTo :: UniMinimizeMethod -> UniMinimizeMethod -> [UniMinimizeMethod] Source #

enumFromThenTo :: UniMinimizeMethod -> UniMinimizeMethod -> UniMinimizeMethod -> [UniMinimizeMethod] Source #

Show UniMinimizeMethod Source # |
Instance details Defined in Numeric.GSL.Minimization Methods showsPrec :: Int -> UniMinimizeMethod -> ShowS Source # show :: UniMinimizeMethod -> String Source # showList :: [UniMinimizeMethod] -> ShowS Source #
Eq UniMinimizeMethod Source # |
Instance details Defined in Numeric.GSL.Minimization Methods (==) :: UniMinimizeMethod -> UniMinimizeMethod -> Bool Source # (/=) :: UniMinimizeMethod -> UniMinimizeMethod -> Bool Source #

minimizeNMSimplex :: ([Double] -> Double) -> [Double] -> [Double] -> Double -> Int -> ([Double], Matrix Double) Source #

Deprecated: use minimize NMSimplex2 eps maxit sizes f xi

minimizeConjugateGradient :: Double -> Double -> Double -> Int -> ([Double] -> Double) -> ([Double] -> [Double]) -> [Double] -> ([Double], Matrix Double) Source #

Deprecated: use minimizeD ConjugateFR eps maxit step tol f g xi

minimizeVectorBFGS2 :: Double -> Double -> Double -> Int -> ([Double] -> Double) -> ([Double] -> [Double]) -> [Double] -> ([Double], Matrix Double) Source #

Deprecated: use minimizeD VectorBFGS2 eps maxit step tol f g xi