JuliaNLSolvers / Optim.jl

Optimization functions for Julia
Other
1.12k stars 217 forks source link

Use of `default_options` in `fminbox.jl`? #1028

Open Yuan-Ru-Lin opened 1 year ago

Yuan-Ru-Lin commented 1 year ago

For unconstrained optimizer, there is a function default_options that can be extended to set default options of one's interests.

https://github.com/JuliaNLSolvers/Optim.jl/blob/1f1258c8499b57c6a551ef94057604bd58f1aa31/src/multivariate/optimize/interface.jl#L19-L27

An example is as follows.

import Optim: default_options
using Optim: BFGS
default_options(::BFGS) = (; extended_trace=true, callback=miunitstop)

The reason this is possible is because there are relevant handling in the most generic function:

https://github.com/JuliaNLSolvers/Optim.jl/blob/1f1258c8499b57c6a551ef94057604bd58f1aa31/src/multivariate/optimize/interface.jl#L83-L92

However, this is not true in the case of optimize that takes Fminbox as an argument:

https://github.com/JuliaNLSolvers/Optim.jl/blob/1f1258c8499b57c6a551ef94057604bd58f1aa31/src/multivariate/solvers/constrained/fminbox.jl#L259-L270