There is another crucial point if one want to integrate it in scipy.
It should never fail due to stack exhaustion, as you well know.
Yeah I saw this pop up and was confused. I develop the Julia SciML organization https://sciml.ai/ and weâd be more than happy to work with you to get wrappers for PRIMA into Optimization.jlâs general interface.
Please get in touch and we can figure out how to set this all up. Iâd be curious to try this out and do some benchmarks against nlopt methods.
Iâll have to censor myself, because a proper answer to SciPyâs maintainer statement, âweâre already working to get rid of itâ, can only be offensive and far from being polite. Therefore I will just express my humble opinion that âSciâ and âPyâ donât go together, so âSciPyâ can only be interpreted as a joke. And yes, I am aware it is popular, despite the fact it is⌠what it is (self-censoring here).
Hi @Pap it would be shameful to shame SciPyâs work, honestly their library has been an excellent work to enable new scientist-in-the-making to discover complex algorithms in a Top-down approach which has indeed empowered a lot of people!!
I have used SciPy for years to learn or to benchmark many codes before pushing the performance barriers in FortranâŚ
There are many extremally well known python APIs out there using SciPy behind the curtains.
We should work much more closely with them, it would be extremally beneficial for both communities!!
And they seem to be indeed very open to the guidance we could provided to move forward: please follow the latest comments here : ENH: The Fortran 77 implementation of COBYLA is buggy and challenging to maintain. Switch to the PRIMA implementation? ¡ Issue #18118 ¡ scipy/scipy ¡ GitHub
I would probably agree, if they didnât say that they are just trying to get rid of Fortran, so everything new they might add should not be in Fortran. They even consider using⌠f2c as a solution, to convert the code to âholyâ C (and I donât mean HolyC by T.A. Davis). I honestly donât see any room for cooperating.
The answer from one of the maintainers after a proposal on a Fortran wrapper to avoid f2pyâŚ
That wrapper code looks pretty reasonable and is a lot easier to understand than
f2py
imho. I think we could give that a try.
(âŚ)
Yes you are right. My question was what not usingf2py
would mean - butbind(c)
takes care of all that, and is way better than the unreadable generated code thatf2py
emits to deal with name mangling.
Please take the time to fully read! you could be surprised what a small amount of kind sharing and help can do.
It would be very nice if, later, you write a post here or somewhere else explaining what was the best interfacing solution you arrived at with them. Having that clearly documented will be very helpful for others developing Fortran routines to interface with python or C.
@zaikunzhang tweeted that
COBYQA by Tom M. Ragonneau and Zaikun Zhang is becoming the next derivative-free (a.k.a. zeroth-order / gradient-free) optimization solver in SciPy.
Congratulations, and thanks for showing that it is possible to get modern Fortran into non-Fortran-specific libraries, with some persistence.
Thank you @Beliavsky !
However, COBYQA is not PRIMA, although both are derivative-free (a.k.a. zeroth-order/gradient-free) optimization (DFO) packages.
COBYQA is a new algorithm, developed by Tom M. Ragonneau (my former Ph.D. student) and Zaikun Zhang (me) as part of Tomâs Ph.D. thesis during 2019â2022. It is coded in Python (with Cython). Tom did all the coding.
PRIMA is a package that I have been working on for modernizing Powellâs DFO solvers. Powell coded them in F77, and I have reimplemented them in modern Fortran during 2020-present.
PRIMA is also being integrated into SciPy:
- ENH: The Fortran 77 implementation of COBYLA is buggy and challenging to maintain. Switch to the PRIMA implementation? ¡ Issue #18118 ¡ scipy/scipy ¡ GitHub
- RFC: Tracking progress to integrate with SciPy ¡ Issue #112 ¡ libprima/prima ¡ GitHub
However, it needs much more work due to the multiple languages involved. The community (including the SciPy maintainers) is providing a lot of help, but more is needed. I am completely ignorant about Python, so I have to rely on community help.
I hope the success of COBYQA will help us to promote PRIMA in multiple ways.
Thank you.