[SciPy-User] optimize.fmin_slsqp bounds problem
Jean-Francois.Moulin at hzg.de
Jean-Francois.Moulin at hzg.de
Wed Oct 9 16:43:18 EDT 2013
>http://sscce.org/
>
>Please provide a self-contained reproducible example. What is the exact objfn?
>
>I don't get any errors with
>
>------------------------------
>import numpy as np
>from scipy.optimize import fmin_slsqp>
>
>np.random.seed(1234)
>y = np.random.randn(9) * 100
>def objfn(x):
> return ((x - y)**2).sum()
>
>bounds = [(-1e-09, 1e-08), (1e-07, 1e-05), (1e-07, 1e-05), (1e-10,
>1e-08), (1e-10, 1e-08), (1e-10, 1e-08), (80.0, 200.0), (1.0, 5.0), (1.0,
>5.0)]
>x0 = np.array([ 0.00000000e+00, 1.01000000e-06, 3.03000000e-06,
> 1.00000000e-09, 1.00000000e-09, 1.00000000e-09,
> 1.50000000e+02, 2.00000000e+00, 2.00000000e+00])
>res = fmin_slsqp(objfn,
>np.array(x0,dtype=float),bounds=bounds,full_output=True)
>------------------------------
>The algorithm and code used (with permission from ACM) is this:
>http://dl.acm.org/citation.cfm?id=192124
>
>The only way to understand what goes wrong is probably to look in the
>Fortran code and see what it does.
>
>--
>Pauli Virtanen
Well my objective function is a quite complex recursive function of the 9 input parameters which in the end returns the sum of the squared deviation as expected by fmin_slsqp (it involves several of my own modules and a large dataset, so too long to be posted). I have checked that the return value is valid (not NAN eg) and as you see there is a single iteration done.
I also have checked the minimizer with examples similar to yours, and it worked.
I'll have to get my hand Fortran dirty it seems, I just hoped someone had alreay had this kind of symptom and found a "trivial" error.
Thanks anyway!
JF
Helmholtz-Zentrum Geesthacht
Zentrum für Material- und Küstenforschung GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany
Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: MinDirig Wilfried Kraus
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: http://www.hzg.de
More information about the SciPy-User
mailing list