It could be good to document this hidden subroutine (exported though).
It's a generic routine that was not documented. It allows to easily use different algorithms on some problems with a generic interface.
For example :
($x, %ret) = optimize($x, %opt(f_func=>$func,
g_func=>$gfunc,
function='spg');
The routine adds usual default options if necessary (eps, gtol, ftol etc. depending on the routine used.).
See line 3869.