[SciPy-User] Problem using optimize.fmin_slsqp

Didrik Pinte dpinte@enthought....
Sun Nov 28 06:19:02 CST 2010


2010/11/26 Paweł Kwaśniewski <pawel.kw@gmail.com>:
> Hello,
>
> I need to fit some data using a constrained least square fit - unconstrained
> fit gives me a good 'visual' fit, but the parameters are non-physical,
> therefore useless. I found that optimize.fmin_slsqp is what I want to use. I
> tried it, but I'm stuck with some error I completely don't understand... I
> know how to use the minimization function - I played with it a bit on
> simulated data, and it works well. I think the problem might be with my
> fitting function - it's quite lengthy, probably resource consuming. But
> maybe it's something else. Anyway, here's what I'm doing:
>
>     params, fval, its, imode, smode = optimize.fmin_slsqp(residuals, guess,
>                                              args = (points,vals,errs),
>                                              bounds = b,
>                                              full_output = True)
>
> residuals is a function which returns a float, being the sum of squared
> residuals (just didn't change the name after using non-linear least square
> fit). What I'm getting is:
>
> Inequality constraints incompatible    (Exit mode 4)
>             Current function value: 2.18747774338
>             Iterations: 1
>             Function evaluations: 7
>             Gradient evaluations: 1
> *** glibc detected *** python: double free or corruption (!prev): 0x08d465f0
> ***
>
> As you can see in the function call, I'm not even using inequality
> constraints, so I don't understand why it complains about it.

You do at least have bounds which should be represented like
inequality contraints. I don't know about the internals of the
algorithms but that might be the problem.

-- Didrik


More information about the SciPy-User mailing list