Package linear_operators :: Package iterative :: Module optimize :: Class FminCOBYLA
[hide private]
[frames] | no frames]

Class FminCOBYLA

source code

 object --+    
          |    
FminWrapper --+
              |
             FminCOBYLA


Abstract class to generate wrappers around scipy.optimize fmin_*
functions.

Parameters
-----------

criterion : Criterion
    A criterion function with __call__ and gradient methods.
x0 : ndarray (None)
    First guess
args=() : tuple
    Extra arguments for the criterion function
kwargs : dict
    Parameters of the fmin_function

fmin function docstring
------------------------

Minimize a function using the Constrained Optimization BY Linear
Approximation (COBYLA) method.

Parameters
----------
func : callable
    Function to minimize. In the form func(x, \*args).
x0 : ndarray
    Initial guess.
cons : sequence
    Constraint functions; must all be ``>=0`` (a single function
    if only 1 constraint). Each function takes the parameters `x`
    as its first argument.
args : tuple
    Extra arguments to pass to function.
consargs : tuple
    Extra arguments to pass to constraint functions (default of None means
    use same extra arguments as those passed to func).
    Use ``()`` for no extra arguments.
rhobeg :
    Reasonable initial changes to the variables.
rhoend :
    Final accuracy in the optimization (not precisely guaranteed).
iprint : {0, 1, 2, 3}
    Controls the frequency of output; 0 implies no output.  Deprecated.
disp : {0, 1, 2, 3}
    Over-rides the iprint interface.  Preferred.
maxfun : int
    Maximum number of function evaluations.

Returns
-------
x : ndarray
    The argument that minimises `f`.

Examples
--------
Minimize the objective function f(x,y) = x*y subject
to the constraints x**2 + y**2 < 1 and y > 0::

    >>> def objective(x):
    ...     return x[0]*x[1]
    ...
    >>> def constr1(x):
    ...     return 1 - (x[0]**2 + x[1]**2)
    ...
    >>> def constr2(x):
    ...     return x[1]
    ...
    >>> fmin_cobyla(objective, [0.0, 0.1], [constr1, constr2], rhoend=1e-7)

       Normal return from subroutine COBYLA

       NFVALS =   64   F =-5.000000E-01    MAXCV = 1.998401E-14
       X =-7.071069E-01   7.071067E-01
    array([-0.70710685,  0.70710671])

The exact solution is (-sqrt(2)/2, sqrt(2)/2).

Instance Methods [hide private]
 
__init__(self, criterion, cons, x0=None, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__call__(self) source code

Inherited from FminWrapper: first_guess

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __doc__ = FminWrapper.__doc__+ opt.fmin_cobyla.__doc__
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, criterion, cons, x0=None, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)