minimize
index


 
optimization routines.

 
Classes
       
builtins.object
F1Dim

 
class F1Dim(builtins.object)
    F1Dim(f, p, d)
 

 
  Methods defined here:
__call__(s, x)
Call self as a function.
__init__(s, f, p, d)
Initialize self.  See help(type(self)) for accurate signature.

Data descriptors defined here:
__dict__

 
dictionary for instance variables (if defined)
__weakref__

 
list of weak references to the object (if defined)

 
Functions
       
SIGN(a, b)
bfgs(x, f, df, costTol=1e-10, gradTol=0.0001, maxIters=200, verbose=0, stepsize0=1, resetInterval=None, writer=<built-in method write of _io.TextIOWrapper object at 0x7f2b02b0fd30>)
Perform Broyden-Fletcher-Goldfarb-Shanno variant of
Davidson-Fletcher-Powell minimization.
 
The writer argument can be used to specify an alternate destination
for verbose output. By default it goes to sys.stdout.write
 
stepsize0 is the initial stepsize as a fraction of the initial
gradient length.
 
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,f(x),numIters)
 
FIX: this routine makes unnecessary function calls.
linemin(func, p, xi, stepsize, tolerance=1e-08)
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.
outerProd(x, y)
return the outer product matrix result of multiplying the vectors x and y
reduce(...)
reduce(function, iterable[, initial]) -> value
 
Apply a function of two arguments cumulatively to the items of a sequence
or iterable, from left to right, so as to reduce the iterable to a single
value.  For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
((((1+2)+3)+4)+5).  If initial is present, it is placed before the items
of the iterable in the calculation, and serves as a default when the
iterable is empty.
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.381966
GLIMIT = 100.0
GOLD = 1.618034
TINY = 1e-20
costTol = 1e-08
gradTol = 0.0001