[SciPy-User] Problem using optimize.fmin_slsqp

Skipper Seabold jsseabold at gmail.com
Fri Nov 26 19:12:43 EST 2010


2010/11/26 Paweł Kwaśniewski <pawel.kw at 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. The last line
> is a mystery for me. It seems that after one iteration something goes really
> wrong... I would really appreciate some advice on how can I debug my code.
> Please tell me what else I should provide to be more clear.
>

Can you provide some code and data to replicate the problem?

Skipper



More information about the SciPy-User mailing list