Re: [SciPy-dev] SLSQP Constrained Optimizer Status
Hi Rob, 1. You should replace ( len(eqcons) + len(ieqcons), len(x0) ) by ( len(eqcons), len(x0) ) and ( len(ieqcons), len(x0) ) in slsqp docstring: fprime_eqcons : callable f(x,*args) A function of the form f(x, *args) that returns the m by n array of equality constraint normals. If not provided, the normals will be approximated. The array returned by fprime_cons should be sized as ( len(eqcons) + len(ieqcons), len(x0) ). fprime_ieqcons : callable f(x,*args) A function of the form f(x, *args) that returns the m by n array of inequality constraint normals. If not provided, the normals will be approximated. The array returned by fprime_cons should be sized as ( len(eqcons) + len(ieqcons), len(x0) ). 2. I have written connection to OO but it still fails to solve any from my primitive tests: I constantly get stop case "Singular matrix C in LSQ subproblem" So I have tried to call slsqp w/o OO interface, directly. See the file below, I think it would be nice would you make the example working; then I'll continue slsqp check. Currently it fails in line 206 meq = len(f_eqcons(x)) where f_eqcons(x) = array(133.40163659577431) Note also that I have pass 2 eq cons but this somehow has only 1 value (I have noticed you replaced f_eqcons by something in line 159, maybe it's the matter?) Regards, D. from numpy import * from scipy.optimize.slsqp import fmin_slsqp N = 10 M = 5 ff = lambda x: (abs(x-M) ** 1.5).sum() x0 = cos(arange(N)) c = lambda x: [2* x[0] **4-32, x[1]**2+x[2]**2 - 8] h1 = lambda x: 1e1*(x[-1]-1)**4 h2 = lambda x: (x[-2]-1.5)**4 #TODO: pass bounds to fmin_slsqp when all other will work ok ##bounds = [(-6,6)]*10 ##bounds[3] = (5.5, 6) ##bounds[4] = (6, 4.5) diffInt = 1e-8 x = fmin_slsqp( ff, x0 , f_eqcons=lambda x: asfarray(h1(x), h2(x)), f_ieqcons=c, bounds = [], fprime = None, fprime_eqcons=None, fprime_ieqcons=None, args = (), iter = 100, acc = 1.0E-6, iprint = -1, full_output = 0, epsilon = diffInt)
participants (1)
-
dmitrey