+ 1

How can I find optimized parameters for a local maximum while using optimization in python for 3D array?

Nstep1=10 Vc_opt=zeros(Nstep1) For l in range(Nstep1): Nstep=10 X1 = zeros(Nstep) Vc= zeros( Nstep, Nstep) g1 = linspace(0.01, 0.5, Nstep) g2 = linspace(0.01, 0.5, Nstep) For j in range(Nstep): For k in range(Nstep): res= minimize (fn, x0)# fn is any function of variables l, g1 and g2 and x0 are any scalars with initial guess x0[0], x0[1] and x0[2] to be optimized for fn. Vc[j,k]=-res.fun X1= res.x Vc_opt[l]=Vc.max() That works fine but I am missing information of X1 for that Vc.max(). How can I get corresponding X1 for local maximum of Vc? Thanks

25th Oct 2022, 4:07 PM
Anil Kumar
Anil Kumar - avatar
2 Réponses
0
Hi guys, I guess if I save Vc and X1 in an array such that Vc.max() and X1 will have same indices, that should work for my question. Please give me hint if possible through other way or the above seems vauge. Thanks
27th Oct 2022, 8:38 AM
Anil Kumar
Anil Kumar - avatar