[SciPy-User] quadratic programming with fmin_slsqp

denis denis-bz-gg@t-online...
Tue Mar 20 06:58:49 CDT 2012


On Mar 16, 5:45 pm, josef.p...@gmail.com wrote:
> scipy is missing a fmin_quadprog

Josef,
  minmize()  is a reasonable common interface to 10 or so optimizers,
see http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html
however
- minimize.py is not in scipy-0.9.0.tar nor in scipy-0.10.1.tar
    (a test to see if anybody's using it ?)
- only L-BFGS-B TNC COBYLA and SLSQP support bounds.

One could supply a trivial box / penaltybox as outlined below
(I use this playing around with Neldermead)
but I'm not sure anybody would use it
plus there's openopt pyomo mystic ...
maybe more solvers than real testcases :-

cheers
  -- denis


class Funcbox:
    """ F = Funcbox( func, [box=(0,1), penalty=None, grid=0,
*funcargs, **kwargs
        wraps a func() with a constraint box and grid

    Parameters
    ----------
    func: a function of a numpy vector or array-like
    box: (low, high) to np.clip, default (0,1).
        These can be vectors; low_j == high_j freezes x_j at that
value.
    penalty: e.g. (0, 1, 1000) adds a quadratic penalty
        to func() where xclip is outside (0, 1)
            1000 * sum( max( 0 - x, 0 )**2 + max( x - 1, 0 )**2 )
            = 1 4 9 16 ... at -.01 -.02 ... and 1.01 1.02 ...
        The default is None, no penalty.
        (The penalty box should be smaller than the clip box;
        x is first gridded if grid > 0, then clipped, then penalty
computed.)
    grid: e.g. .01 snaps all x_j to multiples of .01 --
        a simple noise smoother, recommended for noisy functions.
        The default is 0, no gridding.


More information about the SciPy-User mailing list