[SciPy-User] Problem using optimize.fmin_slsqp
Bastian Weber
bastian.weber@gmx-topmail...
Sun Nov 28 07:39:47 CST 2010
Paweł Kwaśniewski wrote:
> 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 ***
>
Hello Paweł,
maybe it helps to increase the verbosity of fmin_slsqp using the
additional argument iprint=2.
Another debugging strategy would be, to let your function 'residuals'
print everything it gets as argument and its return value. This way you
could determine on which data the error happens.
Regards,
Bastian
More information about the SciPy-User
mailing list