[SciPy-User] lbfgs and cobyla
pablo p del castillo
pablodecastillo at yahoo.es
Thu Mar 19 14:22:54 EDT 2015
Hello,
I am checking how use the optimization functions in scipy. So i am looking for minimun area for a box with vol = 108, so i define for cobyla;def area(x): return x[0]*x[1]+2.0*x[0]*x[2]+2.0*x[1]*x[2]def constr(x): return x[0]*x[1]*x[2]-108.0x = [10,10,10]
sol=fmin_cobyla(area,x,constr,rhoend=1e-6,maxfun=10000)And the solution is perfect, 6,6,3
if now i build the problem with lbfgs, i use lagrange multiplier, changing the objective to:
def area(x): return x[0]*x[1]+2.0*x[0]*x[2]+2.0*x[1]*x[2]+x[3]*constr(x)x = [10,10,10,10] mybounds = [(0.00001,100), (0.00001,100), (0.00001,100), (0,1000)]fmin_l_bfgs_b(area, x,approx_grad=True,bounds=mybounds)
getting bad results, what is my mistake??
Advanced thanks
Pablo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150319/e7083d33/attachment.html>
More information about the SciPy-User
mailing list