Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POWELL implementation #1697

Open
dartemo1 opened this issue Dec 18, 2023 · 6 comments
Open

POWELL implementation #1697

dartemo1 opened this issue Dec 18, 2023 · 6 comments

Comments

@dartemo1
Copy link

dartemo1 commented Dec 18, 2023

gdl 1.0.0-rc.3 MAC-OS 13.6.1 Ventura
POWELL is definitely misbehaving!
ITER and ITMAX are not updated or have any effect. Xi initial/final set of directions is not updated.
Optimization quality is very low compared to native idl or python "scipy.optimize.minimize(powell)".
Used a simple program to test:

;test function for gdl powell optimization
;12.18.2023
FUNCTION t1,X
COMMON TT1, x0, ind0
ind0++
RETURN,total(abs(x-x0))
END
;main program
COMMON TT1, x0, ind0
TIC
ind0=0L
N=512
x0=findgen(N)
ftol=1e-4
xi=fltarr(N,N)
xi(indgen(N),indgen(N))=1.0
P=fltarr(N)+10.0
POWELL,P,xi,ftol,fmin,"t1",ITER=niter
TOC
END

resulting fmin=13793 compared to 3.3E-4 for idl and 1.3E-9 python. Would be great if someone has a fix! Thank you.

@alaingdl
Copy link
Contributor

Thanks you for the feedback, it is interesting because other test cases we have were as fast as IDL ! We will see. I also realize that some tests we have are not OK in IDL.

@GillesDuvert
Copy link
Contributor

Hi,
I confirm the reported behaviour (slow and false), thanks again.
For the record, POWELL is not at all the routine "powell" described in section 10.5 of Numerical Recipes in C, as we cannot use Numerical Recipes codes for copyright reasons. GDL's POWELL has been written without any other test as the example in the IDL doc (this one passes). GDL's POWELL uses R. Brent's "praxis" implementation of its own solver (see reference at end of this wikipedia page ). As the method has no 'iter' return, ITER cannot be updated and is set to 1.
IMHO our POWELL implementation should be replaced by some excerpt from minpack, would this be a solution ?

@dartemo1
Copy link
Author

Dear Gillies and Alain thank you for the prompt response. It looks like currently AMOEBA is the only functioning method for nonlinear optimization without explicit derivatives. Nonlinear solvers BROYDEN and NEWTON are not available, so minpack HYBRD would be a welcome solution!

@alaingdl
Copy link
Contributor

Why do you say BROYDEN and NEWTON are not available, I just used them too & working fine on my tests.
See at : test_multiroots.pro & test_fx_root.pro

@dartemo1
Copy link
Author

Sorry, my fault. Have not y used them.

@GillesDuvert
Copy link
Contributor

Please note that amoeba in written in C in GDL, not as a procedure as IDL does. It should be quicker than its IDL equivalent, which is deemed slow.
Anyway, it would be great to have an idea of the comparative speed and overall quality of the GDL minimization code (OK, POWELL is broken) wrt. the IDL equivalent.
FTR GDL contains "NEWTON", "BROYDEN" for nonlinear equations, and "AMOEBA", "DFPMIN", "POWELL" and "SIMPLEX" for optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants