Numerical solver

Robert Kern robert.kern at gmail.com
Tue Feb 28 14:05:30 EST 2006


Laszlo Zsolt Nagy wrote:
>   Hello,
> 
> I would like to use a numerical solver for a specific problem. My 
> problem looks like this:
> 
>    1. I have numeric constants, named A,B,C etc.
>    2. I have numeric variables, named x,y,z etc.
>    3. I have functions, like f1(x), f2(x), f3(x,y), f4(y) etc.
>    4. I have constraints like f1(x) < A  f3(x,y) < B etc.
> 
> Fortunately, all of the variables can be limited to a closed finite 
> interval. (E.g.   0 <= x <= 100)
> There is a specific function, called P(x,y,z) that needs to be optimized 
> (need to find its maximum/minimum).

In [7]: scipy.optimize.fmin_cobyla?

Type:           function
Base Class:     <type 'function'>
String Form:    <function fmin_cobyla at 0x4fff3b0>
Namespace:      Interactive
File:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy-
0.4.7.1607-py2.4-macosx-10.4-ppc.egg/scipy/optimize/cobyla.py
Definition:     scipy.optimize.fmin_cobyla(func, x0, cons, args=(),
consargs=None, rhobeg=1.0, rhoen
d=0.0001, iprint=1, maxfun=1000)
Docstring:
    Minimize a function using the Contrained Optimization BY Linear
    Approximation (COBYLA) method

    Arguments:

    func     -- function to minimize. Called as func(x, *args)

    x0       -- initial guess to minimum

    cons     -- a sequence of functions that all must be >=0 (a single function
                if only 1 constraint)

    args     -- extra arguments to pass to function

    consargs -- extra arguments to pass to constraints (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  -- controls the frequency of output: 0 (no output),1,2,3

    maxfun  -- maximum number of function evaluations.


    Returns:

    x -- the minimum

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list