JuliaNLSolvers / Optim.jl

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

Optim.OptimizationState #1101

Open nickbrady opened 1 month ago

nickbrady commented 1 month ago

There seems to be some misalignment of the documentation with the Optim.OptimizationState: https://docs.sciml.ai/Optimization/stable/API/optimization_state/

The fields in OptimizationState in the documentation are listed as follows:

Fields

iter: current iteration
u: current solution
objective: current objective value
gradient: current gradient
hessian: current hessian
original: if the solver has its own state object then it is stored here

but using the following code:

using Optim
println(fieldnames(Optim.OptimizationState))

gives 1: iteration 2: value 3: g_norm 4: metadata

longemen3000 commented 1 month ago

Note that this package is Optim.jl, whereas the documentation points to Optimization.jl. If you check that package, it has the struct with the correct fields: https://github.com/SciML/Optimization.jl/blob/e987377adc6c6687a6108e5691ffaa8dd30cf26c/src/state.jl#L15

nickbrady commented 1 month ago

Yes, I noticed that. But I guess the logical follow-up is why does Optim.jl point to the Optimization.jl documentation?

Perhaps that is out of the scope for this issue.