What is the best way to modify existing or add new optimizer in Optim?

I’d create a new environment, dev Optim and then @edit BFGS(); that is,

(@oldenvironment) pkg> activate ./newenvironment
(@newenvironment) pkg> dev Optim

then in the REPL

using Optim
@edit BFGS()

If you find the modification straightforward to implement, then just do so and see how performance varies (compared to the unmofidied version of Optim in the old environment).

If it’s tricky to modify, then it’s more reasonable create a new file, follow the same pattern and then include the file appropriately in src/Optim.jl.