[SciPy-User] optimize.fmin_slsqp bounds problem

Pauli Virtanen pav at iki.fi
Wed Oct 9 13:07:37 EDT 2013


09.10.2013 16:43, Jean-Francois.Moulin at hzg.de kirjoitti:
[clip]
> my objective function objfn returns the sum of the squared deviations 
> 
> 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 = 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,p.array(x0,dtype=float),bounds=bounds,full_output=True)
> ...
> Inequality constraints incompatible    (Exit mode 4)
>             Current function value: 450.575453753
>             Iterations: 1
>             Function evaluations: 11
>             Gradient evaluations: 1

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




More information about the SciPy-User mailing list