# [SciPy-User] Problem using optimize.fmin_slsqp

Paweł Kwaśniewski pawel.kw@gmail....
Fri Nov 26 08:52:56 CST 2010

```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
*** 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.

Regards,

Pawel

--
Pawel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20101126/a9bf9e43/attachment.html
```