minimize
index
minimize.py


 
optimization routines.

 
Classes
       
F1Dim

 
class F1Dim
   
 

 
  Methods defined here:
__call__(s, x)

 
__init__(s, f, p, d)

 

 
Functions
       
SIGN(a, b)

 
bfgs(x, f, df, costTol=1e-10, gradTol=0.0001, maxIters=200, verbose=0, stepsize0=1, resetInterval=None)

 
Perform Broyden-Fletcher-Goldfarb-Shanno variant of
Davidson-Fletcher-Powell minimization.
 
Return value is the tuple (x,J(x),numIters)
brent(ax, bx, cx, f, tol=1e-08, ITMAX=100, ZEPS=1e-10)

 
Find minimum bracketed by ax,bx,cx
return (xmin,f(xmin))
conmin(x, f, df, costTol=1e-10, gradTol=0.0001, maxIters=200, stepsize=1, verbose=0)

 
conjugate gradient minimization of function f with gradient df, starting at
position x.
 
stepsize specifies initial stepsize to be taken
 
Return value is the tuple (x,J(x),numIters)
 
FIX: this routine makes unnecessary function calls.
dot(...)

 
linemin(func, p, xi, stepsize)

 
determine the minimum of func starting at point p, in the direction xi.
 
return (pf,pfmin,xif)
  minimum position, fmin, and the actual displacement vector used
mnbrak(ax, bx, func)

 
given function func, and given distinct initial points ax and bx, this
routine searches in the downhill direction *defined by the function as
evaluated at the initial points) and returns new points ax, bx, cx which
bracket a minimum of the function. Also returned are the function values 
at the three points fa, fb and fc.
norm(...)

 
outerProd(x, y)

 
return the outer product matrix result of multiplying the vectors x and y
simplex(func, x0, args=(), xtol=0.0001, ftol=0.0001, maxIters=None, maxfun=None, full_output=0, verbose=1, retall=0, callback=None)

 
Minimize a function using the downhill simplex algorithm.
 
:Parameters:
 
  func : callable func(x,*args)
      The objective function to be minimized.
  x0 : ndarray
      Initial guess.
  args : tuple
      Extra arguments passed to func, i.e. ``f(x,*args)``.
  callback : callable
      Called after each iteration, as callback(xk), where xk is the
      current parameter vector.
 
:Returns: (xopt, {fopt, iter, funcalls, warnflag})
 
  xopt : ndarray
      Parameter that minimizes function.
  fopt : float
      Value of function at minimum: ``fopt = func(xopt)``.
  iter : int
      Number of iterations performed.
  funcalls : int
      Number of function calls made.
  warnflag : int
      1 : Maximum number of function evaluations made.
      2 : Maximum number of iterations reached.
  allvecs : list
      Solution at each iteration.
 
*Other Parameters*:
 
  xtol : float
      Relative error in xopt acceptable for convergence.
  ftol : number
      Relative error in func(xopt) acceptable for convergence.
  maxIters : int
      Maximum number of iterations to perform.
  maxfun : number
      Maximum number of function evaluations to make.
  full_output : bool
      Set to True if fval and warnflag outputs are desired.
  verbose : bool
      Set to True to print convergence messages.
  retall : bool
      Set to True to return list of solutions at each iteration.
 
:Notes:
 
    Uses a Nelder-Mead simplex algorithm to find the minimum of
    function of one or more variables.
wrap_function(function, args)

 
# the following routines are from scipy optimize.fmin
#
#Copyright (c) 2001, 2002 Enthought, Inc.
#All rights reserved.
#
#Copyright (c) 2003-2009 SciPy Developers.
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
#  a. Redistributions of source code must retain the above copyright notice,
#     this list of conditions and the following disclaimer.
#  b. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#  c. Neither the name of the Enthought nor the names of its contributors
#     may be used to endorse or promote products derived from this software
#     without specific prior written permission.
#
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR

 
Data
        CGOLD = 0.38196600000000003
GLIMIT = 100.0
GOLD = 1.618034
TINY = 9.9999999999999995e-21
__package__ = None
costTol = 1e-08
gradTol = 0.0001