[SciPy-user] Problem with NLP in OpenOpt
dmitrey
dmitrey.kroshko at scipy.org
Thu Nov 15 09:49:19 EST 2007
hi,
scipy_cobyla yields solution r.ff = -19,
r.xf= array([ -1.00000000e+00, -9.80461510e-08, 1.35489449e-05,
5.37394643e-06, 9.80515487e-08, -1.00000000e+00,
4.43639580e-07, -2.00656699e-07, -5.92177803e-07,
-2.01266552e-07, -1.00000000e+00, 1.02019241e-07,
-1.81972968e-07, 2.91935590e-07, -1.02019165e-07,
-1.00000000e+00])
and max constraint = 1.29567664921e-05, that exceeds default p.contol=1e-6
ALGENCAN yields r.ff=-19.0000051782,
r.xf = array([ -1.00000000e+00, 3.77969060e-08, 2.50917684e-08,
3.90370801e-08, -3.78516336e-08, -1.00000020e+00,
-1.99934148e-08, 3.28135157e-09, -2.50878312e-08,
1.99952165e-08, -9.99999998e-01, 2.31707460e-08,
-3.90372694e-08, -3.28049018e-09, -2.27805959e-08,
-1.00000048e+00])
and max constraint 9.53914e-07 that is less than default 1e-6 and hence
is feasible, no error message (btw time elapsed is 30% less than cobyla).
You could just set p.contol=1e-4 and scipy_cobyla will solve your
problem well.
Regards, D.
Dark Wind wrote:
> Hi,
>
> I am using NLP of OpenOpt to solve a NonLinear programming problem. I
> am using scipy_cobyla solver.
> The initial point that I have provided is feasible, but I am getting a message:
> ------------------------------------------message---------------------------------------------------------
> starting solver scipy_cobyla (license: BSD ) with problem unnamed
> solver scipy_cobyla has finished solving the problem unnamed
> istop: -100
> Solver: Time Elapsed = 0.75 CPU Time Elapsed = 0.750110139697
> NO FEASIBLE SOLUTION is obtained (max residual = 1.29567664921e-005)
> -----------------------------------------------------------------------------------------------------------------
>
>
> All other solvers cannot take h constraint and some others require
> extra additions.
>
> Following is my code:
> --------------------------------------------------code-------------------------------------------------
> from scikits.openopt import NLP
>
> f = lambda x: 1*x[0] + 7*x[5] + 3*x[10] + 8*x[15]
> x0 = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
>
> p=NLP(f,x0,maxIter=1e7,maxFunEvals=1e7)
>
> h1 = lambda x: x[0]**2 + x[1]**2 + x[2]**2 + x[3]**2 -1
> h2 = lambda x: x[0]*x[4]+x[1]*x[5]+x[2]*x[6]+x[3]*x[7]
> h3 = lambda x: x[0]*x[8]+x[1]*x[9]+x[2]*x[10]+x[3]*x[11]
> h4 = lambda x: x[0]*x[12]+x[1]*x[13]+x[2]*x[14]+x[3]*x[15]
> h5 = lambda x: x[4]**2+x[5]**2+x[6]**2+x[7]**2-1
> h6 = lambda x: x[4]*x[8]+x[5]*x[9]+x[6]*x[10]+x[7]*x[11]
> h7 = lambda x: x[4]*x[12]+x[5]*x[13]+x[6]*x[14]+x[7]*x[15]
> h8 = lambda x: x[8]**2+x[9]**2+x[10]**2+x[11]**2-1
> h9 = lambda x: x[8]*x[12]+x[9]*x[13]+x[10]*x[14]+x[11]*x[15]
> h10 = lambda x: x[12]**2+x[13]**2+x[14]**2+x[15]**2-1
>
> p.h=[h1,h2,h3,h4,h5,h6,h7,h8,h9,h10]
>
> r=p.solve('scipy_cobyla')
> -----------------------------------------------------------------------------------------------------------
>
> The initial value x0 satisfies the constraints hi's but i am still
> getting that there is no feasible solution.
>
> Can anyone help me with this?
>
> Thank you
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
>
>
More information about the SciPy-User
mailing list